2020; RUN: -stats -debug -save-temps \
2121; RUN: -o %t.out 2>&1 | FileCheck %s --check-prefix=STATS --check-prefix=DEBUG
2222
23- ; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --check-prefix=IR
23+ ;; We should not see any type of cold attribute or cloning applied
24+ ; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --implicit-check-not cold \
25+ ; RUN: --implicit-check-not ".memprof."
2426
2527;; Try again but with distributed ThinLTO
2628; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \
3941; RUN: -o %t2.out 2>&1 | FileCheck %s --check-prefix=STATS --check-prefix=DEBUG
4042
4143;; Run ThinLTO backend
44+ ;; We should not see any type of cold attribute or cloning applied
4245; RUN: opt -passes=memprof-context-disambiguation \
4346; RUN: -memprof-import-summary=%t.o.thinlto.bc \
44- ; RUN: -stats %t.o -S 2>&1 | FileCheck %s --check-prefix=IR
47+ ; RUN: -stats %t.o -S 2>&1 | FileCheck %s --implicit-check-not cold \
48+ ; RUN: --implicit-check-not ".memprof."
4549
4650; DEBUG: Not found through unique tail call chain: 17377440600225628772 (_Z3barv) from 15822663052811949562 (main) that actually called 8716735811002003409 (xyz) (found multiple possible chains)
4751
4852; STATS: 1 memprof-context-disambiguation - Number of profiled callees found via multiple tail call chains
4953
50- ;; Check that all calls in the IR are to the original functions, leading to a
51- ;; non-cold operator new call.
52-
5354source_filename = "tailcall-nonunique.cc"
5455target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
5556target triple = "x86_64-unknown-linux-gnu"
5657
5758; Function Attrs: noinline
58- ; IR-LABEL: @_Z3barv()
5959define dso_local ptr @_Z3barv () local_unnamed_addr #0 {
6060entry:
61- ; IR: call {{.*}} @_Znam(i64 10) #[[NOTCOLD:[0-9]+]]
6261 %call = tail call ptr @_Znam (i64 10 ) #2 , !memprof !0 , !callsite !9
6362 ret ptr %call
6463}
@@ -67,54 +66,43 @@ entry:
6766declare ptr @_Znam (i64 ) #1
6867
6968; Function Attrs: noinline
70- ; IR-LABEL: @_Z5blah1v()
7169define dso_local ptr @_Z5blah1v () local_unnamed_addr #0 {
7270entry:
73- ; IR: call ptr @_Z3barv()
7471 %call = tail call ptr @_Z3barv ()
7572 ret ptr %call
7673}
7774
7875; Function Attrs: noinline
79- ; IR-LABEL: @_Z5blah2v()
8076define dso_local ptr @_Z5blah2v () local_unnamed_addr #0 {
8177entry:
82- ; IR: call ptr @_Z3barv()
8378 %call = tail call ptr @_Z3barv ()
8479 ret ptr %call
8580}
8681
8782; Function Attrs: noinline
88- ; IR-LABEL: @_Z4baz1v()
8983define dso_local ptr @_Z4baz1v () local_unnamed_addr #0 {
9084entry:
91- ; IR: call ptr @_Z5blah1v()
9285 %call = tail call ptr @_Z5blah1v ()
9386 ret ptr %call
9487}
9588
9689; Function Attrs: noinline
97- ; IR-LABEL: @_Z4baz2v()
9890define dso_local ptr @_Z4baz2v () local_unnamed_addr #0 {
9991entry:
100- ; IR: call ptr @_Z5blah2v()
10192 %call = tail call ptr @_Z5blah2v ()
10293 ret ptr %call
10394}
10495
10596; Function Attrs: noinline
106- ; IR-LABEL: @_Z3foob(i1 %b)
10797define dso_local ptr @_Z3foob (i1 %b ) local_unnamed_addr #0 {
10898entry:
10999 br i1 %b , label %if.then , label %if.else
110100
111101if.then: ; preds = %entry
112- ; IR: call ptr @_Z4baz1v()
113102 %call = tail call ptr @_Z4baz1v ()
114103 br label %return
115104
116105if.else: ; preds = %entry
117- ; IR: call ptr @_Z4baz2v()
118106 %call1 = tail call ptr @_Z4baz2v ()
119107 br label %return
120108
@@ -124,29 +112,21 @@ return: ; preds = %if.else, %if.then
124112}
125113
126114; Function Attrs: noinline
127- ; IR-LABEL: @xyz()
128115define dso_local i32 @xyz () local_unnamed_addr #0 {
129116delete.end13:
130- ; IR: call ptr @_Z3foob(i1 true)
131117 %call = tail call ptr @_Z3foob (i1 true )
132- ; IR: call ptr @_Z3foob(i1 true)
133118 %call1 = tail call ptr @_Z3foob (i1 true )
134- ; IR: call ptr @_Z3foob(i1 false)
135119 %call2 = tail call ptr @_Z3foob (i1 false )
136- ; IR: call ptr @_Z3foob(i1 false)
137120 %call3 = tail call ptr @_Z3foob (i1 false )
138121 ret i32 0
139122}
140123
141124define dso_local i32 @main () local_unnamed_addr #0 {
142125delete.end13:
143- ; IR: call i32 @xyz()
144126 %call1 = tail call i32 @xyz (), !callsite !11
145127 ret i32 0
146128}
147129
148- ; IR: attributes #[[NOTCOLD]] = { builtin allocsize(0) "memprof"="notcold" }
149-
150130attributes #0 = { noinline }
151131attributes #1 = { nobuiltin allocsize(0 ) }
152132attributes #2 = { builtin allocsize(0 ) }
0 commit comments