brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · a6863cb Raw
141 lines · plain
1;; Test to make sure that missing tail call frames in memprof profiles are2;; identified but not cloned when there are multiple non-unique possible3;; tail call chains between the profiled frames.4 5;; -stats requires asserts6; REQUIRES: asserts7 8; RUN: opt -thinlto-bc %s >%t.o9; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \10; RUN:  -supports-hot-cold-new \11; RUN:  -r=%t.o,_Z3barv,plx \12; RUN:  -r=%t.o,_Z5blah1v,plx \13; RUN:  -r=%t.o,_Z5blah2v,plx \14; RUN:  -r=%t.o,_Z4baz1v,plx \15; RUN:  -r=%t.o,_Z4baz2v,plx \16; RUN:  -r=%t.o,_Z3foob,plx \17; RUN:  -r=%t.o,xyz,plx \18; RUN:  -r=%t.o,main,plx \19; RUN:  -r=%t.o,_Znam, \20; RUN:  -stats -debug -save-temps \21; RUN:  -o %t.out 2>&1 | FileCheck %s --check-prefix=STATS --check-prefix=DEBUG22 23;; We should not see any type of cold attribute or cloning applied24; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --implicit-check-not cold \25; RUN:	--implicit-check-not ".memprof."26 27;; Try again but with distributed ThinLTO28; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \29; RUN:  -supports-hot-cold-new \30; RUN:  -thinlto-distributed-indexes \31; RUN:  -r=%t.o,_Z3barv,plx \32; RUN:  -r=%t.o,_Z5blah1v,plx \33; RUN:  -r=%t.o,_Z5blah2v,plx \34; RUN:  -r=%t.o,_Z4baz1v,plx \35; RUN:  -r=%t.o,_Z4baz2v,plx \36; RUN:  -r=%t.o,_Z3foob,plx \37; RUN:  -r=%t.o,xyz,plx \38; RUN:  -r=%t.o,main,plx \39; RUN:  -r=%t.o,_Znam, \40; RUN:  -stats -debug \41; RUN:  -o %t2.out 2>&1 | FileCheck %s --check-prefix=STATS --check-prefix=DEBUG42 43;; Run ThinLTO backend44;; We should not see any type of cold attribute or cloning applied45; RUN: opt -passes=memprof-context-disambiguation \46; RUN:  -memprof-import-summary=%t.o.thinlto.bc \47; RUN:  -stats %t.o -S 2>&1 | FileCheck %s --implicit-check-not cold \48; RUN:	--implicit-check-not ".memprof."49 50; DEBUG: Not found through unique tail call chain: 17377440600225628772 (_Z3barv) from 15822663052811949562 (main) that actually called 8716735811002003409 (xyz) (found multiple possible chains)51 52; STATS: 1 memprof-context-disambiguation - Number of profiled callees found via multiple tail call chains53 54source_filename = "tailcall-nonunique.cc"55target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"56target triple = "x86_64-unknown-linux-gnu"57 58; Function Attrs: noinline59define dso_local ptr @_Z3barv() local_unnamed_addr #0 {60entry:61  %call = tail call ptr @_Znam(i64 10) #2, !memprof !0, !callsite !962  ret ptr %call63}64 65; Function Attrs: nobuiltin allocsize(0)66declare ptr @_Znam(i64) #167 68; Function Attrs: noinline69define dso_local ptr @_Z5blah1v() local_unnamed_addr #0 {70entry:71  %call = tail call ptr @_Z3barv()72  ret ptr %call73}74 75; Function Attrs: noinline76define dso_local ptr @_Z5blah2v() local_unnamed_addr #0 {77entry:78  %call = tail call ptr @_Z3barv()79  ret ptr %call80}81 82; Function Attrs: noinline83define dso_local ptr @_Z4baz1v() local_unnamed_addr #0 {84entry:85  %call = tail call ptr @_Z5blah1v()86  ret ptr %call87}88 89; Function Attrs: noinline90define dso_local ptr @_Z4baz2v() local_unnamed_addr #0 {91entry:92  %call = tail call ptr @_Z5blah2v()93  ret ptr %call94}95 96; Function Attrs: noinline97define dso_local ptr @_Z3foob(i1 %b) local_unnamed_addr #0 {98entry:99  br i1 %b, label %if.then, label %if.else100 101if.then:                                          ; preds = %entry102  %call = tail call ptr @_Z4baz1v()103  br label %return104 105if.else:                                          ; preds = %entry106  %call1 = tail call ptr @_Z4baz2v()107  br label %return108 109return:                                           ; preds = %if.else, %if.then110  %retval.0 = phi ptr [ %call, %if.then ], [ %call1, %if.else ]111  ret ptr %retval.0112}113 114; Function Attrs: noinline115define dso_local i32 @xyz() local_unnamed_addr #0 {116delete.end13:117  %call = tail call ptr @_Z3foob(i1 true)118  %call1 = tail call ptr @_Z3foob(i1 true)119  %call2 = tail call ptr @_Z3foob(i1 false)120  %call3 = tail call ptr @_Z3foob(i1 false)121  ret i32 0122}123 124define dso_local i32 @main() local_unnamed_addr #0 {125delete.end13:126  %call1 = tail call i32 @xyz(), !callsite !11127  ret i32 0128}129 130attributes #0 = { noinline }131attributes #1 = { nobuiltin allocsize(0) }132attributes #2 = { builtin allocsize(0) }133 134!0 = !{!5, !7}135!5 = !{!6, !"notcold"}136!6 = !{i64 3186456655321080972, i64 8632435727821051414}137!7 = !{!8, !"cold"}138!8 = !{i64 3186456655321080972, i64 -3421689549917153178}139!9 = !{i64 3186456655321080972}140!11 = !{i64 -3421689549917153178}141