83 lines · plain
1;; Test context disambiguation for a callgraph containing multiple memprof2;; contexts with recursion, where we need to perform additional cloning3;; during function assignment/cloning to handle the combination of contexts4;; to 2 different allocations. In particular, ensures that the recursive edges5;; are handled correctly during the function assignment cloning, where they6;; were previously causing an assert (and infinite recursion in an NDEBUG7;; compile).8;;9;; This test is a hand modified version of funcassigncloning.ll, where all10;; the calls to new were moved into one function, with several recursive11;; calls for the different contexts. The code as written here is somewhat12;; nonsensical as it would produce infinite recursion, but in a real case13;; the recursive calls would be suitably guarded.14;;15;; For this test we just ensure that it doesn't crash, and gets the expected16;; cloning remarks.17 18; RUN: opt -passes=memprof-context-disambiguation -supports-hot-cold-new \19; RUN: -memprof-verify-ccg -memprof-verify-nodes \20; RUN: -stats -pass-remarks=memprof-context-disambiguation \21; RUN: %s -S 2>&1 | FileCheck %s --check-prefix=REMARKS22 23 24target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"25target triple = "x86_64-unknown-linux-gnu"26 27declare ptr @_Znam(i64) #128 29define internal void @_Z1DPPcS0_(ptr %0, ptr %1) #3 {30entry:31 call void @_Z1DPPcS0_(ptr noundef %0, ptr noundef %1), !callsite !1632 call void @_Z1DPPcS0_(ptr noundef %0, ptr noundef %1), !callsite !1733 call void @_Z1DPPcS0_(ptr noundef %0, ptr noundef %1), !callsite !1834 %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #6, !memprof !0, !callsite !735 %call1 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #6, !memprof !8, !callsite !1536 ret void37}38 39; uselistorder directives40uselistorder ptr @_Znam, { 1, 0 }41 42attributes #1 = { "no-trapping-math"="true" }43attributes #3 = { "frame-pointer"="all" }44attributes #6 = { builtin }45 46!0 = !{!1, !3, !5}47!1 = !{!2, !"cold"}48!2 = !{i64 -3461278137325233666, i64 -7799663586031895603, i64 -7799663586031895603}49!3 = !{!4, !"notcold"}50!4 = !{i64 -3461278137325233666, i64 -3483158674395044949, i64 -3483158674395044949}51!5 = !{!6, !"notcold"}52!6 = !{i64 -3461278137325233666, i64 -2441057035866683071, i64 -2441057035866683071}53!7 = !{i64 -3461278137325233666}54!8 = !{!9, !11, !13}55!9 = !{!10, !"notcold"}56!10 = !{i64 -1415475215210681400, i64 -2441057035866683071, i64 -2441057035866683071}57!11 = !{!12, !"cold"}58!12 = !{i64 -1415475215210681400, i64 -3483158674395044949, i64 -3483158674395044949}59!13 = !{!14, !"notcold"}60!14 = !{i64 -1415475215210681400, i64 -7799663586031895603, i64 -7799663586031895603}61!15 = !{i64 -1415475215210681400}62!16 = !{i64 -2441057035866683071}63!17 = !{i64 -3483158674395044949}64!18 = !{i64 -7799663586031895603}65 66 67;; We greedily create a clone that is initially used by the clones of the68;; first call to new. However, we end up with an incompatible set of callers69;; given the second call to new which has clones with a different combination of70;; callers. Eventually, we create 2 more clones, and the first clone becomes dead.71; REMARKS: created clone _Z1DPPcS0_.memprof.172; REMARKS: created clone _Z1DPPcS0_.memprof.273; REMARKS: created clone _Z1DPPcS0_.memprof.374; REMARKS: call in clone _Z1DPPcS0_ assigned to call function clone _Z1DPPcS0_.memprof.275; REMARKS: call in clone _Z1DPPcS0_.memprof.2 marked with memprof allocation attribute cold76; REMARKS: call in clone _Z1DPPcS0_ assigned to call function clone _Z1DPPcS0_.memprof.377; REMARKS: call in clone _Z1DPPcS0_.memprof.3 marked with memprof allocation attribute notcold78; REMARKS: call in clone _Z1DPPcS0_ assigned to call function clone _Z1DPPcS0_79; REMARKS: call in clone _Z1DPPcS0_ marked with memprof allocation attribute notcold80; REMARKS: call in clone _Z1DPPcS0_.memprof.2 marked with memprof allocation attribute notcold81; REMARKS: call in clone _Z1DPPcS0_.memprof.3 marked with memprof allocation attribute cold82; REMARKS: call in clone _Z1DPPcS0_ marked with memprof allocation attribute notcold83