diff options
Diffstat (limited to 'llvm/test/Transforms/PGOProfile')
98 files changed, 0 insertions, 6101 deletions
diff --git a/llvm/test/Transforms/PGOProfile/Inputs/PR28219.proftext b/llvm/test/Transforms/PGOProfile/Inputs/PR28219.proftext deleted file mode 100644 index 7ebc13cd128..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/PR28219.proftext +++ /dev/null @@ -1,10 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -@bar -256 -1 -2 -@foo -512 -1 -3 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext deleted file mode 100644 index 8ca9db9c051..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/branch1.proftext +++ /dev/null @@ -1,8 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -test_br_1 -25571299074 -2 -3 -2 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch1_large_count.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch1_large_count.proftext deleted file mode 100644 index a5b1f8204e8..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/branch1_large_count.proftext +++ /dev/null @@ -1,8 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -test_br_1 -25571299074 -2 -12884901888 -8589934592 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext deleted file mode 100644 index b5fee2b6f4f..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/branch2.proftext +++ /dev/null @@ -1,8 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -test_br_2 -29667547796 -2 -1 -1 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext b/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext deleted file mode 100644 index 7613b643b16..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/criticaledge.proftext +++ /dev/null @@ -1,19 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -test_criticalEdge -82323253069 -8 -2 -1 -2 -2 -0 -1 -2 -1 - -<stdin>:bar -12884901887 -1 -7 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/cspgo.proftext b/llvm/test/Transforms/PGOProfile/Inputs/cspgo.proftext deleted file mode 100644 index e40a0f29fcc..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/cspgo.proftext +++ /dev/null @@ -1,151 +0,0 @@ -# CSIR level Instrumentation Flag -:csir -bar_m -# Func Hash: -29667547796 -# Num Counters: -2 -# Counter Values: -99949 -51 - -bar_m -# Func Hash: -1224979111529676799 -# Num Counters: -2 -# Counter Values: -100000 -99949 - -csfdo_plain.c:cond -# Func Hash: -1152921517491748863 -# Num Counters: -1 -# Counter Values: -200000 - -csfdo_plain.c:cond -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -200000 - -bar_m2 -# Func Hash: -1152921534274394772 -# Num Counters: -2 -# Counter Values: -99938 -62 - -bar_m2 -# Func Hash: -29667547796 -# Num Counters: -2 -# Counter Values: -99938 -62 - -foo -# Func Hash: -1152921640672869708 -# Num Counters: -10 -# Counter Values: -100000 -100000 -0 -66666 -66666 -0 -100000 -66667 -100000 -1 - -foo -# Func Hash: -29212902728 -# Num Counters: -2 -# Counter Values: -100000 -1 - -bar -# Func Hash: -1152921569533132113 -# Num Counters: -5 -# Counter Values: -0 -0 -0 -0 -0 - -bar -# Func Hash: -56228292833 -# Num Counters: -4 -# Counter Values: -800000 -399999 -100000 -100000 - -main -# Func Hash: -1152921517491748863 -# Num Counters: -1 -# Counter Values: -1 - -main -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -1 - -csfdo_plain.c:barbar -# Func Hash: -1152921517491748863 -# Num Counters: -1 -# Counter Values: -100000 - -csfdo_plain.c:barbar -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -100000 - -goo -# Func Hash: -1152921517491748863 -# Num Counters: -1 -# Counter Values: -100000 - -goo -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -100000 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext b/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext deleted file mode 100644 index a38d7939ebd..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/diag.proftext +++ /dev/null @@ -1,7 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -foo -12884999999 -1 -1 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext b/llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext deleted file mode 100644 index aaa137e3a42..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/diag_FE.proftext +++ /dev/null @@ -1,5 +0,0 @@ -foo -12884999999 -1 -1 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext b/llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext deleted file mode 100644 index 2dc2c2ec9f3..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext +++ /dev/null @@ -1,17 +0,0 @@ -# IR level Instrumentation Flag -:ir -foo -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -9999 - -bar -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -0 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/indirect_call.proftext b/llvm/test/Transforms/PGOProfile/Inputs/indirect_call.proftext deleted file mode 100644 index d453090d1c5..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/indirect_call.proftext +++ /dev/null @@ -1,43 +0,0 @@ -:ir -bar -# Func Hash: -281487861612543 -# Num Counters: -1 -# Counter Values: -140 -# Num Value Kinds: -1 -# ValueKind = IPVK_IndirectCallTarget: -0 -# NumValueSites: -1 -3 -func2:80 -func1:40 -func3:20 - -func1 -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -40 - -func2 -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -80 - -func3 -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -20 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/indirectbr.proftext b/llvm/test/Transforms/PGOProfile/Inputs/indirectbr.proftext deleted file mode 100644 index 39099684762..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/indirectbr.proftext +++ /dev/null @@ -1,12 +0,0 @@ -# IR level Instrumentation Flag -:ir -foo -# Func Hash: -47485104005 -# Num Counters: -4 -# Counter Values: -139 -20 -5 -63 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/irreducible.proftext b/llvm/test/Transforms/PGOProfile/Inputs/irreducible.proftext deleted file mode 100644 index 9b0210d9a30..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/irreducible.proftext +++ /dev/null @@ -1,29 +0,0 @@ -:ir -_Z11irreducibleii -# Func Hash: -64451410787 -# Num Counters: -6 -# Counter Values: -1000 -950 -100 -373 -1 -0 - -_Z11irreduciblePh -# Func Hash: -104649601521 -# Num Counters: -9 -# Counter Values: -100 -300 -99 -300 -201 -1 -1 -0 -0 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext b/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext deleted file mode 100644 index c71fd04170b..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/landingpad.proftext +++ /dev/null @@ -1,16 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -foo -59130013419 -4 -3 -1 -2 -0 - -bar -24868915205 -2 -3 -2 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/large_count_remarks.proftext b/llvm/test/Transforms/PGOProfile/Inputs/large_count_remarks.proftext deleted file mode 100644 index 814af7402b2..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/large_count_remarks.proftext +++ /dev/null @@ -1,8 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -test -25571299074 -2 -40000000000 -20000000000 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext deleted file mode 100644 index c19737149ca..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/loop1.proftext +++ /dev/null @@ -1,8 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -test_simple_for -34137660316 -2 -96 -4 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext deleted file mode 100644 index af3a71df1e6..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/loop2.proftext +++ /dev/null @@ -1,9 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -test_nested_for -53929068288 -3 -33 -10 -6 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/memop_size_annotation.proftext b/llvm/test/Transforms/PGOProfile/Inputs/memop_size_annotation.proftext deleted file mode 100644 index 400b29df303..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/memop_size_annotation.proftext +++ /dev/null @@ -1,27 +0,0 @@ -# IR level Instrumentation Flag -:ir -foo -# Func Hash: -53929068288 -# Num Counters: -3 -# Counter Values: -556 -20 -1 -# Num Value Kinds: -1 -# ValueKind = IPVK_MemOPSize: -1 -# NumValueSites: -1 -9 -7:33 -2:88 -9:72 -4:66 -1:99 -5:55 -6:44 -3:77 -8:22 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext b/llvm/test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext deleted file mode 100644 index 5bf67fb2bfa..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/multiple_hash_profile.proftext +++ /dev/null @@ -1,36 +0,0 @@ -# IR level Instrumentation Flag -:ir -_Z3fooi -# Func Hash: -72057606922829823 -# Num Counters: -2 -# Counter Values: -18 -12 - -_Z3fooi -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -0 - -_Z3bari -# Func Hash: -72057606922829823 -# Num Counters: -2 -# Counter Values: -0 -0 - -_Z4m2f1v -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -1 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/noreturncall.proftext b/llvm/test/Transforms/PGOProfile/Inputs/noreturncall.proftext deleted file mode 100644 index 1bedce5b9f9..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/noreturncall.proftext +++ /dev/null @@ -1,11 +0,0 @@ -# IR level Instrumentation Flag -:ir -foo -# Func Hash: -36496524737 -# Num Counters: -3 -# Counter Values: -21 -21 -0 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/remap.map b/llvm/test/Transforms/PGOProfile/Inputs/remap.map deleted file mode 100644 index df3d82d38bd..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/remap.map +++ /dev/null @@ -1,8 +0,0 @@ -# foo:: and foo::detail:: are equivalent -name 3foo N3foo6detailE - -# foo::qux and foo::quux are equivalent -type N3foo3quxE N3foo4quuxE - -# N::X and M::X are equivalent -name N1N1XE N1M1XE diff --git a/llvm/test/Transforms/PGOProfile/Inputs/remap.proftext b/llvm/test/Transforms/PGOProfile/Inputs/remap.proftext deleted file mode 100644 index 40054d78f5a..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/remap.proftext +++ /dev/null @@ -1,8 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -_ZN3foo3barERKN1N1XINS_4quuxEEE -25571299074 -2 -3 -2 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/select1.proftext b/llvm/test/Transforms/PGOProfile/Inputs/select1.proftext deleted file mode 100644 index be80acb5d12..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/select1.proftext +++ /dev/null @@ -1,8 +0,0 @@ -:ir -test_br_2 -72057623705475732 -3 -4 -1 -1 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/select2.proftext b/llvm/test/Transforms/PGOProfile/Inputs/select2.proftext deleted file mode 100644 index 56d78387ec2..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/select2.proftext +++ /dev/null @@ -1,11 +0,0 @@ -# IR level Instrumentation Flag -:ir -foo -# Func Hash: -72057628175588252 -# Num Counters: -3 -# Counter Values: -800 -3 -300 diff --git a/llvm/test/Transforms/PGOProfile/Inputs/select_hash_conflict.proftext b/llvm/test/Transforms/PGOProfile/Inputs/select_hash_conflict.proftext deleted file mode 100644 index ccc3b803fc8..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/select_hash_conflict.proftext +++ /dev/null @@ -1,10 +0,0 @@ -# IR level Instrumentation Flag -:ir -foo -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -1 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext b/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext deleted file mode 100644 index bebd65fa4c9..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/switch.proftext +++ /dev/null @@ -1,10 +0,0 @@ -# :ir is the flag to indicate this is IR level profile. -:ir -test_switch -46200943743 -4 -0 -5 -2 -3 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cs.proftext b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cs.proftext deleted file mode 100644 index 4717752da71..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cs.proftext +++ /dev/null @@ -1,72 +0,0 @@ -# CSIR level Instrumentation Flag -:csir -cond.llvm.11253644763537639171 -# Func Hash: -1152921517491748863 -# Num Counters: -1 -# Counter Values: -200000 - -foo -# Func Hash: -29212902728 -# Num Counters: -2 -# Counter Values: -100000 -1 - -bar -# Func Hash: -1152921534274394772 -# Num Counters: -2 -# Counter Values: -0 -0 - -bar -# Func Hash: -29667547796 -# Num Counters: -2 -# Counter Values: -100000 -100000 - -main -# Func Hash: -1152921517491748863 -# Num Counters: -1 -# Counter Values: -1 - -main -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -1 - -cspgo.c:foo -# Func Hash: -1152921563228422740 -# Num Counters: -4 -# Counter Values: -100000 -100000 -0 -1 - -cspgo_bar.c:cond -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -200000 - diff --git a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cspgo_bar_gen.ll b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cspgo_bar_gen.ll deleted file mode 100644 index bec04c6a3c8..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cspgo_bar_gen.ll +++ /dev/null @@ -1,74 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -$__llvm_profile_filename = comdat any -$__llvm_profile_raw_version = comdat any - -@odd = common dso_local global i32 0, align 4 -@even = common dso_local global i32 0, align 4 -@__llvm_profile_filename = constant [25 x i8] c"pass2/default_%m.profraw\00", comdat -@__llvm_profile_raw_version = constant i64 216172782113783812, comdat - -define dso_local void @bar(i32 %n) !prof !29 { -entry: - %call = tail call fastcc i32 @cond(i32 %n) - %tobool = icmp eq i32 %call, 0 - br i1 %tobool, label %if.else, label %if.then, !prof !30 - -if.then: - %0 = load i32, i32* @odd, align 4 - %inc = add i32 %0, 1 - store i32 %inc, i32* @odd, align 4 - br label %if.end - -if.else: - %1 = load i32, i32* @even, align 4 - %inc1 = add i32 %1, 1 - store i32 %inc1, i32* @even, align 4 - br label %if.end - -if.end: - ret void -} - -define internal fastcc i32 @cond(i32 %i) #1 !prof !29 !PGOFuncName !35 { -entry: - %rem = srem i32 %i, 2 - ret i32 %rem -} - -attributes #1 = { inlinehint noinline } - -!llvm.module.flags = !{!0, !1} - -!0 = !{i32 1, !"wchar_size", i32 4} -!1 = !{i32 1, !"ProfileSummary", !2} -!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} -!3 = !{!"ProfileFormat", !"InstrProf"} -!4 = !{!"TotalCount", i64 500002} -!5 = !{!"MaxCount", i64 200000} -!6 = !{!"MaxInternalCount", i64 100000} -!7 = !{!"MaxFunctionCount", i64 200000} -!8 = !{!"NumCounts", i64 6} -!9 = !{!"NumFunctions", i64 4} -!10 = !{!"DetailedSummary", !11} -!11 = !{!12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27} -!12 = !{i32 10000, i64 200000, i32 1} -!13 = !{i32 100000, i64 200000, i32 1} -!14 = !{i32 200000, i64 200000, i32 1} -!15 = !{i32 300000, i64 200000, i32 1} -!16 = !{i32 400000, i64 200000, i32 1} -!17 = !{i32 500000, i64 100000, i32 4} -!18 = !{i32 600000, i64 100000, i32 4} -!19 = !{i32 700000, i64 100000, i32 4} -!20 = !{i32 800000, i64 100000, i32 4} -!21 = !{i32 900000, i64 100000, i32 4} -!22 = !{i32 950000, i64 100000, i32 4} -!23 = !{i32 990000, i64 100000, i32 4} -!24 = !{i32 999000, i64 100000, i32 4} -!25 = !{i32 999900, i64 100000, i32 4} -!26 = !{i32 999990, i64 100000, i32 4} -!27 = !{i32 999999, i64 1, i32 6} -!29 = !{!"function_entry_count", i64 200000} -!30 = !{!"branch_weights", i32 100000, i32 100000} -!35 = !{!"cspgo_bar.c:cond"} diff --git a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cspgo_bar_use.ll b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cspgo_bar_use.ll deleted file mode 100644 index 01617221590..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_cspgo_bar_use.ll +++ /dev/null @@ -1,70 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@odd = common dso_local global i32 0, align 4 -@even = common dso_local global i32 0, align 4 - -define dso_local void @bar(i32 %n) #0 !prof !29 { -entry: - %call = tail call fastcc i32 @cond(i32 %n) - %tobool = icmp eq i32 %call, 0 - br i1 %tobool, label %if.else, label %if.then, !prof !30 - -if.then: - %0 = load i32, i32* @odd, align 4 - %inc = add i32 %0, 1 - store i32 %inc, i32* @odd, align 4 - br label %if.end - -if.else: - %1 = load i32, i32* @even, align 4 - %inc1 = add i32 %1, 1 - store i32 %inc1, i32* @even, align 4 - br label %if.end - -if.end: - ret void -} - -define internal fastcc i32 @cond(i32 %i) #1 !prof !29 !PGOFuncName !35 { -entry: - %rem = srem i32 %i, 2 - ret i32 %rem -} - -attributes #0 = { "target-cpu"="x86-64" } -attributes #1 = { inlinehint noinline } - -!llvm.module.flags = !{!0, !1} - -!0 = !{i32 1, !"wchar_size", i32 4} -!1 = !{i32 1, !"ProfileSummary", !2} -!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} -!3 = !{!"ProfileFormat", !"InstrProf"} -!4 = !{!"TotalCount", i64 500002} -!5 = !{!"MaxCount", i64 200000} -!6 = !{!"MaxInternalCount", i64 100000} -!7 = !{!"MaxFunctionCount", i64 200000} -!8 = !{!"NumCounts", i64 6} -!9 = !{!"NumFunctions", i64 4} -!10 = !{!"DetailedSummary", !11} -!11 = !{!12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27} -!12 = !{i32 10000, i64 200000, i32 1} -!13 = !{i32 100000, i64 200000, i32 1} -!14 = !{i32 200000, i64 200000, i32 1} -!15 = !{i32 300000, i64 200000, i32 1} -!16 = !{i32 400000, i64 200000, i32 1} -!17 = !{i32 500000, i64 100000, i32 4} -!18 = !{i32 600000, i64 100000, i32 4} -!19 = !{i32 700000, i64 100000, i32 4} -!20 = !{i32 800000, i64 100000, i32 4} -!21 = !{i32 900000, i64 100000, i32 4} -!22 = !{i32 950000, i64 100000, i32 4} -!23 = !{i32 990000, i64 100000, i32 4} -!24 = !{i32 999000, i64 100000, i32 4} -!25 = !{i32 999900, i64 100000, i32 4} -!26 = !{i32 999990, i64 100000, i32 4} -!27 = !{i32 999999, i64 1, i32 6} -!29 = !{!"function_entry_count", i64 200000} -!30 = !{!"branch_weights", i32 100000, i32 100000} -!35 = !{!"cspgo_bar.c:cond"} diff --git a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.ll b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.ll deleted file mode 100644 index 8732e540767..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_indirect_call_promotion.ll +++ /dev/null @@ -1,16 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -source_filename = "thinlto_indirect_call_promotion.c" - -define void @a() { -entry: - ret void -} - -define internal void @c() !PGOFuncName !1 { -entry: - ret void -} - -!1 = !{!"thinlto_indirect_call_promotion.c:c"} diff --git a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp.ll b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp.ll deleted file mode 100644 index 22860f52b5d..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp.ll +++ /dev/null @@ -1,27 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@fptr = external local_unnamed_addr global void ()*, align 8 - -; Function Attrs: norecurse nounwind uwtable -define void @_Z6updatei(i32 %i) local_unnamed_addr #0 { -entry: - store void ()* @_ZL3foov, void ()** @fptr, align 8 - ret void -} - -; Function Attrs: norecurse nounwind readnone uwtable -define internal void @_ZL3foov() #1 { -entry: - ret void -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3} -!llvm.ident = !{!31} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297016)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) -!1 = !DIFile(filename: "b.cc", directory: "/ssd/llvm/abc/small") -!2 = !{} -!3 = !{i32 2, !"Debug Info Version", i32 3} -!31 = !{!"clang version 5.0.0 (trunk 297016)"} diff --git a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp2a.ll b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp2a.ll deleted file mode 100644 index 545b36c1180..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp2a.ll +++ /dev/null @@ -1,21 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; Function Attrs: norecurse nounwind readnone uwtable -define internal void @_ZL3foov() #1 { -entry: - call void @_ZL3barv() - ret void -} - -declare void @_ZL3barv() - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3} -!llvm.ident = !{!31} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297016)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) -!1 = !DIFile(filename: "b.cc", directory: "/ssd/llvm/abc/small") -!2 = !{} -!3 = !{i32 2, !"Debug Info Version", i32 3} -!31 = !{!"clang version 5.0.0 (trunk 297016)"} diff --git a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp2b.ll b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp2b.ll deleted file mode 100644 index f8de10c4d0d..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp2b.ll +++ /dev/null @@ -1,28 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define void @_ZL3barv() #1 { -entry: - call void @dummy() - call void @dummy() - call void @dummy() - call void @dummy() - call void @dummy() - call void @dummy() - ret void -} - -define internal void @dummy() { -entry: - ret void -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3} -!llvm.ident = !{!31} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297016)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) -!1 = !DIFile(filename: "c.cc", directory: "/ssd/llvm/abc/small") -!2 = !{} -!3 = !{i32 2, !"Debug Info Version", i32 3} -!31 = !{!"clang version 5.0.0 (trunk 297016)"} diff --git a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp3.ll b/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp3.ll deleted file mode 100644 index 10d633be59f..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/thinlto_samplepgo_icp3.ll +++ /dev/null @@ -1,31 +0,0 @@ -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@fptr = external local_unnamed_addr global void ()*, align 8 - -; Function Attrs: norecurse nounwind uwtable -define void @_Z6updatei(i32 %i) local_unnamed_addr #0 { -entry: - store void ()* @_ZL3foov, void ()** @fptr, align 8 - ret void -} - -; Function Attrs: nounwind readnone uwtable -define internal void @_ZL3foov() !prof !34 { -entry: - %0 = load void ()*, void ()** @fptr, align 8 - tail call void %0(), !prof !40 - ret void -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3} -!llvm.ident = !{!31} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297016)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) -!1 = !DIFile(filename: "b.cc", directory: "/ssd/llvm/abc/small") -!2 = !{} -!3 = !{i32 2, !"Debug Info Version", i32 3} -!31 = !{!"clang version 5.0.0 (trunk 297016)"} -!34 = !{!"function_entry_count", i64 1} -!40 = !{!"VP", i32 0, i64 3000, i64 -8789629626369651636, i64 3000} diff --git a/llvm/test/Transforms/PGOProfile/Inputs/unreachable_bb.proftext b/llvm/test/Transforms/PGOProfile/Inputs/unreachable_bb.proftext deleted file mode 100644 index 58f2cc82598..00000000000 --- a/llvm/test/Transforms/PGOProfile/Inputs/unreachable_bb.proftext +++ /dev/null @@ -1,9 +0,0 @@ -# IR level Instrumentation Flag -:ir -foo -# Func Hash: -12884901887 -# Num Counters: -1 -# Counter Values: -0 diff --git a/llvm/test/Transforms/PGOProfile/PR28219.ll b/llvm/test/Transforms/PGOProfile/PR28219.ll deleted file mode 100644 index a0e1904c333..00000000000 --- a/llvm/test/Transforms/PGOProfile/PR28219.ll +++ /dev/null @@ -1,12 +0,0 @@ -; Test that we annotate entire program's summary and not just this module's -; RUN: llvm-profdata merge %S/Inputs/PR28219.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s - -define i32 @bar() { -entry: - ret i32 1 -} -; CHECK-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}} -; CHECK-DAG: {{![0-9]+}} = !{!"NumFunctions", i64 2} -; CHECK-DAG: {{![0-9]+}} = !{!"MaxFunctionCount", i64 3} - diff --git a/llvm/test/Transforms/PGOProfile/X86/lit.local.cfg b/llvm/test/Transforms/PGOProfile/X86/lit.local.cfg deleted file mode 100644 index e71f3cc4c41..00000000000 --- a/llvm/test/Transforms/PGOProfile/X86/lit.local.cfg +++ /dev/null @@ -1,3 +0,0 @@ -if not 'X86' in config.root.targets: - config.unsupported = True - diff --git a/llvm/test/Transforms/PGOProfile/X86/macho.ll b/llvm/test/Transforms/PGOProfile/X86/macho.ll deleted file mode 100644 index d2fe65f2fa7..00000000000 --- a/llvm/test/Transforms/PGOProfile/X86/macho.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -instrprof -S | llc | FileCheck %s --check-prefix=MACHO-DIRECTIVE - -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.11.0" - -; MACHO-DIRECTIVE: .weak_definition ___llvm_profile_raw_version -define i32 @test_macho(i32 %i) { -entry: - ret i32 %i -} diff --git a/llvm/test/Transforms/PGOProfile/branch1.ll b/llvm/test/Transforms/PGOProfile/branch1.ll deleted file mode 100644 index bbc7b722913..00000000000 --- a/llvm/test/Transforms/PGOProfile/branch1.ll +++ /dev/null @@ -1,62 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-COMDAT -; RUN: opt < %s -mtriple=x86_64-apple-darwin -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-DARWIN-LINKONCE - -; New PM -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-COMDAT -; RUN: opt < %s -mtriple=x86_64-apple-darwin -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-DARWIN-LINKONCE - -; RUN: llvm-profdata merge %S/Inputs/branch1.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE - -; RUN: llvm-profdata merge %S/Inputs/branch1_large_count.proftext -o %t.l.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.l.profdata -S | FileCheck %s --check-prefix=USE-LARGE - -; New PM -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.l.profdata -S | FileCheck %s --check-prefix=USE-LARGE - -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -pass-remarks=pgo-instrumentation -pgo-emit-branch-prob -S 2>&1| FileCheck %s --check-prefix=ANALYSIS -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pass-remarks=pgo-instrumentation -pgo-emit-branch-prob -S 2>&1| FileCheck %s --check-prefix=ANALYSIS - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" -; GEN-DARWIN-LINKONCE: target triple = "x86_64-apple-darwin" - -; GEN-COMDAT: $__llvm_profile_raw_version = comdat any -; GEN-COMDAT: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat -; GEN-LINKONCE: @__llvm_profile_raw_version = linkonce constant i64 {{[0-9]+}} -; GEN: @__profn_test_br_1 = private constant [9 x i8] c"test_br_1" - -define i32 @test_br_1(i32 %i) { -; USE-LABEL: @test_br_1 -; USE-SAME: !prof ![[FUNC_ENTRY_COUNT:[0-9]+]] -entry: -; GEN: entry: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_1, i32 0, i32 0), i64 25571299074, i32 2, i32 0) - %cmp = icmp sgt i32 %i, 0 - br i1 %cmp, label %if.then, label %if.end -; USE: br i1 %cmp, label %if.then, label %if.end -; USE-SAME: !prof ![[BW_ENTRY:[0-9]+]] -; USE-DAG: ![[BW_ENTRY]] = !{!"branch_weights", i32 2, i32 1} -; USE-LARGE: br i1 %cmp, label %if.then, label %if.end -; USE-LARGE-SAME: !prof ![[BW_L_ENTRY:[0-9]+]] -; USE-LARGE-DAG: ![[BW_L_ENTRY]] = !{!"branch_weights", i32 -1431655766, i32 1431655765} - -if.then: -; GEN: if.then: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_1, i32 0, i32 0), i64 25571299074, i32 2, i32 1) - %add = add nsw i32 %i, 2 - br label %if.end - -if.end: -; GEN: if.end: -; GEN-NOT: llvm.instrprof.increment -; GEN: ret i32 - %retv = phi i32 [ %add, %if.then ], [ %i, %entry ] - ret i32 %retv -} -; USE-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}} -; USE-DAG: {{![0-9]+}} = !{!"DetailedSummary", {{![0-9]+}}} -; USE-DAG: ![[FUNC_ENTRY_COUNT]] = !{!"function_entry_count", i64 3} - -; ANALYSIS:remark: <unknown>:0:0: sgt_i32_Zero {{.*}}66.67% (total count : 3) diff --git a/llvm/test/Transforms/PGOProfile/branch2.ll b/llvm/test/Transforms/PGOProfile/branch2.ll deleted file mode 100644 index f8df54b94d4..00000000000 --- a/llvm/test/Transforms/PGOProfile/branch2.ll +++ /dev/null @@ -1,41 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: llvm-profdata merge %S/Inputs/branch2.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat -; GEN: @__profn_test_br_2 = private constant [9 x i8] c"test_br_2" - -define i32 @test_br_2(i32 %i) { -entry: -; GEN: entry: -; GEN-NOT: llvm.instrprof.increment - %cmp = icmp sgt i32 %i, 0 - br i1 %cmp, label %if.then, label %if.else -; USE: br i1 %cmp, label %if.then, label %if.else -; USE-SAME: !prof ![[BW_ENTRY:[0-9]+]] -; USE: ![[BW_ENTRY]] = !{!"branch_weights", i32 1, i32 1} - -if.then: -; GEN: if.then: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_2, i32 0, i32 0), i64 29667547796, i32 2, i32 0) - %add = add nsw i32 %i, 2 - br label %if.end - -if.else: -; GEN: if.else: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_2, i32 0, i32 0), i64 29667547796, i32 2, i32 1) - %sub = sub nsw i32 %i, 2 - br label %if.end - -if.end: -; GEN: if.end: -; GEN-NOT: llvm.instrprof.increment - %retv = phi i32 [ %add, %if.then ], [ %sub, %if.else ] - ret i32 %retv -; GEN: ret -} diff --git a/llvm/test/Transforms/PGOProfile/chr.ll b/llvm/test/Transforms/PGOProfile/chr.ll deleted file mode 100644 index 399209181e8..00000000000 --- a/llvm/test/Transforms/PGOProfile/chr.ll +++ /dev/null @@ -1,1912 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -chr -instcombine -simplifycfg -S | FileCheck %s -; RUN: opt < %s -passes='require<profile-summary>,function(chr,instcombine,simplify-cfg)' -S | FileCheck %s - -declare void @foo() -declare void @bar() - -; Simple case. -; Roughly, -; t0 = *i -; if ((t0 & 1) != 0) // Likely true -; foo() -; if ((t0 & 2) != 0) // Likely true -; foo() -; -> -; t0 = *i -; if ((t0 & 3) != 0) { // Likely true -; foo() -; foo() -; } else { -; if ((t0 & 1) != 0) -; foo() -; if ((t0 & 2) != 0) -; foo() -; } -define void @test_chr_1(i32* %i) !prof !14 { -; CHECK-LABEL: @test_chr_1( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 3 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 3 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 0 -; CHECK-NEXT: br i1 [[TMP4]], label [[BB1_NONCHR:%.*]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1_NONCHR]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0 -; CHECK-NEXT: br i1 [[TMP6]], label [[BB3]], label [[BB2_NONCHR:%.*]], !prof !16 -; CHECK: bb2.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: ret void -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 1 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb1, label %bb0, !prof !15 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %3 = and i32 %0, 2 - %4 = icmp eq i32 %3, 0 - br i1 %4, label %bb3, label %bb2, !prof !15 - -bb2: - call void @foo() - br label %bb3 - -bb3: - ret void -} - -; Simple case with a cold block. -; Roughly, -; t0 = *i -; if ((t0 & 1) != 0) // Likely true -; foo() -; if ((t0 & 2) == 0) // Likely false -; bar() -; if ((t0 & 4) != 0) // Likely true -; foo() -; -> -; t0 = *i -; if ((t0 & 7) == 7) { // Likely true -; foo() -; foo() -; } else { -; if ((t0 & 1) != 0) -; foo() -; if ((t0 & 2) == 0) -; bar() -; if ((t0 & 4) != 0) -; foo() -; } -define void @test_chr_1_1(i32* %i) !prof !14 { -; CHECK-LABEL: @test_chr_1_1( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 7 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 7 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB5:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 0 -; CHECK-NEXT: br i1 [[TMP4]], label [[BB1_NONCHR:%.*]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1_NONCHR]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0 -; CHECK-NEXT: br i1 [[TMP6]], label [[BB2_NONCHR:%.*]], label [[BB3_NONCHR:%.*]], !prof !16 -; CHECK: bb2.nonchr: -; CHECK-NEXT: call void @bar() -; CHECK-NEXT: br label [[BB3_NONCHR]] -; CHECK: bb3.nonchr: -; CHECK-NEXT: [[TMP7:%.*]] = and i32 [[TMP0]], 4 -; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 0 -; CHECK-NEXT: br i1 [[TMP8]], label [[BB5]], label [[BB4_NONCHR:%.*]], !prof !16 -; CHECK: bb4.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB5]] -; CHECK: bb5: -; CHECK-NEXT: ret void -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 1 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb1, label %bb0, !prof !15 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %3 = and i32 %0, 2 - %4 = icmp eq i32 %3, 0 - br i1 %4, label %bb2, label %bb3, !prof !15 - -bb2: - call void @bar() - br label %bb3 - -bb3: - %5 = and i32 %0, 4 - %6 = icmp eq i32 %5, 0 - br i1 %6, label %bb5, label %bb4, !prof !15 - -bb4: - call void @foo() - br label %bb5 - -bb5: - ret void -} - -; With an aggregate bit check. -; Roughly, -; t0 = *i -; if ((t0 & 255) != 0) // Likely true -; if ((t0 & 1) != 0) // Likely true -; foo() -; if ((t0 & 2) != 0) // Likely true -; foo() -; -> -; t0 = *i -; if ((t0 & 3) != 0) { // Likely true -; foo() -; foo() -; } else if ((t0 & 255) != 0) -; if ((t0 & 1) != 0) -; foo() -; if ((t0 & 2) != 0) -; foo() -; } -define void @test_chr_2(i32* %i) !prof !14 { -; CHECK-LABEL: @test_chr_2( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 3 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 3 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB1:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb1: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB4:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[TMP0]], 255 -; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 0 -; CHECK-NEXT: br i1 [[TMP4]], label [[BB4]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0 -; CHECK-NEXT: br i1 [[TMP6]], label [[BB2_NONCHR:%.*]], label [[BB1_NONCHR:%.*]], !prof !16 -; CHECK: bb2.nonchr: -; CHECK-NEXT: [[TMP7:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 0 -; CHECK-NEXT: br i1 [[TMP8]], label [[BB4]], label [[BB3_NONCHR:%.*]], !prof !16 -; CHECK: bb3.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB4]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB2_NONCHR]] -; CHECK: bb4: -; CHECK-NEXT: ret void -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 255 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb4, label %bb0, !prof !15 - -bb0: - %3 = and i32 %0, 1 - %4 = icmp eq i32 %3, 0 - br i1 %4, label %bb2, label %bb1, !prof !15 - -bb1: - call void @foo() - br label %bb2 - -bb2: - %5 = and i32 %0, 2 - %6 = icmp eq i32 %5, 0 - br i1 %6, label %bb4, label %bb3, !prof !15 - -bb3: - call void @foo() - br label %bb4 - -bb4: - ret void -} - -; Split case. -; Roughly, -; t1 = *i -; if ((t1 & 1) != 0) // Likely true -; foo() -; if ((t1 & 2) != 0) // Likely true -; foo() -; t2 = *i -; if ((t2 & 4) != 0) // Likely true -; foo() -; if ((t2 & 8) != 0) // Likely true -; foo() -; -> -; t1 = *i -; if ((t1 & 3) != 0) { // Likely true -; foo() -; foo() -; } else { -; if ((t1 & 1) != 0) -; foo() -; if ((t1 & 2) != 0) -; foo() -; } -; t2 = *i -; if ((t2 & 12) != 0) { // Likely true -; foo() -; foo() -; } else { -; if ((t2 & 4) != 0) -; foo() -; if ((t2 & 8) != 0) -; foo() -; } -define void @test_chr_3(i32* %i) !prof !14 { -; CHECK-LABEL: @test_chr_3( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 3 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 3 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 0 -; CHECK-NEXT: br i1 [[TMP4]], label [[BB1_NONCHR:%.*]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1_NONCHR]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0 -; CHECK-NEXT: br i1 [[TMP6]], label [[BB3]], label [[BB2_NONCHR:%.*]], !prof !16 -; CHECK: bb2.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[TMP7:%.*]] = load i32, i32* [[I]], align 4 -; CHECK-NEXT: [[TMP8:%.*]] = and i32 [[TMP7]], 12 -; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 12 -; CHECK-NEXT: br i1 [[TMP9]], label [[BB4:%.*]], label [[BB3_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb4: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB7:%.*]] -; CHECK: bb3.split.nonchr: -; CHECK-NEXT: [[TMP10:%.*]] = and i32 [[TMP7]], 4 -; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i32 [[TMP10]], 0 -; CHECK-NEXT: br i1 [[TMP11]], label [[BB5_NONCHR:%.*]], label [[BB4_NONCHR:%.*]], !prof !16 -; CHECK: bb4.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB5_NONCHR]] -; CHECK: bb5.nonchr: -; CHECK-NEXT: [[TMP12:%.*]] = and i32 [[TMP7]], 8 -; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i32 [[TMP12]], 0 -; CHECK-NEXT: br i1 [[TMP13]], label [[BB7]], label [[BB6_NONCHR:%.*]], !prof !16 -; CHECK: bb6.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB7]] -; CHECK: bb7: -; CHECK-NEXT: ret void -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 1 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb1, label %bb0, !prof !15 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %3 = and i32 %0, 2 - %4 = icmp eq i32 %3, 0 - br i1 %4, label %bb3, label %bb2, !prof !15 - -bb2: - call void @foo() - br label %bb3 - -bb3: - %5 = load i32, i32* %i - %6 = and i32 %5, 4 - %7 = icmp eq i32 %6, 0 - br i1 %7, label %bb5, label %bb4, !prof !15 - -bb4: - call void @foo() - br label %bb5 - -bb5: - %8 = and i32 %5, 8 - %9 = icmp eq i32 %8, 0 - br i1 %9, label %bb7, label %bb6, !prof !15 - -bb6: - call void @foo() - br label %bb7 - -bb7: - ret void -} - -; Selects. -; Roughly, -; t0 = *i -; sum1 = (t0 & 1) ? sum0 : (sum0 + 42) // Likely false -; sum2 = (t0 & 2) ? sum1 : (sum1 + 43) // Likely false -; return sum2 -; -> -; t0 = *i -; if ((t0 & 3) == 3) -; return sum0 + 85 -; else { -; sum1 = (t0 & 1) ? sum0 : (sum0 + 42) -; sum2 = (t0 & 2) ? sum1 : (sum1 + 43) -; return sum2 -; } -define i32 @test_chr_4(i32* %i, i32 %sum0) !prof !14 { -; CHECK-LABEL: @test_chr_4( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 3 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 3 -; CHECK-NEXT: br i1 [[TMP2]], label [[ENTRY_SPLIT:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: entry.split: -; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[SUM0:%.*]], 85 -; CHECK-NEXT: ret i32 [[TMP3]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP4:%.*]] = add i32 [[SUM0]], 42 -; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0 -; CHECK-NEXT: [[SUM1_NONCHR:%.*]] = select i1 [[TMP6]], i32 [[SUM0]], i32 [[TMP4]], !prof !16 -; CHECK-NEXT: [[TMP7:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 0 -; CHECK-NEXT: [[TMP9:%.*]] = add i32 [[SUM1_NONCHR]], 43 -; CHECK-NEXT: [[SUM2_NONCHR:%.*]] = select i1 [[TMP8]], i32 [[SUM1_NONCHR]], i32 [[TMP9]], !prof !16 -; CHECK-NEXT: ret i32 [[SUM2_NONCHR]] -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 1 - %2 = icmp eq i32 %1, 0 - %3 = add i32 %sum0, 42 - %sum1 = select i1 %2, i32 %sum0, i32 %3, !prof !15 - %4 = and i32 %0, 2 - %5 = icmp eq i32 %4, 0 - %6 = add i32 %sum1, 43 - %sum2 = select i1 %5, i32 %sum1, i32 %6, !prof !15 - ret i32 %sum2 -} - -; Selects + Brs -; Roughly, -; t0 = *i -; if ((t0 & 255) != 0) { // Likely true -; sum = (t0 & 1) ? sum0 : (sum0 + 42) // Likely false -; sum = (t0 & 2) ? sum : (sum + 43) // Likely false -; if ((t0 & 4) != 0) { // Likely true -; sum3 = sum + 44 -; sum = (t0 & 8) ? sum3 : (sum3 + 44) // Likely false -; } -; } -; return sum -; -> -; t0 = *i -; if ((t0 & 15) != 15) { // Likely true -; sum = sum0 + 173 -; } else if ((t0 & 255) != 0) { -; sum = (t0 & 1) ? sum0 : (sum0 + 42) -; sum = (t0 & 2) ? sum : (sum + 43) -; if ((t0 & 4) != 0) { -; sum3 = sum + 44 -; sum = (t0 & 8) ? sum3 : (sum3 + 44) -; } -; } -; return sum -define i32 @test_chr_5(i32* %i, i32 %sum0) !prof !14 { -; CHECK-LABEL: @test_chr_5( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 15 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 15 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[SUM0:%.*]], 85 -; CHECK-NEXT: [[TMP4:%.*]] = add i32 [[SUM0]], 173 -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP0]], 255 -; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0 -; CHECK-NEXT: br i1 [[TMP6]], label [[BB3]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: [[TMP7:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 0 -; CHECK-NEXT: [[TMP9:%.*]] = add i32 [[SUM0]], 42 -; CHECK-NEXT: [[SUM1_NONCHR:%.*]] = select i1 [[TMP8]], i32 [[SUM0]], i32 [[TMP9]], !prof !16 -; CHECK-NEXT: [[TMP10:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i32 [[TMP10]], 0 -; CHECK-NEXT: [[TMP12:%.*]] = add i32 [[SUM1_NONCHR]], 43 -; CHECK-NEXT: [[SUM2_NONCHR:%.*]] = select i1 [[TMP11]], i32 [[SUM1_NONCHR]], i32 [[TMP12]], !prof !16 -; CHECK-NEXT: [[TMP13:%.*]] = and i32 [[TMP0]], 4 -; CHECK-NEXT: [[TMP14:%.*]] = icmp eq i32 [[TMP13]], 0 -; CHECK-NEXT: br i1 [[TMP14]], label [[BB3]], label [[BB1_NONCHR:%.*]], !prof !16 -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[TMP15:%.*]] = and i32 [[TMP0]], 8 -; CHECK-NEXT: [[TMP16:%.*]] = icmp eq i32 [[TMP15]], 0 -; CHECK-NEXT: [[SUM4_NONCHR_V:%.*]] = select i1 [[TMP16]], i32 44, i32 88, !prof !16 -; CHECK-NEXT: [[SUM4_NONCHR:%.*]] = add i32 [[SUM2_NONCHR]], [[SUM4_NONCHR_V]] -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[SUM6:%.*]] = phi i32 [ [[TMP4]], [[BB0]] ], [ [[SUM0]], [[ENTRY_SPLIT_NONCHR]] ], [ [[SUM2_NONCHR]], [[BB0_NONCHR]] ], [ [[SUM4_NONCHR]], [[BB1_NONCHR]] ] -; CHECK-NEXT: ret i32 [[SUM6]] -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 255 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb3, label %bb0, !prof !15 - -bb0: - %3 = and i32 %0, 1 - %4 = icmp eq i32 %3, 0 - %5 = add i32 %sum0, 42 - %sum1 = select i1 %4, i32 %sum0, i32 %5, !prof !15 - %6 = and i32 %0, 2 - %7 = icmp eq i32 %6, 0 - %8 = add i32 %sum1, 43 - %sum2 = select i1 %7, i32 %sum1, i32 %8, !prof !15 - %9 = and i32 %0, 4 - %10 = icmp eq i32 %9, 0 - br i1 %10, label %bb2, label %bb1, !prof !15 - -bb1: - %sum3 = add i32 %sum2, 44 - %11 = and i32 %0, 8 - %12 = icmp eq i32 %11, 0 - %13 = add i32 %sum3, 44 - %sum4 = select i1 %12, i32 %sum3, i32 %13, !prof !15 - br label %bb2 - -bb2: - %sum5 = phi i32 [ %sum2, %bb0 ], [ %sum4, %bb1 ] - br label %bb3 - -bb3: - %sum6 = phi i32 [ %sum0, %entry ], [ %sum5, %bb2 ] - ret i32 %sum6 -} - -; Selects + Brs with a scope split in the middle -; Roughly, -; t0 = *i -; if ((t0 & 255) != 0) { // Likely true -; sum = (t0 & 1) ? sum0 : (sum0 + 42) // Likely false -; sum = (t0 & 2) ? sum : (sum + 43) // Likely false -; if ((sum0 & 4) != 0) { // Likely true. The condition doesn't use v. -; sum3 = sum + 44 -; sum = (t0 & 8) ? sum3 : (sum3 + 44) // Likely false -; } -; } -; return sum -; -> -; t0 = *i -; if ((sum0 & 4) != 0 & (t0 & 11) != 11) { // Likely true -; sum = sum0 + 173 -; } else if ((t0 & 255) != 0) { -; sum = (t0 & 1) ? sum0 : (sum0 + 42) -; sum = (t0 & 2) ? sum : (sum + 43) -; if ((sum0 & 4) != 0) { -; sum3 = sum + 44 -; sum = (t0 & 8) ? sum3 : (sum3 + 44) -; } -; } -; return sum -define i32 @test_chr_5_1(i32* %i, i32 %sum0) !prof !14 { -; CHECK-LABEL: @test_chr_5_1( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[SUM0:%.*]], 4 -; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0 -; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[TMP0]], 11 -; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 11 -; CHECK-NEXT: [[TMP5:%.*]] = and i1 [[TMP4]], [[TMP2]] -; CHECK-NEXT: br i1 [[TMP5]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: [[TMP6:%.*]] = add i32 [[SUM0]], 85 -; CHECK-NEXT: [[TMP7:%.*]] = add i32 [[SUM0]], 173 -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP8:%.*]] = and i32 [[TMP0]], 255 -; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i32 [[TMP8]], 0 -; CHECK-NEXT: br i1 [[TMP9]], label [[BB3]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: [[TMP10:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i32 [[TMP10]], 0 -; CHECK-NEXT: [[TMP12:%.*]] = add i32 [[SUM0]], 42 -; CHECK-NEXT: [[SUM1_NONCHR:%.*]] = select i1 [[TMP11]], i32 [[SUM0]], i32 [[TMP12]], !prof !16 -; CHECK-NEXT: [[TMP13:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP14:%.*]] = icmp eq i32 [[TMP13]], 0 -; CHECK-NEXT: [[TMP15:%.*]] = add i32 [[SUM1_NONCHR]], 43 -; CHECK-NEXT: [[SUM2_NONCHR:%.*]] = select i1 [[TMP14]], i32 [[SUM1_NONCHR]], i32 [[TMP15]], !prof !16 -; CHECK-NEXT: [[TMP16:%.*]] = and i32 [[SUM0]], 4 -; CHECK-NEXT: [[TMP17:%.*]] = icmp eq i32 [[TMP16]], 0 -; CHECK-NEXT: br i1 [[TMP17]], label [[BB3]], label [[BB1_NONCHR:%.*]], !prof !16 -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[TMP18:%.*]] = and i32 [[TMP0]], 8 -; CHECK-NEXT: [[TMP19:%.*]] = icmp eq i32 [[TMP18]], 0 -; CHECK-NEXT: [[SUM4_NONCHR_V:%.*]] = select i1 [[TMP19]], i32 44, i32 88, !prof !16 -; CHECK-NEXT: [[SUM4_NONCHR:%.*]] = add i32 [[SUM2_NONCHR]], [[SUM4_NONCHR_V]] -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[SUM6:%.*]] = phi i32 [ [[TMP7]], [[BB0]] ], [ [[SUM0]], [[ENTRY_SPLIT_NONCHR]] ], [ [[SUM2_NONCHR]], [[BB0_NONCHR]] ], [ [[SUM4_NONCHR]], [[BB1_NONCHR]] ] -; CHECK-NEXT: ret i32 [[SUM6]] -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 255 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb3, label %bb0, !prof !15 - -bb0: - %3 = and i32 %0, 1 - %4 = icmp eq i32 %3, 0 - %5 = add i32 %sum0, 42 - %sum1 = select i1 %4, i32 %sum0, i32 %5, !prof !15 - %6 = and i32 %0, 2 - %7 = icmp eq i32 %6, 0 - %8 = add i32 %sum1, 43 - %sum2 = select i1 %7, i32 %sum1, i32 %8, !prof !15 - %9 = and i32 %sum0, 4 ; Split - %10 = icmp eq i32 %9, 0 - br i1 %10, label %bb2, label %bb1, !prof !15 - -bb1: - %sum3 = add i32 %sum2, 44 - %11 = and i32 %0, 8 - %12 = icmp eq i32 %11, 0 - %13 = add i32 %sum3, 44 - %sum4 = select i1 %12, i32 %sum3, i32 %13, !prof !15 - br label %bb2 - -bb2: - %sum5 = phi i32 [ %sum2, %bb0 ], [ %sum4, %bb1 ] - br label %bb3 - -bb3: - %sum6 = phi i32 [ %sum0, %entry ], [ %sum5, %bb2 ] - ret i32 %sum6 -} - -; Selects + Brs, non-matching bases -; Roughly, -; i0 = *i -; j0 = *j -; if ((i0 & 255) != 0) { // Likely true -; sum = (i0 & 2) ? sum0 : (sum0 + 43) // Likely false -; if ((j0 & 4) != 0) { // Likely true. The condition uses j0, not i0. -; sum3 = sum + 44 -; sum = (i0 & 8) ? sum3 : (sum3 + 44) // Likely false -; } -; } -; return sum -; -> -; i0 = *i -; j0 = *j -; if ((j0 & 4) != 0 & (i0 & 10) != 10) { // Likely true -; sum = sum0 + 131 -; } else if ((i0 & 255) != 0) { -; sum = (i0 & 2) ? sum0 : (sum0 + 43) -; if ((j0 & 4) != 0) { -; sum3 = sum + 44 -; sum = (i0 & 8) ? sum3 : (sum3 + 44) -; } -; } -; return sum -define i32 @test_chr_6(i32* %i, i32* %j, i32 %sum0) !prof !14 { -; CHECK-LABEL: @test_chr_6( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[I0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[J0:%.*]] = load i32, i32* [[J:%.*]], align 4 -; CHECK-NEXT: [[V9:%.*]] = and i32 [[J0]], 4 -; CHECK-NEXT: [[V10:%.*]] = icmp ne i32 [[V9]], 0 -; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[I0]], 10 -; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 10 -; CHECK-NEXT: [[TMP2:%.*]] = and i1 [[TMP1]], [[V10]] -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: [[V8:%.*]] = add i32 [[SUM0:%.*]], 43 -; CHECK-NEXT: [[V13:%.*]] = add i32 [[SUM0]], 131 -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[V1:%.*]] = and i32 [[I0]], 255 -; CHECK-NEXT: [[V2:%.*]] = icmp eq i32 [[V1]], 0 -; CHECK-NEXT: br i1 [[V2]], label [[BB3]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: [[V3_NONCHR:%.*]] = and i32 [[I0]], 2 -; CHECK-NEXT: [[V4_NONCHR:%.*]] = icmp eq i32 [[V3_NONCHR]], 0 -; CHECK-NEXT: [[V8_NONCHR:%.*]] = add i32 [[SUM0]], 43 -; CHECK-NEXT: [[SUM2_NONCHR:%.*]] = select i1 [[V4_NONCHR]], i32 [[SUM0]], i32 [[V8_NONCHR]], !prof !16 -; CHECK-NEXT: [[V9_NONCHR:%.*]] = and i32 [[J0]], 4 -; CHECK-NEXT: [[V10_NONCHR:%.*]] = icmp eq i32 [[V9_NONCHR]], 0 -; CHECK-NEXT: br i1 [[V10_NONCHR]], label [[BB3]], label [[BB1_NONCHR:%.*]], !prof !16 -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[V11_NONCHR:%.*]] = and i32 [[I0]], 8 -; CHECK-NEXT: [[V12_NONCHR:%.*]] = icmp eq i32 [[V11_NONCHR]], 0 -; CHECK-NEXT: [[SUM4_NONCHR_V:%.*]] = select i1 [[V12_NONCHR]], i32 44, i32 88, !prof !16 -; CHECK-NEXT: [[SUM4_NONCHR:%.*]] = add i32 [[SUM2_NONCHR]], [[SUM4_NONCHR_V]] -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[SUM6:%.*]] = phi i32 [ [[V13]], [[BB0]] ], [ [[SUM0]], [[ENTRY_SPLIT_NONCHR]] ], [ [[SUM2_NONCHR]], [[BB0_NONCHR]] ], [ [[SUM4_NONCHR]], [[BB1_NONCHR]] ] -; CHECK-NEXT: ret i32 [[SUM6]] -; -entry: - %i0 = load i32, i32* %i - %j0 = load i32, i32* %j - %v1 = and i32 %i0, 255 - %v2 = icmp eq i32 %v1, 0 - br i1 %v2, label %bb3, label %bb0, !prof !15 - -bb0: - %v3 = and i32 %i0, 2 - %v4 = icmp eq i32 %v3, 0 - %v8 = add i32 %sum0, 43 - %sum2 = select i1 %v4, i32 %sum0, i32 %v8, !prof !15 - %v9 = and i32 %j0, 4 - %v10 = icmp eq i32 %v9, 0 - br i1 %v10, label %bb2, label %bb1, !prof !15 - -bb1: - %sum3 = add i32 %sum2, 44 - %v11 = and i32 %i0, 8 - %v12 = icmp eq i32 %v11, 0 - %v13 = add i32 %sum3, 44 - %sum4 = select i1 %v12, i32 %sum3, i32 %v13, !prof !15 - br label %bb2 - -bb2: - %sum5 = phi i32 [ %sum2, %bb0 ], [ %sum4, %bb1 ] - br label %bb3 - -bb3: - %sum6 = phi i32 [ %sum0, %entry ], [ %sum5, %bb2 ] - ret i32 %sum6 -} - -; Selects + Brs, the branch condition can't be hoisted to be merged with a -; select. No CHR happens. -; Roughly, -; i0 = *i -; sum = ((i0 & 2) == 0) ? sum0 : (sum0 + 43) // Likely false -; foo(); -; j0 = *j -; if ((j0 & 4) != 0) { // Likely true -; foo(); -; sum = sum + 44 -; } -; return sum -; -> -; (no change) -define i32 @test_chr_7(i32* %i, i32* %j, i32 %sum0) !prof !14 { -; CHECK-LABEL: @test_chr_7( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[I0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[V3:%.*]] = and i32 [[I0]], 2 -; CHECK-NEXT: [[V4:%.*]] = icmp eq i32 [[V3]], 0 -; CHECK-NEXT: [[V8:%.*]] = add i32 [[SUM0:%.*]], 43 -; CHECK-NEXT: [[SUM2:%.*]] = select i1 [[V4]], i32 [[SUM0]], i32 [[V8]], !prof !16 -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[J0:%.*]] = load i32, i32* [[J:%.*]], align 4 -; CHECK-NEXT: [[V9:%.*]] = and i32 [[J0]], 4 -; CHECK-NEXT: [[V10:%.*]] = icmp eq i32 [[V9]], 0 -; CHECK-NEXT: br i1 [[V10]], label [[BB2:%.*]], label [[BB1:%.*]], !prof !16 -; CHECK: bb1: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[SUM4:%.*]] = add i32 [[SUM2]], 44 -; CHECK-NEXT: br label [[BB2]] -; CHECK: bb2: -; CHECK-NEXT: [[SUM5:%.*]] = phi i32 [ [[SUM2]], [[ENTRY:%.*]] ], [ [[SUM4]], [[BB1]] ] -; CHECK-NEXT: ret i32 [[SUM5]] -; -entry: - %i0 = load i32, i32* %i - %v3 = and i32 %i0, 2 - %v4 = icmp eq i32 %v3, 0 - %v8 = add i32 %sum0, 43 - %sum2 = select i1 %v4, i32 %sum0, i32 %v8, !prof !15 - call void @foo() - %j0 = load i32, i32* %j - %v9 = and i32 %j0, 4 - %v10 = icmp eq i32 %v9, 0 - br i1 %v10, label %bb2, label %bb1, !prof !15 ; %v10 can't be hoisted above the above select - -bb1: - call void @foo() - %sum4 = add i32 %sum2, 44 - br label %bb2 - -bb2: - %sum5 = phi i32 [ %sum2, %entry ], [ %sum4, %bb1 ] - ret i32 %sum5 -} - -; Selects + Brs, the branch condition can't be hoisted to be merged with the -; selects. Dropping the select. -; Roughly, -; i0 = *i -; sum = ((i0 & 2) == 0) ? sum0 : (sum0 + 43) // Likely false -; foo(); -; j0 = *j -; if ((j0 & 4) != 0) // Likely true -; foo() -; if ((j0 & 8) != 0) // Likely true -; foo() -; return sum -; -> -; i0 = *i -; sum = ((i0 & 2) == 0) ? sum0 : (sum0 + 43) // Likely false -; foo(); -; j0 = *j -; if ((j0 & 12) != 12) { // Likely true -; foo() -; foo() -; } else { -; if ((j0 & 4) != 0) -; foo() -; if ((j0 & 8) != 0) -; foo() -; } -; return sum -define i32 @test_chr_7_1(i32* %i, i32* %j, i32 %sum0) !prof !14 { -; CHECK-LABEL: @test_chr_7_1( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[I0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[V3:%.*]] = and i32 [[I0]], 2 -; CHECK-NEXT: [[V4:%.*]] = icmp eq i32 [[V3]], 0 -; CHECK-NEXT: [[V8:%.*]] = add i32 [[SUM0:%.*]], 43 -; CHECK-NEXT: [[SUM2:%.*]] = select i1 [[V4]], i32 [[SUM0]], i32 [[V8]], !prof !16 -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[J0:%.*]] = load i32, i32* [[J:%.*]], align 4 -; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[J0]], 12 -; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 12 -; CHECK-NEXT: br i1 [[TMP1]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[V9:%.*]] = and i32 [[J0]], 4 -; CHECK-NEXT: [[V10:%.*]] = icmp eq i32 [[V9]], 0 -; CHECK-NEXT: br i1 [[V10]], label [[BB1_NONCHR:%.*]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1_NONCHR]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[V11_NONCHR:%.*]] = and i32 [[J0]], 8 -; CHECK-NEXT: [[V12_NONCHR:%.*]] = icmp eq i32 [[V11_NONCHR]], 0 -; CHECK-NEXT: br i1 [[V12_NONCHR]], label [[BB3]], label [[BB2_NONCHR:%.*]], !prof !16 -; CHECK: bb2.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: ret i32 [[SUM2]] -; -entry: - %i0 = load i32, i32* %i - %v3 = and i32 %i0, 2 - %v4 = icmp eq i32 %v3, 0 - %v8 = add i32 %sum0, 43 - %sum2 = select i1 %v4, i32 %sum0, i32 %v8, !prof !15 - call void @foo() - %j0 = load i32, i32* %j - %v9 = and i32 %j0, 4 - %v10 = icmp eq i32 %v9, 0 - br i1 %v10, label %bb1, label %bb0, !prof !15 ; %v10 can't be hoisted above the above select - -bb0: - call void @foo() - br label %bb1 - -bb1: - %v11 = and i32 %j0, 8 - %v12 = icmp eq i32 %v11, 0 - br i1 %v12, label %bb3, label %bb2, !prof !15 - -bb2: - call void @foo() - br label %bb3 - -bb3: - ret i32 %sum2 -} - -; Branches aren't biased enough. No CHR happens. -; Roughly, -; t0 = *i -; if ((t0 & 1) != 0) // Not biased -; foo() -; if ((t0 & 2) != 0) // Not biased -; foo() -; -> -; (no change) -define void @test_chr_8(i32* %i) !prof !14 { -; CHECK-LABEL: @test_chr_8( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB1:%.*]], label [[BB0:%.*]], !prof !17 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1]] -; CHECK: bb1: -; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 0 -; CHECK-NEXT: br i1 [[TMP4]], label [[BB3:%.*]], label [[BB2:%.*]], !prof !17 -; CHECK: bb2: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: ret void -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 1 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb1, label %bb0, !prof !16 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %3 = and i32 %0, 2 - %4 = icmp eq i32 %3, 0 - br i1 %4, label %bb3, label %bb2, !prof !16 - -bb2: - call void @foo() - br label %bb3 - -bb3: - ret void -} - -; With an existing phi at the exit. -; Roughly, -; t = *i -; if ((t0 & 1) != 0) // Likely true -; foo() -; if ((t0 & 2) != 0) { // Likely true -; t = *j -; foo() -; } -; // There's a phi for t here. -; return t -; -> -; t = *i -; if ((t & 3) == 3) { // Likely true -; foo() -; t = *j -; foo() -; } else { -; if ((t & 1) != 0) -; foo() -; if ((t & 2) != 0) { -; t = *j -; foo() -; } -; } -; // There's a phi for t here. -; return t -define i32 @test_chr_9(i32* %i, i32* %j) !prof !14 { -; CHECK-LABEL: @test_chr_9( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 3 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 3 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[J:%.*]], align 4 -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP4:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[TMP4]], 0 -; CHECK-NEXT: br i1 [[TMP5]], label [[BB1_NONCHR:%.*]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1_NONCHR]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[TMP6:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i32 [[TMP6]], 0 -; CHECK-NEXT: br i1 [[TMP7]], label [[BB3]], label [[BB2_NONCHR:%.*]], !prof !16 -; CHECK: bb2.nonchr: -; CHECK-NEXT: [[TMP8:%.*]] = load i32, i32* [[J]], align 4 -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[TMP9:%.*]] = phi i32 [ [[TMP3]], [[BB0]] ], [ [[TMP0]], [[BB1_NONCHR]] ], [ [[TMP8]], [[BB2_NONCHR]] ] -; CHECK-NEXT: ret i32 [[TMP9]] -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 1 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb1, label %bb0, !prof !15 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %3 = and i32 %0, 2 - %4 = icmp eq i32 %3, 0 - br i1 %4, label %bb3, label %bb2, !prof !15 - -bb2: - %5 = load i32, i32* %j - call void @foo() - br label %bb3 - -bb3: - %6 = phi i32 [ %0, %bb1 ], [ %5, %bb2 ] - ret i32 %6 -} - -; With no phi at the exit, but the exit needs a phi inserted after CHR. -; Roughly, -; t0 = *i -; if ((t0 & 1) != 0) // Likely true -; foo() -; t1 = *j -; if ((t1 & 2) != 0) // Likely true -; foo() -; return (t1 * 42) - (t1 - 99) -; -> -; t0 = *i -; if ((t0 & 3) == 3) { // Likely true -; foo() -; t1 = *j -; foo() -; } else { -; if ((t0 & 1) != 0) -; foo() -; if ((t0 & 2) != 0) { -; t1 = *j -; foo() -; } -; } -; // A new phi for t1 is inserted here. -; return (t1 * 42) - (t1 - 99) -define i32 @test_chr_10(i32* %i, i32* %j) !prof !14 { -; CHECK-LABEL: @test_chr_10( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 3 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 3 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[TMP3:%.*]] = load i32, i32* [[J:%.*]], align 4 -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP4:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[TMP4]], 0 -; CHECK-NEXT: br i1 [[TMP5]], label [[BB1_NONCHR:%.*]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1_NONCHR]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[TMP6:%.*]] = load i32, i32* [[J]], align 4 -; CHECK-NEXT: [[TMP7:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 0 -; CHECK-NEXT: br i1 [[TMP8]], label [[BB3]], label [[BB2_NONCHR:%.*]], !prof !16 -; CHECK: bb2.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[TMP9:%.*]] = phi i32 [ [[TMP3]], [[BB0]] ], [ [[TMP6]], [[BB2_NONCHR]] ], [ [[TMP6]], [[BB1_NONCHR]] ] -; CHECK-NEXT: [[TMP10:%.*]] = mul i32 [[TMP9]], 42 -; CHECK-NEXT: [[TMP11:%.*]] = add i32 [[TMP9]], -99 -; CHECK-NEXT: [[TMP12:%.*]] = add i32 [[TMP10]], [[TMP11]] -; CHECK-NEXT: ret i32 [[TMP12]] -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 1 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb1, label %bb0, !prof !15 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %3 = load i32, i32* %j - %4 = and i32 %0, 2 - %5 = icmp eq i32 %4, 0 - br i1 %5, label %bb3, label %bb2, !prof !15 - -bb2: - call void @foo() - br label %bb3 - -bb3: - %6 = mul i32 %3, 42 - %7 = sub i32 %3, 99 - %8 = add i32 %6, %7 - ret i32 %8 -} - -; Test a case where there are two use-def chain paths to the same value (t0) -; from the branch condition. This is a regression test for an old bug that -; caused a bad hoisting that moves (hoists) a value (%conv) twice to the end of -; the %entry block (once for %div and once for %mul16) and put a use ahead of -; its definition like: -; %entry: -; ... -; %div = fdiv double 1.000000e+00, %conv -; %conv = sitofp i32 %0 to double -; %mul16 = fmul double %div, %conv -; -; Roughly, -; t0 = *i -; if ((t0 & 1) != 0) // Likely true -; foo() -; // there are two use-def paths from the branch condition to t0. -; if ((1.0 / t0) * t0 < 1) // Likely true -; foo() -; -> -; t0 = *i -; if ((t0 & 1) != 0 & (1.0 / t0) * t0 > 0) { // Likely true -; foo() -; foo() -; } else { -; if ((t0 & 1) != 0) -; foo() -; if ((1.0 / t0) * t0 < 1) // Likely true -; foo() -; } -define void @test_chr_11(i32* %i, i32 %x) !prof !14 { -; CHECK-LABEL: @test_chr_11( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i32 [[TMP1]], 0 -; CHECK-NEXT: [[CONV:%.*]] = sitofp i32 [[TMP0]] to double -; CHECK-NEXT: [[DIV:%.*]] = fdiv double 1.000000e+00, [[CONV]] -; CHECK-NEXT: [[MUL16:%.*]] = fmul double [[DIV]], [[CONV]] -; CHECK-NEXT: [[CONV717:%.*]] = fptosi double [[MUL16]] to i32 -; CHECK-NEXT: [[CMP18:%.*]] = icmp sgt i32 [[CONV717]], 0 -; CHECK-NEXT: [[TMP3:%.*]] = and i1 [[TMP2]], [[CMP18]] -; CHECK-NEXT: br i1 [[TMP3]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0_NONCHR:%.*]], label [[BB1_NONCHR:%.*]], !prof !18 -; CHECK: bb0.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1_NONCHR]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[CONV_NONCHR:%.*]] = sitofp i32 [[TMP0]] to double -; CHECK-NEXT: [[DIV_NONCHR:%.*]] = fdiv double 1.000000e+00, [[CONV_NONCHR]] -; CHECK-NEXT: [[MUL16_NONCHR:%.*]] = fmul double [[DIV_NONCHR]], [[CONV_NONCHR]] -; CHECK-NEXT: [[CONV717_NONCHR:%.*]] = fptosi double [[MUL16_NONCHR]] to i32 -; CHECK-NEXT: [[CMP18_NONCHR:%.*]] = icmp slt i32 [[CONV717_NONCHR]], 1 -; CHECK-NEXT: br i1 [[CMP18_NONCHR]], label [[BB3]], label [[BB2_NONCHR:%.*]], !prof !16 -; CHECK: bb2.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: ret void -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 1 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb1, label %bb0, !prof !15 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %conv = sitofp i32 %0 to double - %div = fdiv double 1.000000e+00, %conv - %mul16 = fmul double %div, %conv - %conv717 = fptosi double %mul16 to i32 - %cmp18 = icmp slt i32 %conv717, 1 - br i1 %cmp18, label %bb3, label %bb2, !prof !15 - -bb2: - call void @foo() - br label %bb3 - -bb3: - ret void -} - -; Selects + unrelated br only -define i32 @test_chr_12(i32* %i, i32 %sum0) !prof !14 { -; CHECK-LABEL: @test_chr_12( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 255 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB3:%.*]], label [[BB0:%.*]], !prof !16 -; CHECK: bb0: -; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 0 -; CHECK-NEXT: [[TMP5:%.*]] = add i32 [[SUM0:%.*]], 42 -; CHECK-NEXT: [[SUM1:%.*]] = select i1 [[TMP4]], i32 [[SUM0]], i32 [[TMP5]], !prof !16 -; CHECK-NEXT: [[TMP6:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i32 [[TMP6]], 0 -; CHECK-NEXT: [[TMP8:%.*]] = add i32 [[SUM1]], 43 -; CHECK-NEXT: [[SUM2:%.*]] = select i1 [[TMP7]], i32 [[SUM1]], i32 [[TMP8]], !prof !16 -; CHECK-NEXT: [[TMP9:%.*]] = load i32, i32* [[I]], align 4 -; CHECK-NEXT: [[TMP10:%.*]] = icmp ne i32 [[TMP9]], 0 -; CHECK-NEXT: [[TMP11:%.*]] = and i32 [[TMP0]], 8 -; CHECK-NEXT: [[TMP12:%.*]] = icmp ne i32 [[TMP11]], 0 -; CHECK-NEXT: [[TMP13:%.*]] = and i1 [[TMP10]], [[TMP12]] -; CHECK-NEXT: br i1 [[TMP13]], label [[BB1:%.*]], label [[BB0_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb1: -; CHECK-NEXT: [[TMP14:%.*]] = add i32 [[SUM2]], 88 -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb0.split.nonchr: -; CHECK-NEXT: br i1 [[TMP10]], label [[BB1_NONCHR:%.*]], label [[BB3]], !prof !18 -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[TMP15:%.*]] = and i32 [[TMP0]], 8 -; CHECK-NEXT: [[TMP16:%.*]] = icmp eq i32 [[TMP15]], 0 -; CHECK-NEXT: [[SUM4_NONCHR_V:%.*]] = select i1 [[TMP16]], i32 44, i32 88, !prof !16 -; CHECK-NEXT: [[SUM4_NONCHR:%.*]] = add i32 [[SUM2]], [[SUM4_NONCHR_V]] -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[SUM6:%.*]] = phi i32 [ [[SUM0]], [[ENTRY:%.*]] ], [ [[TMP14]], [[BB1]] ], [ [[SUM2]], [[BB0_SPLIT_NONCHR]] ], [ [[SUM4_NONCHR]], [[BB1_NONCHR]] ] -; CHECK-NEXT: ret i32 [[SUM6]] -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 255 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb3, label %bb0, !prof !15 - -bb0: - %3 = and i32 %0, 1 - %4 = icmp eq i32 %3, 0 - %5 = add i32 %sum0, 42 - %sum1 = select i1 %4, i32 %sum0, i32 %5, !prof !15 - %6 = and i32 %0, 2 - %7 = icmp eq i32 %6, 0 - %8 = add i32 %sum1, 43 - %sum2 = select i1 %7, i32 %sum1, i32 %8, !prof !15 - %9 = load i32, i32* %i - %10 = icmp eq i32 %9, 0 - br i1 %10, label %bb2, label %bb1, !prof !15 - -bb1: - %sum3 = add i32 %sum2, 44 - %11 = and i32 %0, 8 - %12 = icmp eq i32 %11, 0 - %13 = add i32 %sum3, 44 - %sum4 = select i1 %12, i32 %sum3, i32 %13, !prof !15 - br label %bb2 - -bb2: - %sum5 = phi i32 [ %sum2, %bb0 ], [ %sum4, %bb1 ] - br label %bb3 - -bb3: - %sum6 = phi i32 [ %sum0, %entry ], [ %sum5, %bb2 ] - ret i32 %sum6 -} - -; In the second CHR, a condition value depends on a trivial phi that's inserted -; by the first CHR. -; Roughly, -; i0 = *i -; v2 = (z != 1) ? pred : true // Likely false -; if (z == 0 & pred) // Likely false -; foo() -; j0 = *j -; sum2 = ((i0 & 2) == j0) ? sum0 : (sum0 + 43) // Likely false -; sum3 = ((i0 == j0) ? sum0 : (sum0 + 43) // Likely false -; foo() -; if ((i0 & 4) == 0) // Unbiased -; foo() -; return i0 + sum3 -; -> -; i0 = *i -; if (z != 1 & (z == 0 & pred)) // First CHR -; foo() -; // A trivial phi for i0 is inserted here by the first CHR (which gets removed -; // later) and the subsequent branch condition (for the second CHR) uses it. -; j0 = *j -; if ((i0 & 2) != j0 & i0 != j0) { // Second CHR -; sum3 = sum0 + 43 -; foo() -; if (i0 & 4) == 0) -; foo() -; } else { -; sum3 = (i0 == j0) ? sum0 : (sum0 + 43) -; foo() -; if (i0 & 4) == 0) -; foo() -; } -; return i0 + sum3 -define i32 @test_chr_14(i32* %i, i32* %j, i32 %sum0, i1 %pred, i32 %z) !prof !14 { -; CHECK-LABEL: @test_chr_14( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[I0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[V1:%.*]] = icmp ne i32 [[Z:%.*]], 1 -; CHECK-NEXT: [[V0:%.*]] = icmp eq i32 [[Z]], 0 -; CHECK-NEXT: [[V3_NONCHR:%.*]] = and i1 [[V0]], [[PRED:%.*]] -; CHECK-NEXT: [[OR_COND:%.*]] = and i1 [[V1]], [[V3_NONCHR]] -; CHECK-NEXT: br i1 [[OR_COND]], label [[BB0_NONCHR:%.*]], label [[BB1:%.*]], !prof !19 -; CHECK: bb0.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1]] -; CHECK: bb1: -; CHECK-NEXT: [[J0:%.*]] = load i32, i32* [[J:%.*]], align 4 -; CHECK-NEXT: [[V6:%.*]] = and i32 [[I0]], 2 -; CHECK-NEXT: [[V4:%.*]] = icmp ne i32 [[V6]], [[J0]] -; CHECK-NEXT: [[V8:%.*]] = add i32 [[SUM0:%.*]], 43 -; CHECK-NEXT: [[V5:%.*]] = icmp ne i32 [[I0]], [[J0]] -; CHECK-NEXT: [[TMP0:%.*]] = and i1 [[V4]], [[V5]] -; CHECK-NEXT: br i1 [[TMP0]], label [[BB1_SPLIT:%.*]], label [[BB1_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb1.split: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[V9:%.*]] = and i32 [[I0]], 4 -; CHECK-NEXT: [[V10:%.*]] = icmp eq i32 [[V9]], 0 -; CHECK-NEXT: br i1 [[V10]], label [[BB3:%.*]], label [[BB2:%.*]] -; CHECK: bb2: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb1.split.nonchr: -; CHECK-NEXT: [[V5_NONCHR:%.*]] = icmp eq i32 [[I0]], [[J0]] -; CHECK-NEXT: [[SUM3_NONCHR:%.*]] = select i1 [[V5_NONCHR]], i32 [[SUM0]], i32 [[V8]], !prof !16 -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[V9_NONCHR:%.*]] = and i32 [[I0]], 4 -; CHECK-NEXT: [[V10_NONCHR:%.*]] = icmp eq i32 [[V9_NONCHR]], 0 -; CHECK-NEXT: br i1 [[V10_NONCHR]], label [[BB3]], label [[BB2_NONCHR:%.*]] -; CHECK: bb2.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[TMP1:%.*]] = phi i32 [ [[V8]], [[BB2]] ], [ [[V8]], [[BB1_SPLIT]] ], [ [[SUM3_NONCHR]], [[BB2_NONCHR]] ], [ [[SUM3_NONCHR]], [[BB1_SPLIT_NONCHR]] ] -; CHECK-NEXT: [[V11:%.*]] = add i32 [[I0]], [[TMP1]] -; CHECK-NEXT: ret i32 [[V11]] -; -entry: - %i0 = load i32, i32* %i - %v0 = icmp eq i32 %z, 0 - %v1 = icmp ne i32 %z, 1 - %v2 = select i1 %v1, i1 %pred, i1 true, !prof !15 - %v3 = and i1 %v0, %pred - br i1 %v3, label %bb0, label %bb1, !prof !15 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %j0 = load i32, i32* %j - %v6 = and i32 %i0, 2 - %v4 = icmp eq i32 %v6, %j0 - %v8 = add i32 %sum0, 43 - %sum2 = select i1 %v4, i32 %sum0, i32 %v8, !prof !15 - %v5 = icmp eq i32 %i0, %j0 - %sum3 = select i1 %v5, i32 %sum0, i32 %v8, !prof !15 - call void @foo() - %v9 = and i32 %i0, 4 - %v10 = icmp eq i32 %v9, 0 - br i1 %v10, label %bb3, label %bb2 - -bb2: - call void @foo() - br label %bb3 - -bb3: - %v11 = add i32 %i0, %sum3 - ret i32 %v11 -} - -; Branch or selects depends on another select. No CHR happens. -; Roughly, -; i0 = *i -; if (z == 0 & ((z != 1) ? pred : true)) { // Likely false -; foo() -; j0 = *j -; sum2 = ((i0 & 2) == j0) ? sum0 : (sum0 + 43) // Likely false -; sum3 = (i0 == sum2) ? sum2 : (sum0 + 43) // Likely false. This depends on the -; // previous select. -; foo() -; if ((i0 & 4) == 0) // Unbiased -; foo() -; return i0 + sum3 -; -> -; (no change) -define i32 @test_chr_15(i32* %i, i32* %j, i32 %sum0, i1 %pred, i32 %z) !prof !14 { -; CHECK-LABEL: @test_chr_15( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[I0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[V0:%.*]] = icmp eq i32 [[Z:%.*]], 0 -; CHECK-NEXT: [[V3:%.*]] = and i1 [[V0]], [[PRED:%.*]] -; CHECK-NEXT: br i1 [[V3]], label [[BB0:%.*]], label [[BB1:%.*]], !prof !16 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1]] -; CHECK: bb1: -; CHECK-NEXT: [[J0:%.*]] = load i32, i32* [[J:%.*]], align 4 -; CHECK-NEXT: [[V6:%.*]] = and i32 [[I0]], 2 -; CHECK-NEXT: [[V4:%.*]] = icmp eq i32 [[V6]], [[J0]] -; CHECK-NEXT: [[V8:%.*]] = add i32 [[SUM0:%.*]], 43 -; CHECK-NEXT: [[SUM2:%.*]] = select i1 [[V4]], i32 [[SUM0]], i32 [[V8]], !prof !16 -; CHECK-NEXT: [[V5:%.*]] = icmp eq i32 [[I0]], [[SUM2]] -; CHECK-NEXT: [[SUM3:%.*]] = select i1 [[V5]], i32 [[SUM2]], i32 [[V8]], !prof !16 -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[V9:%.*]] = and i32 [[I0]], 4 -; CHECK-NEXT: [[V10:%.*]] = icmp eq i32 [[V9]], 0 -; CHECK-NEXT: br i1 [[V10]], label [[BB3:%.*]], label [[BB2:%.*]] -; CHECK: bb2: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[V11:%.*]] = add i32 [[I0]], [[SUM3]] -; CHECK-NEXT: ret i32 [[V11]] -; -entry: - %i0 = load i32, i32* %i - %v0 = icmp eq i32 %z, 0 - %v1 = icmp ne i32 %z, 1 - %v2 = select i1 %v1, i1 %pred, i1 true, !prof !15 - %v3 = and i1 %v0, %v2 - br i1 %v3, label %bb0, label %bb1, !prof !15 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %j0 = load i32, i32* %j - %v6 = and i32 %i0, 2 - %v4 = icmp eq i32 %v6, %j0 - %v8 = add i32 %sum0, 43 - %sum2 = select i1 %v4, i32 %sum0, i32 %v8, !prof !15 - %v5 = icmp eq i32 %i0, %sum2 - %sum3 = select i1 %v5, i32 %sum2, i32 %v8, !prof !15 - call void @foo() - %v9 = and i32 %i0, 4 - %v10 = icmp eq i32 %v9, 0 - br i1 %v10, label %bb3, label %bb2 - -bb2: - call void @foo() - br label %bb3 - -bb3: - %v11 = add i32 %i0, %sum3 - ret i32 %v11 -} - -; With an existing phi at the exit but a value (%v40) is both alive and is an -; operand to a phi at the exit block. -; Roughly, -; t0 = *i -; if ((t0 & 1) != 0) // Likely true -; foo() -; v40 = t0 + 44 -; if ((t0 & 2) != 0) // Likely true -; v41 = t0 + 99 -; foo() -; } -; v42 = phi v40, v41 -; return v42 + v40 -; -> -; t0 = *i -; if ((t0 & 3) == 3) // Likely true -; foo() -; v40 = t0 + 44 -; v41 = t0 + 99 -; foo() -; } else { -; if ((t0 & 1) != 0) // Likely true -; foo() -; v40_nc = t0 + 44 -; if ((t0 & 2) != 0) // Likely true -; v41_nc = t0 + 99 -; foo() -; } -; } -; t7 = phi v40, v40_nc -; v42 = phi v41, v41_nc -; v43 = v42 + t7 -; return v43 -define i32 @test_chr_16(i32* %i) !prof !14 { -; CHECK-LABEL: @test_chr_16( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 3 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 3 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[V40:%.*]] = add i32 [[TMP0]], 44 -; CHECK-NEXT: [[V41:%.*]] = add i32 [[TMP0]], 99 -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP3:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i32 [[TMP3]], 0 -; CHECK-NEXT: br i1 [[TMP4]], label [[BB1_NONCHR:%.*]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB1_NONCHR]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[V40_NONCHR:%.*]] = add i32 [[TMP0]], 44 -; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP0]], 2 -; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0 -; CHECK-NEXT: br i1 [[TMP6]], label [[BB3]], label [[BB2_NONCHR:%.*]], !prof !16 -; CHECK: bb2.nonchr: -; CHECK-NEXT: [[V41_NONCHR:%.*]] = add i32 [[TMP0]], 99 -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[TMP7:%.*]] = phi i32 [ [[V40]], [[BB0]] ], [ [[V40_NONCHR]], [[BB2_NONCHR]] ], [ [[V40_NONCHR]], [[BB1_NONCHR]] ] -; CHECK-NEXT: [[V42:%.*]] = phi i32 [ [[V41]], [[BB0]] ], [ [[V41_NONCHR]], [[BB2_NONCHR]] ], [ [[V40_NONCHR]], [[BB1_NONCHR]] ] -; CHECK-NEXT: [[V43:%.*]] = add i32 [[V42]], [[TMP7]] -; CHECK-NEXT: ret i32 [[V43]] -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 1 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb1, label %bb0, !prof !15 - -bb0: - call void @foo() - br label %bb1 - -bb1: - %v40 = add i32 %0, 44 - %3 = and i32 %0, 2 - %4 = icmp eq i32 %3, 0 - br i1 %4, label %bb3, label %bb2, !prof !15 - -bb2: - %v41 = add i32 %0, 99 - call void @foo() - br label %bb3 - -bb3: - %v42 = phi i32 [ %v41, %bb2 ], [ %v40, %bb1 ] - %v43 = add i32 %v42, %v40 - ret i32 %v43 -} - -; Two consecutive regions have an entry in the middle of them. No CHR happens. -; Roughly, -; if ((i & 4) == 0) { -; if (!j) -; goto bb1 -; } else { -; t0 = (i & 1) -; if (t0 != 0) // Likely true -; foo() -; s = (i & 1) + i -; } -; bb1: -; p = phi i, t0, s -; if ((i & 2) != 0) // Likely true -; foo() -; q = p + 2 -; } -; r = phi p, q, i -; return r -; -> -; (no change) -define i32 @test_chr_17(i32 %i, i1 %j) !prof !14 { -; CHECK-LABEL: @test_chr_17( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[V0:%.*]] = and i32 [[I:%.*]], 4 -; CHECK-NEXT: [[V1:%.*]] = icmp eq i32 [[V0]], 0 -; CHECK-NEXT: br i1 [[V1]], label [[BBE:%.*]], label [[BBQ:%.*]] -; CHECK: bbq: -; CHECK-NEXT: br i1 [[J:%.*]], label [[BB3:%.*]], label [[BB1:%.*]] -; CHECK: bbe: -; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[I]], 1 -; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 0 -; CHECK-NEXT: br i1 [[TMP1]], label [[BB1]], label [[BB0:%.*]], !prof !16 -; CHECK: bb0: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[S:%.*]] = add i32 [[TMP0]], [[I]] -; CHECK-NEXT: br label [[BB1]] -; CHECK: bb1: -; CHECK-NEXT: [[P:%.*]] = phi i32 [ [[I]], [[BBQ]] ], [ [[TMP0]], [[BBE]] ], [ [[S]], [[BB0]] ] -; CHECK-NEXT: [[TMP2:%.*]] = and i32 [[I]], 2 -; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP2]], 0 -; CHECK-NEXT: br i1 [[TMP3]], label [[BB3]], label [[BB2:%.*]], !prof !16 -; CHECK: bb2: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: [[Q:%.*]] = add i32 [[P]], [[TMP2]] -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[R:%.*]] = phi i32 [ [[P]], [[BB1]] ], [ [[Q]], [[BB2]] ], [ [[I]], [[BBQ]] ] -; CHECK-NEXT: ret i32 [[R]] -; -entry: - %v0 = and i32 %i, 4 - %v1 = icmp eq i32 %v0, 0 - br i1 %v1, label %bbe, label %bbq - -bbq: - br i1 %j, label %bb3, label %bb1 - -bbe: - %0 = and i32 %i, 1 - %1 = icmp eq i32 %0, 0 - br i1 %1, label %bb1, label %bb0, !prof !15 - -bb0: - call void @foo() - %s = add i32 %0, %i - br label %bb1 - -bb1: - %p = phi i32 [ %i, %bbq ], [ %0, %bbe ], [ %s, %bb0 ] - %2 = and i32 %i, 2 - %3 = icmp eq i32 %2, 0 - br i1 %3, label %bb3, label %bb2, !prof !15 - -bb2: - call void @foo() - %q = add i32 %p, %2 - br label %bb3 - -bb3: - %r = phi i32 [ %p, %bb1 ], [ %q, %bb2 ], [ %i, %bbq ] - ret i32 %r -} - -; Select + br, there's a loop and we need to update the user of an inserted phi -; at the entry block. This is a regression test for a bug that's fixed. -; Roughly, -; do { -; inc1 = phi inc2, 0 -; li = *i -; sum1 = sum0 + 42 -; sum2 = ((li & 1) == 0) ? sum0 : sum1 // Likely false -; inc2 = inc1 + 1 -; if ((li & 4) != 0) // Likely true -; sum3 = sum2 + 44 -; sum4 = phi sum1, sum3 -; } while (inc2 != 100) // Likely true (loop back) -; return sum4 -; -> -; do { -; inc1 = phi tmp2, 0 // The first operand needed to be updated -; li = *i -; sum1 = sum0 + 42 -; if ((li & 5) == 5) { // Likely true -; inc2 = inc1 + 1 -; sum3 = sum0 + 86 -; } else { -; inc2_nc = inc1 + 1 -; if ((li & 4) == 0) -; sum2_nc = ((li & 1) == 0) ? sum0 : sum1 -; sum3_nc = sum2_nc + 44 -; } -; tmp2 = phi inc2, in2c_nc -; sum4 = phi sum3, sum3_nc, sum1 -; } while (tmp2 != 100) -; return sum4 -define i32 @test_chr_18(i32* %i, i32 %sum0) !prof !14 { -; CHECK-LABEL: @test_chr_18( -; CHECK-NEXT: entry: -; CHECK-NEXT: br label [[BB0:%.*]] -; CHECK: bb0: -; CHECK-NEXT: [[INC1:%.*]] = phi i32 [ [[TMP2:%.*]], [[BB2:%.*]] ], [ 0, [[ENTRY:%.*]] ] -; CHECK-NEXT: [[LI:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[SUM1:%.*]] = add i32 [[SUM0:%.*]], 42 -; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[LI]], 5 -; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 5 -; CHECK-NEXT: br i1 [[TMP1]], label [[BB0_SPLIT:%.*]], label [[BB0_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0.split: -; CHECK-NEXT: [[INC2:%.*]] = add i32 [[INC1]], 1 -; CHECK-NEXT: [[SUM3:%.*]] = add i32 [[SUM0]], 86 -; CHECK-NEXT: br label [[BB2]] -; CHECK: bb0.split.nonchr: -; CHECK-NEXT: [[A4_NONCHR:%.*]] = and i32 [[LI]], 4 -; CHECK-NEXT: [[CMP4_NONCHR:%.*]] = icmp eq i32 [[A4_NONCHR]], 0 -; CHECK-NEXT: [[INC2_NONCHR:%.*]] = add i32 [[INC1]], 1 -; CHECK-NEXT: br i1 [[CMP4_NONCHR]], label [[BB2]], label [[BB1_NONCHR:%.*]], !prof !16 -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[A1:%.*]] = and i32 [[LI]], 1 -; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[A1]], 0 -; CHECK-NEXT: [[SUM2_NONCHR:%.*]] = select i1 [[CMP1]], i32 [[SUM0]], i32 [[SUM1]], !prof !16 -; CHECK-NEXT: [[SUM3_NONCHR:%.*]] = add i32 [[SUM2_NONCHR]], 44 -; CHECK-NEXT: br label [[BB2]] -; CHECK: bb2: -; CHECK-NEXT: [[TMP2]] = phi i32 [ [[INC2]], [[BB0_SPLIT]] ], [ [[INC2_NONCHR]], [[BB1_NONCHR]] ], [ [[INC2_NONCHR]], [[BB0_SPLIT_NONCHR]] ] -; CHECK-NEXT: [[SUM4:%.*]] = phi i32 [ [[SUM3]], [[BB0_SPLIT]] ], [ [[SUM3_NONCHR]], [[BB1_NONCHR]] ], [ [[SUM1]], [[BB0_SPLIT_NONCHR]] ] -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[TMP2]], 100 -; CHECK-NEXT: br i1 [[CMP]], label [[BB3:%.*]], label [[BB0]], !prof !16 -; CHECK: bb3: -; CHECK-NEXT: ret i32 [[SUM4]] -; -entry: - br label %bb0 - -bb0: - %inc1 = phi i32 [ %inc2, %bb2 ], [ 0, %entry ] - %li = load i32, i32* %i - %a1 = and i32 %li, 1 - %cmp1 = icmp eq i32 %a1, 0 - %sum1 = add i32 %sum0, 42 - %sum2 = select i1 %cmp1, i32 %sum0, i32 %sum1, !prof !15 - %a4 = and i32 %li, 4 - %cmp4 = icmp eq i32 %a4, 0 - %inc2 = add i32 %inc1, 1 - br i1 %cmp4, label %bb2, label %bb1, !prof !15 - -bb1: - %sum3 = add i32 %sum2, 44 - br label %bb2 - -bb2: - %sum4 = phi i32 [ %sum1, %bb0 ], [ %sum3, %bb1 ] - %cmp = icmp eq i32 %inc2, 100 - br i1 %cmp, label %bb3, label %bb0, !prof !15 - -bb3: - ret i32 %sum4 -} - - -; Selects + Brs. Those share the condition value, which causes the -; targets/operands of the branch/select to be flipped. -; Roughly, -; t0 = *i -; if ((t0 & 255) != 0) { // Likely true -; sum1 = ((t0 & 1) == 0) ? sum0 : (sum0 + 42) // Likely false -; sum2 = ((t0 & 1) == 0) ? sum1 : (sum1 + 42) // Likely false -; if ((t0 & 1) != 0) { // Likely true -; sum3 = sum2 + 44 -; sum4 = ((t0 & 8) == 0) ? sum3 : (sum3 + 44) // Likely false -; } -; sum5 = phi sum2, sum4 -; } -; sum6 = phi sum0, sum5 -; return sum6 -; -> -; t0 = *i -; if ((t0 & 9) == 9) { // Likely true -; tmp3 = sum0 + 85 // Dead -; tmp4 = sum0 + 173 -; } else { -; if ((t0 & 255) != 0) { -; sum2_nc = ((t0 & 1) == 0) ? sum0 : (sum0 + 85) -; sum4_nc_v = ((t0 & 8) == 0) ? 44 : 88 -; sum4_nc = add sum2_nc + sum4_nc_v -; } -; } -; sum6 = phi tmp4, sum0, sum2_nc, sum4_nc -; return sum6 -define i32 @test_chr_19(i32* %i, i32 %sum0) !prof !14 { -; CHECK-LABEL: @test_chr_19( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[TMP0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[TMP0]], 9 -; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 9 -; CHECK-NEXT: br i1 [[TMP2]], label [[BB0:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: bb0: -; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[SUM0:%.*]], 85 -; CHECK-NEXT: [[TMP4:%.*]] = add i32 [[SUM0]], 173 -; CHECK-NEXT: br label [[BB3:%.*]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP0]], 255 -; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0 -; CHECK-NEXT: br i1 [[TMP6]], label [[BB3]], label [[BB0_NONCHR:%.*]], !prof !16 -; CHECK: bb0.nonchr: -; CHECK-NEXT: [[TMP7:%.*]] = and i32 [[TMP0]], 1 -; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i32 [[TMP7]], 0 -; CHECK-NEXT: [[TMP9:%.*]] = add i32 [[SUM0]], 85 -; CHECK-NEXT: [[SUM2_NONCHR:%.*]] = select i1 [[TMP8]], i32 [[SUM0]], i32 [[TMP9]], !prof !16 -; CHECK-NEXT: br i1 [[TMP8]], label [[BB3]], label [[BB1_NONCHR:%.*]], !prof !16 -; CHECK: bb1.nonchr: -; CHECK-NEXT: [[TMP10:%.*]] = and i32 [[TMP0]], 8 -; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i32 [[TMP10]], 0 -; CHECK-NEXT: [[SUM4_NONCHR_V:%.*]] = select i1 [[TMP11]], i32 44, i32 88, !prof !16 -; CHECK-NEXT: [[SUM4_NONCHR:%.*]] = add i32 [[SUM2_NONCHR]], [[SUM4_NONCHR_V]] -; CHECK-NEXT: br label [[BB3]] -; CHECK: bb3: -; CHECK-NEXT: [[SUM6:%.*]] = phi i32 [ [[TMP4]], [[BB0]] ], [ [[SUM0]], [[ENTRY_SPLIT_NONCHR]] ], [ [[SUM2_NONCHR]], [[BB0_NONCHR]] ], [ [[SUM4_NONCHR]], [[BB1_NONCHR]] ] -; CHECK-NEXT: ret i32 [[SUM6]] -; -entry: - %0 = load i32, i32* %i - %1 = and i32 %0, 255 - %2 = icmp eq i32 %1, 0 - br i1 %2, label %bb3, label %bb0, !prof !15 - -bb0: - %3 = and i32 %0, 1 - %4 = icmp eq i32 %3, 0 - %5 = add i32 %sum0, 42 - %sum1 = select i1 %4, i32 %sum0, i32 %5, !prof !15 - %6 = add i32 %sum1, 43 - %sum2 = select i1 %4, i32 %sum1, i32 %6, !prof !15 - br i1 %4, label %bb2, label %bb1, !prof !15 - -bb1: - %sum3 = add i32 %sum2, 44 - %7 = and i32 %0, 8 - %8 = icmp eq i32 %7, 0 - %9 = add i32 %sum3, 44 - %sum4 = select i1 %8, i32 %sum3, i32 %9, !prof !15 - br label %bb2 - -bb2: - %sum5 = phi i32 [ %sum2, %bb0 ], [ %sum4, %bb1 ] - br label %bb3 - -bb3: - %sum6 = phi i32 [ %sum0, %entry ], [ %sum5, %bb2 ] - ret i32 %sum6 -} - -; Selects. The exit block, which belongs to the top-level region, has a select -; and causes the top-level region to be the outermost CHR scope with the -; subscope that includes the entry block with two selects. The outermost CHR -; scope doesn't see the selects in the entry block as the entry block is in the -; subscope and incorrectly sets the CHR hoist point to the branch rather than -; the first select in the entry block and causes the CHR'ed selects ("select i1 -; false...") to incorrectly position above the CHR branch. This is testing -; against a quirk of how the region analysis handles the entry block. -; Roughly, -; i0 = *i -; sum2 = ((i0 & 2) == 0) ? sum0 : (sum0 + 43) // Likely false -; sum3 = ((i0 & 4) == 0) ? sum2 : (sum2 + 44) // Likely false -; if (j) -; foo() -; i5 = *i -; v13 = (i5 == 44) ? i5 : sum3 -; return v13 -; -> -; i0 = *i -; if ((i0 & 6) != 6) { // Likely true -; v9 = sum0 + 87 -; if (j) -; foo() -; } else { -; sum2.nc = ((i0 & 2) == 0) ? sum0 : (sum0 + 43) -; sum3.nc = ((i0 & 4) == 0) ? sum2.nc : (sum2.nc + 44) -; if (j) -; foo() -; } -; t2 = phi v9, sum3.nc -; i5 = *i -; v13 = (i5 == 44) ? 44 : t2 -; return v13 -define i32 @test_chr_20(i32* %i, i32 %sum0, i1 %j) !prof !14 { -; CHECK-LABEL: @test_chr_20( -; CHECK-NEXT: entry: -; CHECK-NEXT: [[I0:%.*]] = load i32, i32* [[I:%.*]], align 4 -; CHECK-NEXT: [[TMP0:%.*]] = and i32 [[I0]], 6 -; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 6 -; CHECK-NEXT: br i1 [[TMP1]], label [[ENTRY_SPLIT:%.*]], label [[ENTRY_SPLIT_NONCHR:%.*]], !prof !15 -; CHECK: entry.split: -; CHECK-NEXT: [[V9:%.*]] = add i32 [[SUM0:%.*]], 87 -; CHECK-NEXT: br i1 [[J:%.*]], label [[BB1:%.*]], label [[BB4:%.*]] -; CHECK: bb1: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB4]] -; CHECK: entry.split.nonchr: -; CHECK-NEXT: [[V8:%.*]] = add i32 [[SUM0]], 43 -; CHECK-NEXT: [[V3:%.*]] = and i32 [[I0]], 2 -; CHECK-NEXT: [[V4:%.*]] = icmp eq i32 [[V3]], 0 -; CHECK-NEXT: [[SUM2_NONCHR:%.*]] = select i1 [[V4]], i32 [[SUM0]], i32 [[V8]], !prof !16 -; CHECK-NEXT: [[V6_NONCHR:%.*]] = and i32 [[I0]], 4 -; CHECK-NEXT: [[V5_NONCHR:%.*]] = icmp eq i32 [[V6_NONCHR]], 0 -; CHECK-NEXT: [[V9_NONCHR:%.*]] = add i32 [[SUM2_NONCHR]], 44 -; CHECK-NEXT: [[SUM3_NONCHR:%.*]] = select i1 [[V5_NONCHR]], i32 [[SUM2_NONCHR]], i32 [[V9_NONCHR]], !prof !16 -; CHECK-NEXT: br i1 [[J]], label [[BB1_NONCHR:%.*]], label [[BB4]] -; CHECK: bb1.nonchr: -; CHECK-NEXT: call void @foo() -; CHECK-NEXT: br label [[BB4]] -; CHECK: bb4: -; CHECK-NEXT: [[TMP2:%.*]] = phi i32 [ [[V9]], [[BB1]] ], [ [[V9]], [[ENTRY_SPLIT]] ], [ [[SUM3_NONCHR]], [[BB1_NONCHR]] ], [ [[SUM3_NONCHR]], [[ENTRY_SPLIT_NONCHR]] ] -; CHECK-NEXT: [[I5:%.*]] = load i32, i32* [[I]], align 4 -; CHECK-NEXT: [[V12:%.*]] = icmp eq i32 [[I5]], 44 -; CHECK-NEXT: [[V13:%.*]] = select i1 [[V12]], i32 44, i32 [[TMP2]], !prof !16 -; CHECK-NEXT: ret i32 [[V13]] -; -entry: - %i0 = load i32, i32* %i - %v3 = and i32 %i0, 2 - %v4 = icmp eq i32 %v3, 0 - %v8 = add i32 %sum0, 43 - %sum2 = select i1 %v4, i32 %sum0, i32 %v8, !prof !15 - %v6 = and i32 %i0, 4 - %v5 = icmp eq i32 %v6, 0 - %v9 = add i32 %sum2, 44 - %sum3 = select i1 %v5, i32 %sum2, i32 %v9, !prof !15 - br i1 %j, label %bb1, label %bb4 - -bb1: - call void @foo() - br label %bb4 - -bb4: - %i5 = load i32, i32* %i - %v12 = icmp eq i32 %i5, 44 - %v13 = select i1 %v12, i32 %i5, i32 %sum3, !prof !15 - ret i32 %v13 -} - -!llvm.module.flags = !{!0} -!0 = !{i32 1, !"ProfileSummary", !1} -!1 = !{!2, !3, !4, !5, !6, !7, !8, !9} -!2 = !{!"ProfileFormat", !"InstrProf"} -!3 = !{!"TotalCount", i64 10000} -!4 = !{!"MaxCount", i64 10} -!5 = !{!"MaxInternalCount", i64 1} -!6 = !{!"MaxFunctionCount", i64 1000} -!7 = !{!"NumCounts", i64 3} -!8 = !{!"NumFunctions", i64 3} -!9 = !{!"DetailedSummary", !10} -!10 = !{!11, !12, !13} -!11 = !{i32 10000, i64 100, i32 1} -!12 = !{i32 999000, i64 100, i32 1} -!13 = !{i32 999999, i64 1, i32 2} - -!14 = !{!"function_entry_count", i64 100} -!15 = !{!"branch_weights", i32 0, i32 1} -!16 = !{!"branch_weights", i32 1, i32 1} -; CHECK: !15 = !{!"branch_weights", i32 1000, i32 0} -; CHECK: !16 = !{!"branch_weights", i32 0, i32 1} -; CHECK: !17 = !{!"branch_weights", i32 1, i32 1} -; CHECK: !18 = !{!"branch_weights", i32 1, i32 0} -; CHECK: !19 = !{!"branch_weights", i32 0, i32 1000} diff --git a/llvm/test/Transforms/PGOProfile/comdat_internal.ll b/llvm/test/Transforms/PGOProfile/comdat_internal.ll deleted file mode 100644 index 74630179105..00000000000 --- a/llvm/test/Transforms/PGOProfile/comdat_internal.ll +++ /dev/null @@ -1,26 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -instrprof -S | FileCheck %s -; RUN: opt < %s -passes=pgo-instr-gen,instrprof -S | FileCheck %s -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -$foo = comdat any -; CHECK: $foo = comdat any - -; CHECK: $__llvm_profile_raw_version = comdat any -; CHECK: $__profv__stdin__foo.[[FOO_HASH:[0-9]+]] = comdat any - -@bar = global i32 ()* @foo, align 8 - -; CHECK: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat -; CHECK-NOT: __profn__stdin__foo -; CHECK: @__profc__stdin__foo.[[FOO_HASH]] = private global [1 x i64] zeroinitializer, section "__llvm_prf_cnts", comdat($__profv__stdin__foo.[[FOO_HASH]]), align 8 -; CHECK: @__profd__stdin__foo.[[FOO_HASH]] = private global { i64, i64, i64*, i8*, i8*, i32, [2 x i16] } { i64 -5640069336071256030, i64 [[FOO_HASH]], i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc__stdin__foo.[[FOO_HASH]], i32 0, i32 0), i8* null -; CHECK-NOT: bitcast (i32 ()* @foo to i8*) -; CHECK-SAME: , i8* null, i32 1, [2 x i16] zeroinitializer }, section "__llvm_prf_data", comdat($__profv__stdin__foo.[[FOO_HASH]]), align 8 -; CHECK: @__llvm_prf_nm -; CHECK: @llvm.used - -define internal i32 @foo() comdat { -entry: - ret i32 1 -} diff --git a/llvm/test/Transforms/PGOProfile/comdat_rename.ll b/llvm/test/Transforms/PGOProfile/comdat_rename.ll deleted file mode 100644 index 53fc7e430cf..00000000000 --- a/llvm/test/Transforms/PGOProfile/comdat_rename.ll +++ /dev/null @@ -1,52 +0,0 @@ -; RUN: opt < %s -mtriple=x86_64-unknown-linux -pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s -; RUN: opt < %s -mtriple=x86_64-unknown-linux -passes=pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s -; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s -; RUN: opt < %s -mtriple=x86_64-pc-win32-coff -passes=pgo-instr-gen -do-comdat-renaming=true -S | FileCheck %s - -; Rename Comdat group and its function. -$f = comdat any -; CHECK: $f.[[SINGLEBB_HASH:[0-9]+]] = comdat any -define linkonce_odr void @f() comdat($f) { - ret void -} - -; Not rename Comdat with right linkage. -$nf = comdat any -; CHECK: $nf = comdat any -define void @nf() comdat($nf) { - ret void -} - -; Not rename Comdat with variable members. -$f_with_var = comdat any -; CHECK: $f_with_var = comdat any -@var = global i32 0, comdat($f_with_var) -define linkonce_odr void @f_with_var() comdat($f_with_var) { - %tmp = load i32, i32* @var, align 4 - %inc = add nsw i32 %tmp, 1 - store i32 %inc, i32* @var, align 4 - ret void -} - -; Not rename Comdat with multiple functions. -$tf = comdat any -; CHECK: $tf = comdat any -define linkonce void @tf() comdat($tf) { - ret void -} -define linkonce void @tf2() comdat($tf) { - ret void -} - -; Rename AvailableExternallyLinkage functions -; CHECK-DAG: $aef.[[SINGLEBB_HASH]] = comdat any - -; CHECK: @f = weak alias void (), void ()* @f.[[SINGLEBB_HASH]] -; CHECK: @aef = weak alias void (), void ()* @aef.[[SINGLEBB_HASH]] - -define available_externally void @aef() { -; CHECK: define linkonce_odr void @aef.[[SINGLEBB_HASH]]() comdat { - ret void -} - - diff --git a/llvm/test/Transforms/PGOProfile/counter_promo.ll b/llvm/test/Transforms/PGOProfile/counter_promo.ll deleted file mode 100644 index 812d0fefaa7..00000000000 --- a/llvm/test/Transforms/PGOProfile/counter_promo.ll +++ /dev/null @@ -1,68 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -instrprof -do-counter-promotion=true -S | FileCheck --check-prefix=PROMO --check-prefix=NONATOMIC_PROMO %s -; RUN: opt < %s --passes=pgo-instr-gen,instrprof -do-counter-promotion=true -S | FileCheck --check-prefix=PROMO --check-prefix=NONATOMIC_PROMO %s -; RUN: opt < %s -pgo-instr-gen -instrprof -do-counter-promotion=true -atomic-counter-update-promoted -S | FileCheck --check-prefix=PROMO --check-prefix=ATOMIC_PROMO %s -; RUN: opt < %s --passes=pgo-instr-gen,instrprof -do-counter-promotion=true -atomic-counter-update-promoted -S | FileCheck --check-prefix=PROMO --check-prefix=ATOMIC_PROMO %s - -define void @foo(i32 %n, i32 %N) { -; PROMO-LABEL: @foo -; PROMO: {{.*}} = load {{.*}} @__profc_foo{{.*}} 3) -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}3) -bb: - %tmp = add nsw i32 %n, 1 - %tmp1 = add nsw i32 %n, -1 - br label %bb2 - -bb2: ; preds = %bb9, %bb -; PROMO: phi {{.*}} -; PROMO-NEXT: phi {{.*}} -; PROMO-NEXT: phi {{.*}} -; PROMO-NEXT: phi {{.*}} - %i.0 = phi i32 [ 0, %bb ], [ %tmp10, %bb9 ] - %tmp3 = icmp slt i32 %i.0, %tmp - br i1 %tmp3, label %bb4, label %bb5 - -bb4: ; preds = %bb2 - tail call void @bar(i32 1) - br label %bb9 - -bb5: ; preds = %bb2 - %tmp6 = icmp slt i32 %i.0, %tmp1 - br i1 %tmp6, label %bb7, label %bb8 - -bb7: ; preds = %bb5 - tail call void @bar(i32 2) - br label %bb9 - -bb8: ; preds = %bb5 - tail call void @bar(i32 3) - br label %bb9 - -bb9: ; preds = %bb8, %bb7, %bb4 -; PROMO: %[[LIVEOUT3:[a-z0-9]+]] = phi {{.*}} -; PROMO-NEXT: %[[LIVEOUT2:[a-z0-9]+]] = phi {{.*}} -; PROMO-NEXT: %[[LIVEOUT1:[a-z0-9]+]] = phi {{.*}} - %tmp10 = add nsw i32 %i.0, 1 - %tmp11 = icmp slt i32 %tmp10, %N - br i1 %tmp11, label %bb2, label %bb12 - -bb12: ; preds = %bb9 - ret void -; NONATOMIC_PROMO: %[[PROMO1:[a-z0-9.]+]] = load {{.*}} @__profc_foo{{.*}} 0) -; NONATOMIC_PROMO-NEXT: add {{.*}} %[[PROMO1]], %[[LIVEOUT1]] -; NONATOMIC_PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}0) -; NONATOMIC_PROMO-NEXT: %[[PROMO2:[a-z0-9.]+]] = load {{.*}} @__profc_foo{{.*}} 1) -; NONATOMIC_PROMO-NEXT: add {{.*}} %[[PROMO2]], %[[LIVEOUT2]] -; NONATOMIC_PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}1) -; NONATOMIC_PROMO-NEXT: %[[PROMO3:[a-z0-9.]+]] = load {{.*}} @__profc_foo{{.*}} 2) -; NONATOMIC_PROMO-NEXT: add {{.*}} %[[PROMO3]], %[[LIVEOUT3]] -; NONATOMIC_PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}2) -; ATOMIC_PROMO: atomicrmw add {{.*}} @__profc_foo{{.*}}0), i64 %[[LIVEOUT1]] seq_cst -; ATOMIC_PROMO-NEXT: atomicrmw add {{.*}} @__profc_foo{{.*}}1), i64 %[[LIVEOUT2]] seq_cst -; ATOMIC_PROMO-NEXT: atomicrmw add {{.*}} @__profc_foo{{.*}}2), i64 %[[LIVEOUT3]] seq_cst -; PROMO-NOT: @__profc_foo - - -} - -declare void @bar(i32) diff --git a/llvm/test/Transforms/PGOProfile/counter_promo_exit_merge.ll b/llvm/test/Transforms/PGOProfile/counter_promo_exit_merge.ll deleted file mode 100644 index 85ca1613c8a..00000000000 --- a/llvm/test/Transforms/PGOProfile/counter_promo_exit_merge.ll +++ /dev/null @@ -1,74 +0,0 @@ -; RUN: opt < %s -instrprof -do-counter-promotion=true -speculative-counter-promotion-max-exiting=3 -S | FileCheck --check-prefix=PROMO %s -; RUN: opt < %s --passes=instrprof -do-counter-promotion=true -speculative-counter-promotion-max-exiting=3 -S | FileCheck --check-prefix=PROMO %s - -$__llvm_profile_raw_version = comdat any - -@g = common local_unnamed_addr global i32 0, align 4 -@__llvm_profile_raw_version = constant i64 72057594037927940, comdat -@__profn_foo = private constant [3 x i8] c"foo" - -define void @foo(i32 %arg) local_unnamed_addr { -bb: - %tmp = add nsw i32 %arg, -1 - br label %bb1 - -bb1: ; preds = %bb11, %bb - %tmp2 = phi i32 [ 0, %bb ], [ %tmp12, %bb11 ] - %tmp3 = icmp sgt i32 %tmp2, %arg - br i1 %tmp3, label %bb7, label %bb4 - -bb4: ; preds = %bb1 - call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 63969943867, i32 5, i32 1) - tail call void @bar(i32 1) - %tmp5 = load i32, i32* @g, align 4 - %tmp6 = icmp sgt i32 %tmp5, 100 - br i1 %tmp6, label %bb14, label %bb11 - -bb7: ; preds = %bb1 - %tmp8 = icmp slt i32 %tmp2, %tmp - br i1 %tmp8, label %bb9, label %bb10 - -bb9: ; preds = %bb7 - call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 63969943867, i32 5, i32 2) - tail call void @bar(i32 2) - br label %bb11 - -bb10: ; preds = %bb7 - call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 63969943867, i32 5, i32 3) - tail call void @bar(i32 3) - br label %bb11 - -bb11: ; preds = %bb10, %bb9, %bb4 - %tmp12 = add nuw nsw i32 %tmp2, 1 - %tmp13 = icmp slt i32 %tmp2, 99 - br i1 %tmp13, label %bb1, label %bb14 - -bb14: ; preds = %bb4.bb14_crit_edge, %bb11 - tail call void @bar(i32 0) - br label %bb15 -; PROMO-LABEL: bb14: -; PROMO: %[[MERGE1:[a-z0-9]+]] = phi {{.*}} -; PROMO-NEXT: %[[MERGE2:[a-z0-9.]+]] = phi {{.*}} -; PROMO-NEXT: %[[MERGE3:[a-z0-9.]+]] = phi {{.*}} -; PROMO-NEXT: %[[PROMO3:[a-z0-9.]+]] = load{{.*}}@__profc_foo{{.*}}1) -; PROMO-NEXT: {{.*}} = add {{.*}}%[[PROMO3]], %[[MERGE3]] -; PROMO-NEXT: store{{.*}}@__profc_foo{{.*}}1) -; PROMO-NEXT: %[[PROMO2:[a-z0-9.]+]] = load{{.*}}@__profc_foo{{.*}}2) -; PROMO-NEXT: {{.*}} = add {{.*}}%[[PROMO2]], %[[MERGE2]] -; PROMO-NEXT: store{{.*}}@__profc_foo{{.*}}2) -; PROMO-NEXT: %[[PROMO1:[a-z0-9.]+]] = load{{.*}}@__profc_foo{{.*}}3) -; PROMO-NEXT: {{.*}} = add {{.*}}%[[PROMO1]], %[[MERGE1]] -; PROMO-NEXT: store{{.*}}@__profc_foo{{.*}}3) - -bb15: ; preds = %bb14 - call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 63969943867, i32 5, i32 4) - tail call void @bar(i32 1) - ret void -} - -declare void @bar(i32) local_unnamed_addr - -; Function Attrs: nounwind -declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0 - -attributes #0 = { nounwind } diff --git a/llvm/test/Transforms/PGOProfile/counter_promo_mexits.ll b/llvm/test/Transforms/PGOProfile/counter_promo_mexits.ll deleted file mode 100644 index bb799757a47..00000000000 --- a/llvm/test/Transforms/PGOProfile/counter_promo_mexits.ll +++ /dev/null @@ -1,80 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -instrprof -do-counter-promotion=true -speculative-counter-promotion-max-exiting=3 -S | FileCheck --check-prefix=PROMO %s -; RUN: opt < %s --passes=pgo-instr-gen,instrprof -do-counter-promotion=true -speculative-counter-promotion-max-exiting=3 -S | FileCheck --check-prefix=PROMO %s - -@g = common local_unnamed_addr global i32 0, align 4 - -define void @foo(i32 %arg) local_unnamed_addr { -; PROMO-LABEL: @foo -bb: - %tmp = add nsw i32 %arg, -1 - br label %bb1 -bb1: ; preds = %bb11, %bb - %tmp2 = phi i32 [ 0, %bb ], [ %tmp12, %bb11 ] - %tmp3 = icmp sgt i32 %tmp2, %arg - br i1 %tmp3, label %bb7, label %bb4 - -bb4: ; preds = %bb1 - tail call void @bar(i32 1) - %tmp5 = load i32, i32* @g, align 4 - %tmp6 = icmp sgt i32 %tmp5, 100 - br i1 %tmp6, label %bb15_0, label %bb11 - -bb7: ; preds = %bb1 - %tmp8 = icmp slt i32 %tmp2, %tmp - br i1 %tmp8, label %bb9, label %bb10 - -bb9: ; preds = %bb7 - tail call void @bar(i32 2) - br label %bb11 - -bb10: ; preds = %bb7 - tail call void @bar(i32 3) - br label %bb11 - -bb11: ; preds = %bb10, %bb9, %bb4 - %tmp12 = add nuw nsw i32 %tmp2, 1 - %tmp13 = icmp slt i32 %tmp2, 99 - br i1 %tmp13, label %bb1, label %bb14 - -bb14: ; preds = %bb11 -; PROMO-LABEL: bb14: - tail call void @bar(i32 0) - br label %bb15 -; PROMO: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 0) -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}0) -; PROMO-NEXT: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 1) -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}1) -; PROMO-NEXT: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 2) -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}2) -; PROMO-NEXT: %pgocount{{.*}} = load {{.*}} @__profc_foo{{.*}} 3) -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}3) - - -bb15_0: ; preds = %bb11 -; PROMO-LABEL: bb15_0: - br label %bb15 -; PROMO: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 0) -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}0) -; PROMO-NEXT: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 1) -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}1) -; PROMO-NEXT: %pgocount.promoted{{.*}} = load {{.*}} @__profc_foo{{.*}} 2) -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}2) -; PROMO-NEXT: %pgocount{{.*}} = load {{.*}} @__profc_foo{{.*}} 4) -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_foo{{.*}}4) -; PROMO-NOT: @__profc_foo - - -bb15: ; preds = %bb14, %bb4 - tail call void @bar(i32 1) - ret void -} - -declare void @bar(i32) local_unnamed_addr diff --git a/llvm/test/Transforms/PGOProfile/counter_promo_nest.ll b/llvm/test/Transforms/PGOProfile/counter_promo_nest.ll deleted file mode 100644 index b7f117b3e94..00000000000 --- a/llvm/test/Transforms/PGOProfile/counter_promo_nest.ll +++ /dev/null @@ -1,165 +0,0 @@ -; TEST that counter updates are promoted outside the whole loop nest -; RUN: opt < %s -pgo-instr-gen -instrprof -do-counter-promotion=true -S | FileCheck --check-prefix=PROMO %s -; RUN: opt < %s --passes=pgo-instr-gen,instrprof -do-counter-promotion=true -S | FileCheck --check-prefix=PROMO %s - -@g = common local_unnamed_addr global i32 0, align 4 -@c = local_unnamed_addr global i32 10, align 4 - -; Function Attrs: noinline norecurse nounwind uwtable -define void @bar() local_unnamed_addr #0 { -bb: - %tmp2 = load i32, i32* @g, align 4, !tbaa !2 - %tmp3 = add nsw i32 %tmp2, 1 - store i32 %tmp3, i32* @g, align 4, !tbaa !2 - ret void -} - -; Function Attrs: norecurse nounwind uwtable -define i32 @main() local_unnamed_addr #1 { -bb: - store i32 0, i32* @g, align 4, !tbaa !2 - %tmp = load i32, i32* @c, align 4, !tbaa !2 - %tmp1 = icmp sgt i32 %tmp, 0 - br i1 %tmp1, label %bb2_1, label %bb84 - -bb2_1: - br label %bb2 - -bb2: ; preds = %bb39, %bb - %tmp3 = phi i32 [ %tmp40, %bb39 ], [ %tmp, %bb2_1 ] - %tmp5 = phi i32 [ %tmp43, %bb39 ], [ 0, %bb2_1 ] - %tmp7 = icmp sgt i32 %tmp3, 0 - br i1 %tmp7, label %bb14_1, label %bb39 - -bb8: ; preds = %bb39 -; PROMO-LABEL: bb8 -; PROMO: load {{.*}} @__profc_main{{.*}} -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_main{{.*}} -; PROMO-NEXT: load {{.*}} @__profc_main{{.*}} -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_main{{.*}} -; PROMO-NEXT: load {{.*}} @__profc_main{{.*}} -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_main{{.*}} -; PROMO-NEXT: load {{.*}} @__profc_main{{.*}} -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_main{{.*}} -; PROMO-NEXT: load {{.*}} @__profc_main{{.*}} -; PROMO-NEXT: add -; PROMO-NEXT: store {{.*}}@__profc_main{{.*}} - - %tmp13 = icmp sgt i32 %tmp40, 0 - br i1 %tmp13, label %bb45, label %bb84 - -bb14_1: - br label %bb14 - -bb14: ; preds = %bb29, %bb2 - %tmp15 = phi i32 [ %tmp30, %bb29 ], [ %tmp3, %bb14_1 ] - %tmp16 = phi i64 [ %tmp31, %bb29 ], [ 0, %bb14_1 ] - %tmp17 = phi i64 [ %tmp32, %bb29 ], [ 0, %bb14_1 ] - %tmp18 = phi i32 [ %tmp33, %bb29 ], [ 0, %bb14_1 ] - %tmp19 = icmp sgt i32 %tmp15, 0 - br i1 %tmp19, label %bb20_split, label %bb29 - -bb20_split: - br label %bb20 - -bb20: ; preds = %bb20, %bb14 - %tmp21 = phi i64 [ %tmp23, %bb20 ], [ 0, %bb20_split ] - %tmp22 = phi i32 [ %tmp24, %bb20 ], [ 0, %bb20_split ] - %tmp23 = add nuw i64 %tmp21, 1 - tail call void @bar() - %tmp24 = add nuw nsw i32 %tmp22, 1 - %tmp25 = load i32, i32* @c, align 4, !tbaa !2 - %tmp26 = icmp slt i32 %tmp24, %tmp25 - br i1 %tmp26, label %bb20, label %bb27 - -bb27: ; preds = %bb20 - %tmp28 = add i64 %tmp23, %tmp16 - br label %bb29 - -bb29: ; preds = %bb27, %bb14 - %tmp30 = phi i32 [ %tmp25, %bb27 ], [ %tmp15, %bb14 ] - %tmp31 = phi i64 [ %tmp28, %bb27 ], [ %tmp16, %bb14 ] - %tmp32 = add nuw i64 %tmp17, 1 - %tmp33 = add nuw nsw i32 %tmp18, 1 - %tmp34 = icmp slt i32 %tmp33, %tmp30 - br i1 %tmp34, label %bb14, label %bb35 - -bb35: ; preds = %bb29 - %tmp36 = insertelement <2 x i64> undef, i64 %tmp31, i32 0 - br label %bb39 - -bb39: ; preds = %bb35, %bb2 - %tmp40 = phi i32 [ %tmp30, %bb35 ], [ %tmp3, %bb2 ] - %tmp43 = add nuw nsw i32 %tmp5, 1 - %tmp44 = icmp slt i32 %tmp43, %tmp40 - br i1 %tmp44, label %bb2, label %bb8 - -bb45: ; preds = %bb67, %bb8 - %tmp46 = phi i32 [ %tmp68, %bb67 ], [ %tmp40, %bb8 ] - %tmp47 = phi i64 [ %tmp69, %bb67 ], [ 0, %bb8 ] - %tmp48 = phi i64 [ %tmp70, %bb67 ], [ 0, %bb8 ] - %tmp49 = phi i32 [ %tmp71, %bb67 ], [ 0, %bb8 ] - %tmp50 = icmp sgt i32 %tmp46, 0 - br i1 %tmp50, label %bb57, label %bb67 - -bb51: ; preds = %bb67 - %tmp56 = icmp sgt i32 %tmp68, 0 - br i1 %tmp56, label %bb73, label %bb84 - -bb57: ; preds = %bb57, %bb45 - %tmp58 = phi i64 [ %tmp60, %bb57 ], [ 0, %bb45 ] - %tmp59 = phi i32 [ %tmp61, %bb57 ], [ 0, %bb45 ] - %tmp60 = add nuw i64 %tmp58, 1 - tail call void @bar() - %tmp61 = add nuw nsw i32 %tmp59, 1 - %tmp62 = load i32, i32* @c, align 4, !tbaa !2 - %tmp63 = mul nsw i32 %tmp62, 10 - %tmp64 = icmp slt i32 %tmp61, %tmp63 - br i1 %tmp64, label %bb57, label %bb65 - -bb65: ; preds = %bb57 - %tmp66 = add i64 %tmp60, %tmp47 - br label %bb67 - -bb67: ; preds = %bb65, %bb45 - %tmp68 = phi i32 [ %tmp62, %bb65 ], [ %tmp46, %bb45 ] - %tmp69 = phi i64 [ %tmp66, %bb65 ], [ %tmp47, %bb45 ] - %tmp70 = add nuw i64 %tmp48, 1 - %tmp71 = add nuw nsw i32 %tmp49, 1 - %tmp72 = icmp slt i32 %tmp71, %tmp68 - br i1 %tmp72, label %bb45, label %bb51 - -bb73: ; preds = %bb73, %bb51 - %tmp74 = phi i64 [ %tmp76, %bb73 ], [ 0, %bb51 ] - %tmp75 = phi i32 [ %tmp77, %bb73 ], [ 0, %bb51 ] - %tmp76 = add nuw i64 %tmp74, 1 - tail call void @bar() - %tmp77 = add nuw nsw i32 %tmp75, 1 - %tmp78 = load i32, i32* @c, align 4, !tbaa !2 - %tmp79 = mul nsw i32 %tmp78, 100 - %tmp80 = icmp slt i32 %tmp77, %tmp79 - br i1 %tmp80, label %bb73, label %bb81 - -bb81: ; preds = %bb73 - br label %bb84 - -bb84: ; preds = %bb81, %bb51, %bb8, %bb - ret i32 0 -} - -attributes #0 = { noinline } -attributes #1 = { norecurse nounwind uwtable } - -!llvm.module.flags = !{!0} -!llvm.ident = !{!1} - -!0 = !{i32 1, !"wchar_size", i32 4} -!1 = !{!"clang version 5.0.0 (trunk 307355)"} -!2 = !{!3, !3, i64 0} -!3 = !{!"int", !4, i64 0} -!4 = !{!"omnipotent char", !5, i64 0} -!5 = !{!"Simple C/C++ TBAA"} diff --git a/llvm/test/Transforms/PGOProfile/criticaledge.ll b/llvm/test/Transforms/PGOProfile/criticaledge.ll deleted file mode 100644 index 4b2ea6becfe..00000000000 --- a/llvm/test/Transforms/PGOProfile/criticaledge.ll +++ /dev/null @@ -1,112 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: llvm-profdata merge %S/Inputs/criticaledge.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat -; GEN: @__profn_test_criticalEdge = private constant [17 x i8] c"test_criticalEdge" -; GEN: @__profn__stdin__bar = private constant [11 x i8] c"<stdin>:bar" - -define i32 @test_criticalEdge(i32 %i, i32 %j) { -entry: -; CHECK: entry: -; GEN-NOT: call void @llvm.instrprof.increment - switch i32 %i, label %sw.default [ - i32 1, label %sw.bb - i32 2, label %sw.bb1 - i32 3, label %sw.bb2 - i32 4, label %sw.bb2 -; CHECK: i32 3, label %entry.sw.bb2_crit_edge -; CHECK: i32 4, label %entry.sw.bb2_crit_edge1 - i32 5, label %sw.bb2 - ] -; USE: ] -; USE-SAME: !prof ![[BW_SWITCH:[0-9]+]] - -; CHECK: entry.sw.bb2_crit_edge1: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 1) -; CHECK: br label %sw.bb2 - -; CHECK: entry.sw.bb2_crit_edge: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 0) -; CHECK: br label %sw.bb2 - -sw.bb: -; GEN: sw.bb: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 5) - %call = call i32 @bar(i32 2) - br label %sw.epilog - -sw.bb1: -; GEN: sw.bb1: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 4) - %call2 = call i32 @bar(i32 1024) - br label %sw.epilog - -sw.bb2: -; GEN: sw.bb2: -; GEN-NOT: call void @llvm.instrprof.increment - %cmp = icmp eq i32 %j, 2 - br i1 %cmp, label %if.then, label %if.end -; USE: br i1 %cmp, label %if.then, label %if.end -; USE-SAME: !prof ![[BW_SW_BB2:[0-9]+]] - -if.then: -; GEN: if.then: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 2) - %call4 = call i32 @bar(i32 4) - br label %return - -if.end: -; GEN: if.end: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 3) - %call5 = call i32 @bar(i32 8) - br label %sw.epilog - -sw.default: -; GEN: sw.default: -; GEN-NOT: call void @llvm.instrprof.increment - %call6 = call i32 @bar(i32 32) - %cmp7 = icmp sgt i32 %j, 10 - br i1 %cmp7, label %if.then8, label %if.end9 -; USE: br i1 %cmp7, label %if.then8, label %if.end9 -; USE-SAME: !prof ![[BW_SW_DEFAULT:[0-9]+]] - -if.then8: -; GEN: if.then8: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 7) - %add = add nsw i32 %call6, 10 - br label %if.end9 - -if.end9: -; GEN: if.end9: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 6) - %res.0 = phi i32 [ %add, %if.then8 ], [ %call6, %sw.default ] - br label %sw.epilog - -sw.epilog: -; GEN: sw.epilog: -; GEN-NOT: call void @llvm.instrprof.increment - %res.1 = phi i32 [ %res.0, %if.end9 ], [ %call5, %if.end ], [ %call2, %sw.bb1 ], [ %call, %sw.bb ] - br label %return - -return: -; GEN: return: -; GEN-NOT: call void @llvm.instrprof.increment - %retval = phi i32 [ %res.1, %sw.epilog ], [ %call4, %if.then ] - ret i32 %retval -} - -define internal i32 @bar(i32 %i) { -entry: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__profn__stdin__bar, i32 0, i32 0), i64 12884901887, i32 1, i32 0) - ret i32 %i -} - -; USE: ![[BW_SWITCH]] = !{!"branch_weights", i32 2, i32 1, i32 0, i32 2, i32 1, i32 1} -; USE: ![[BW_SW_BB2]] = !{!"branch_weights", i32 2, i32 2} -; USE: ![[BW_SW_DEFAULT]] = !{!"branch_weights", i32 1, i32 1} diff --git a/llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll b/llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll deleted file mode 100644 index ad977658f89..00000000000 --- a/llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll +++ /dev/null @@ -1,155 +0,0 @@ -; Test the profile summary for context sensitive PGO (CSPGO) - -; RUN: llvm-profdata merge %S/Inputs/cspgo.proftext -o %t.profdata -; RUN: opt < %s -O2 -disable-preinline -pgo-kind=pgo-instr-use-pipeline -profile-file=%t.profdata -S | FileCheck %s --check-prefix=PGOSUMMARY -; RUN: opt < %s -O2 -disable-preinline -pgo-kind=pgo-instr-use-pipeline -profile-file=%t.profdata -S -cspgo-kind=cspgo-instr-use-pipeline| FileCheck %s --check-prefix=CSPGOSUMMARY - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@odd = common dso_local global i32 0, align 4 -@even = common dso_local global i32 0, align 4 -@not_six = common dso_local global i32 0, align 4 - -define dso_local i32 @goo(i32 %n) { -entry: - %i = alloca i32, align 4 - %i.0..sroa_cast = bitcast i32* %i to i8* - store volatile i32 %n, i32* %i, align 4 - %i.0. = load volatile i32, i32* %i, align 4 - ret i32 %i.0. -} - -define dso_local void @bar(i32 %n) { -entry: - %call = call fastcc i32 @cond(i32 %n) - %tobool = icmp eq i32 %call, 0 - br i1 %tobool, label %if.else, label %if.then - -if.then: - %0 = load i32, i32* @odd, align 4 - %inc = add i32 %0, 1 - store i32 %inc, i32* @odd, align 4 - br label %if.end - -if.else: - %1 = load i32, i32* @even, align 4 - %inc1 = add i32 %1, 1 - store i32 %inc1, i32* @even, align 4 - br label %if.end - -if.end: - br label %for.cond - -for.cond: - %i.0 = phi i32 [ 0, %if.end ], [ %inc6, %for.inc ] - %cmp = icmp ult i32 %i.0, 4 - br i1 %cmp, label %for.body, label %for.end - -for.body: - %mul = mul nsw i32 %i.0, %n - %rem = srem i32 %mul, 6 - %tobool2 = icmp eq i32 %rem, 0 - br i1 %tobool2, label %for.inc, label %if.then3 - -if.then3: - %2 = load i32, i32* @not_six, align 4 - %inc4 = add i32 %2, 1 - store i32 %inc4, i32* @not_six, align 4 - br label %for.inc - -for.inc: - %inc6 = add nuw nsw i32 %i.0, 1 - br label %for.cond - -for.end: - ret void -} -; PGOSUMMARY-LABEL: @bar -; PGOSUMMARY: %odd.sink = select i1 %tobool, i32* @even, i32* @odd -; PGOSUMMARY-SAME: !prof ![[BW_PGO_BAR:[0-9]+]] -; CSPGOSUMMARY-LABEL: @bar -; CSPGOSUMMARY: %odd.sink = select i1 %tobool, i32* @even, i32* @odd -; CSPGOSUMMARY-SAME: !prof ![[BW_CSPGO_BAR:[0-9]+]] - -define internal fastcc i32 @cond(i32 %i) { -entry: - %rem = srem i32 %i, 2 - ret i32 %rem -} - -define dso_local void @foo() { -entry: - br label %for.cond - -for.cond: - %i.0 = phi i32 [ 0, %entry ], [ %add4, %for.body ] - %cmp = icmp slt i32 %i.0, 200000 - br i1 %cmp, label %for.body, label %for.end - -for.body: - %call = call i32 @goo(i32 %i.0) - call void @bar(i32 %call) - %add = add nsw i32 %call, 1 - call void @bar(i32 %add) - %call1 = call i32 @bar_m(i32 %call) #4 - %call3 = call i32 @bar_m2(i32 %add) #4 - call fastcc void @barbar() - %add4 = add nsw i32 %call, 2 - br label %for.cond - -for.end: - ret void -} -; CSPGOSUMMARY-LABEL: @foo -; CSPGOSUMMARY: %even.sink{{[0-9]*}} = select i1 %tobool.i{{[0-9]*}}, i32* @even, i32* @odd -; CSPGOSUMMARY-SAME: !prof ![[BW1_CSPGO_FOO:[0-9]+]] -; CSPGOSUMMARY: %even.sink{{[0-9]*}} = select i1 %tobool.i{{[0-9]*}}, i32* @even, i32* @odd -; CSPGOSUMMARY-SAME: !prof ![[BW2_CSPGO_FOO:[0-9]+]] - -declare dso_local i32 @bar_m(i32) -declare dso_local i32 @bar_m2(i32) - -define internal fastcc void @barbar() { -entry: - %0 = load i32, i32* @odd, align 4 - %inc = add i32 %0, 1 - store i32 %inc, i32* @odd, align 4 - ret void -} - -define dso_local i32 @main() { -entry: - call void @foo() - ret i32 0 -} - -; PGOSUMMARY: {{![0-9]+}} = !{i32 1, !"ProfileSummary", !{{[0-9]+}}} -; PGOSUMMARY: {{![0-9]+}} = !{!"ProfileFormat", !"InstrProf"} -; PGOSUMMARY: {{![0-9]+}} = !{!"TotalCount", i64 2100001} -; PGOSUMMARY: {{![0-9]+}} = !{!"MaxCount", i64 800000} -; PGOSUMMARY: {{![0-9]+}} = !{!"MaxInternalCount", i64 399999} -; PGOSUMMARY: {{![0-9]+}} = !{!"MaxFunctionCount", i64 800000} -; PGOSUMMARY: {{![0-9]+}} = !{!"NumCounts", i64 14} -; PGOSUMMARY: {{![0-9]+}} = !{!"NumFunctions", i64 8} -; PGOSUMMARY-DAG: ![[BW_PGO_BAR]] = !{!"branch_weights", i32 100000, i32 100000} - -; CSPGOSUMMARY: {{![0-9]+}} = !{i32 1, !"ProfileSummary", !1} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"ProfileFormat", !"InstrProf"} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"TotalCount", i64 2100001} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"MaxCount", i64 800000} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"MaxInternalCount", i64 399999} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"MaxFunctionCount", i64 800000} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"NumCounts", i64 14} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"NumFunctions", i64 8} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"DetailedSummary", !10} -; CSPGOSUMMARY: {{![0-9]+}} = !{i32 1, !"CSProfileSummary", !{{[0-9]+}}} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"ProfileFormat", !"CSInstrProf"} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"TotalCount", i64 1299950} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"MaxCount", i64 200000} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"MaxInternalCount", i64 100000} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"MaxFunctionCount", i64 200000} -; CSPGOSUMMARY: {{![0-9]+}} = !{!"NumCounts", i64 23} -; CSPGOSUMMARY-DAG: ![[BW_CSPGO_BAR]] = !{!"branch_weights", i32 100000, i32 100000} -; CSPGOSUMMARY-DAG: ![[BW1_CSPGO_FOO]] = !{!"branch_weights", i32 100000, i32 0} -; CSPGOSUMMARY-DAG: ![[BW2_CSPGO_FOO]] = !{!"branch_weights", i32 0, i32 100000} diff --git a/llvm/test/Transforms/PGOProfile/diag_FE_profile.ll b/llvm/test/Transforms/PGOProfile/diag_FE_profile.ll deleted file mode 100644 index cd33954284f..00000000000 --- a/llvm/test/Transforms/PGOProfile/diag_FE_profile.ll +++ /dev/null @@ -1,13 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/diag_FE.proftext -o %t.profdata -; RUN: not opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s -; RUN: not opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s - -; CHECK: Not an IR level instrumentation profile - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @foo() { -entry: - ret i32 0 -} diff --git a/llvm/test/Transforms/PGOProfile/diag_mismatch.ll b/llvm/test/Transforms/PGOProfile/diag_mismatch.ll deleted file mode 100644 index e2b7f8cdcc5..00000000000 --- a/llvm/test/Transforms/PGOProfile/diag_mismatch.ll +++ /dev/null @@ -1,13 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/diag.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s - -; CHECK: Function control flow change detected (hash mismatch) foo - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @foo() { -entry: - ret i32 0 -} diff --git a/llvm/test/Transforms/PGOProfile/diag_no_funcprofdata.ll b/llvm/test/Transforms/PGOProfile/diag_no_funcprofdata.ll deleted file mode 100644 index 61c1f7ab6d1..00000000000 --- a/llvm/test/Transforms/PGOProfile/diag_no_funcprofdata.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/diag.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-warn-missing-function=true -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s -; RUN: opt < %s -passes=pgo-instr-use -pgo-warn-missing-function=true -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s - -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DEFAULT -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DEFAULT - -; CHECK: No profile data available for function bar -; DEFAULT-NOT: No profile data available for function bar - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @bar() { -entry: - ret i32 0 -} diff --git a/llvm/test/Transforms/PGOProfile/diag_no_profile.ll b/llvm/test/Transforms/PGOProfile/diag_no_profile.ll deleted file mode 100644 index 222d9bd0986..00000000000 --- a/llvm/test/Transforms/PGOProfile/diag_no_profile.ll +++ /dev/null @@ -1,10 +0,0 @@ -; RUN: not opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 -; RUN: not opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @foo() { -entry: - ret i32 0 -} diff --git a/llvm/test/Transforms/PGOProfile/do-not-instrument.ll b/llvm/test/Transforms/PGOProfile/do-not-instrument.ll deleted file mode 100644 index 616e9427375..00000000000 --- a/llvm/test/Transforms/PGOProfile/do-not-instrument.ll +++ /dev/null @@ -1,28 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s - -target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.12.0" - -define i32 @f1() { -; CHECK-LABEL: @f1 -entry: -; CHECK: call void @llvm.instrprof.increment -; CHECK-NOT: ptrtoint void (i8*)* asm sideeffect -; CHECK-NOT: call void @llvm.instrprof.value.profile -; CHECK: tail call void asm sideeffect - tail call void asm sideeffect "", "imr,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* undef) #0 - ret i32 0 -} - -define i32 @f2() { -entry: -; CHECK: call void @llvm.instrprof.increment -; CHECK-NOT: call void @llvm.instrprof.value.profile - call void (i32, ...) bitcast (void (...)* @foo to void (i32, ...)*)(i32 21) - ret i32 0 -} - -declare void @foo(...) #0 - -attributes #0 = { nounwind } diff --git a/llvm/test/Transforms/PGOProfile/func_entry.ll b/llvm/test/Transforms/PGOProfile/func_entry.ll deleted file mode 100644 index dac996e35cb..00000000000 --- a/llvm/test/Transforms/PGOProfile/func_entry.ll +++ /dev/null @@ -1,29 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/func_entry.proftext -o %t.profdata -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@s = common dso_local local_unnamed_addr global i32 0, align 4 - -define void @bar() { -; CHECK-LABEL: @bar -; CHECK-SAME: !prof ![[FUNC_ENTRY_COUNT_ZERO:[0-9]+]] - -entry: - store i32 1, i32* @s, align 4 - ret void -} - -define void @foo() { -; CHECK-LABEL: @foo -; CHECK-SAME: !prof ![[FUNC_ENTRY_COUNT_NON_ZERO:[0-9]+]] -entry: - %0 = load i32, i32* @s, align 4 - %add = add nsw i32 %0, 4 - store i32 %add, i32* @s, align 4 - ret void -} - -; CHECK-DAG: ![[FUNC_ENTRY_COUNT_ZERO]] = !{!"function_entry_count", i64 0} -; CHECK-DAG: ![[FUNC_ENTRY_COUNT_NON_ZERO]] = !{!"function_entry_count", i64 9999} diff --git a/llvm/test/Transforms/PGOProfile/icp_covariant_call_return.ll b/llvm/test/Transforms/PGOProfile/icp_covariant_call_return.ll deleted file mode 100644 index aba075461de..00000000000 --- a/llvm/test/Transforms/PGOProfile/icp_covariant_call_return.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM -; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -%struct.D = type { %struct.B } -%struct.B = type { i32 (...)** } -%struct.Base = type { i8 } -%struct.Derived = type { i8 } - -declare noalias i8* @_Znwm(i64) -declare void @_ZN1DC2Ev(%struct.D*); -declare %struct.Derived* @_ZN1D4funcEv(%struct.D*); - -define %struct.Base* @bar() { -entry: - %call = call noalias i8* @_Znwm(i64 8) - %tmp = bitcast i8* %call to %struct.D* - call void @_ZN1DC2Ev(%struct.D* %tmp) - %tmp1 = bitcast %struct.D* %tmp to %struct.B* - %tmp2 = bitcast %struct.B* %tmp1 to %struct.Base* (%struct.B*)*** - %vtable = load %struct.Base* (%struct.B*)**, %struct.Base* (%struct.B*)*** %tmp2, align 8 - %vfn = getelementptr inbounds %struct.Base* (%struct.B*)*, %struct.Base* (%struct.B*)** %vtable, i64 0 - %tmp3 = load %struct.Base* (%struct.B*)*, %struct.Base* (%struct.B*)** %vfn, align 8 -; ICALL-PROM: [[CMP:%[0-9]+]] = icmp eq %struct.Base* (%struct.B*)* %tmp3, bitcast (%struct.Derived* (%struct.D*)* @_ZN1D4funcEv to %struct.Base* (%struct.B*)*) -; ICALL-PROM: br i1 [[CMP]], label %if.true.direct_targ, label %if.false.orig_indirect, !prof [[BRANCH_WEIGHT:![0-9]+]] -; ICALL-PROM:if.true.direct_targ: -; ICALL-PROM: [[ARG_BITCAST:%[0-9]+]] = bitcast %struct.B* %tmp1 to %struct.D* -; ICALL-PROM: [[DIRCALL_RET:%[0-9]+]] = call %struct.Derived* @_ZN1D4funcEv(%struct.D* [[ARG_BITCAST]]) -; ICALL-PROM: [[DIRCALL_RET_CAST:%[0-9]+]] = bitcast %struct.Derived* [[DIRCALL_RET]] to %struct.Base* -; ICALL-PROM: br label %if.end.icp -; ICALL-PROM:if.false.orig_indirect: -; ICALL-PROM: %call1 = call %struct.Base* %tmp3(%struct.B* %tmp1) -; ICALL-PROM: br label %if.end.icp -; ICALL-PROM:if.end.icp: -; ICALL-PROM: [[PHI_RET:%[0-9]+]] = phi %struct.Base* [ %call1, %if.false.orig_indirect ], [ [[DIRCALL_RET_CAST]], %if.true.direct_targ ] - %call1 = call %struct.Base* %tmp3(%struct.B* %tmp1), !prof !1 - ret %struct.Base* %call1 -} - -!1 = !{!"VP", i32 0, i64 12345, i64 -3913987384944532146, i64 12345} -; ICALL-PROM-NOT: !1 = !{!"VP", i32 0, i64 12345, i64 -3913987384944532146, i64 12345} -; ICALL-PROM: [[BRANCH_WEIGHT]] = !{!"branch_weights", i32 12345, i32 0} -; ICALL-PROM-NOT: !1 = !{!"VP", i32 0, i64 12345, i64 -3913987384944532146, i64 12345} diff --git a/llvm/test/Transforms/PGOProfile/icp_covariant_invoke_return.ll b/llvm/test/Transforms/PGOProfile/icp_covariant_invoke_return.ll deleted file mode 100644 index 0a4444783eb..00000000000 --- a/llvm/test/Transforms/PGOProfile/icp_covariant_invoke_return.ll +++ /dev/null @@ -1,112 +0,0 @@ -; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM -; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" -%struct.D = type { %struct.B } -%struct.B = type { i32 (...)** } -%struct.Derived = type { %struct.Base, i32 } -%struct.Base = type { i32 } - -@_ZTIi = external constant i8* -declare i8* @_Znwm(i64) -declare void @_ZN1DC2Ev(%struct.D*) -declare %struct.Derived* @_ZN1D4funcEv(%struct.D*) -declare void @_ZN1DD0Ev(%struct.D*) -declare void @_ZdlPv(i8*) -declare i32 @__gxx_personality_v0(...) -declare i32 @llvm.eh.typeid.for(i8*) -declare i8* @__cxa_begin_catch(i8*) -declare void @__cxa_end_catch() - - -define i32 @foo() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { -entry: - %call = invoke i8* @_Znwm(i64 8) - to label %invoke.cont unwind label %lpad - -invoke.cont: - %tmp = bitcast i8* %call to %struct.D* - call void @_ZN1DC2Ev(%struct.D* %tmp) - %tmp1 = bitcast %struct.D* %tmp to %struct.B* - %tmp2 = bitcast %struct.B* %tmp1 to %struct.Base* (%struct.B*)*** - %vtable = load %struct.Base* (%struct.B*)**, %struct.Base* (%struct.B*)*** %tmp2, align 8 - %vfn = getelementptr inbounds %struct.Base* (%struct.B*)*, %struct.Base* (%struct.B*)** %vtable, i64 0 - %tmp3 = load %struct.Base* (%struct.B*)*, %struct.Base* (%struct.B*)** %vfn, align 8 -; ICALL-PROM: [[CMP:%[0-9]+]] = icmp eq %struct.Base* (%struct.B*)* %tmp3, bitcast (%struct.Derived* (%struct.D*)* @_ZN1D4funcEv to %struct.Base* (%struct.B*)*) -; ICALL-PROM: br i1 [[CMP]], label %if.true.direct_targ, label %if.false.orig_indirect, !prof [[BRANCH_WEIGHT:![0-9]+]] -; ICALL-PROM:if.true.direct_targ: -; ICALL-PROM: [[ARG_BITCAST:%[0-9]+]] = bitcast %struct.B* %tmp1 to %struct.D* -; ICALL-PROM: [[DIRCALL_RET:%[0-9]+]] = invoke %struct.Derived* @_ZN1D4funcEv(%struct.D* [[ARG_BITCAST]]) -; ICALL-PROM: to label %if.true.direct_targ.if.end.icp_crit_edge unwind label %lpad -; ICALL-PROM:if.true.direct_targ.if.end.icp_crit_edge: -; ICALL-PROM: [[DIRCALL_RET_CAST:%[0-9]+]] = bitcast %struct.Derived* [[DIRCALL_RET]] to %struct.Base* -; ICALL-PROM: br label %if.end.icp -; ICALL-PROM:if.false.orig_indirect: -; ICAll-PROM: %call2 = invoke %struct.Base* %tmp3(%struct.B* %tmp1) -; ICAll-PROM: to label %invoke.cont1 unwind label %lpad -; ICALL-PROM:if.end.icp: -; ICALL-PROM: br label %invoke.cont1 - %call2 = invoke %struct.Base* %tmp3(%struct.B* %tmp1) - to label %invoke.cont1 unwind label %lpad, !prof !1 - -invoke.cont1: -; ICAll-PROM: [[PHI_RET:%[0-9]+]] = phi %struct.Base* [ %call2, %if.false.orig_indirect ], [ [[DIRCALL_RET_CAST]], %if.end.icp ] -; ICAll-PROM: %isnull = icmp eq %struct.Base* [[PHI_RET]], null - %isnull = icmp eq %struct.Base* %call2, null - br i1 %isnull, label %delete.end, label %delete.notnull - -delete.notnull: - %tmp4 = bitcast %struct.Base* %call2 to i8* - call void @_ZdlPv(i8* %tmp4) - br label %delete.end - -delete.end: - %isnull3 = icmp eq %struct.B* %tmp1, null - br i1 %isnull3, label %delete.end8, label %delete.notnull4 - -delete.notnull4: - %tmp5 = bitcast %struct.B* %tmp1 to void (%struct.B*)*** - %vtable5 = load void (%struct.B*)**, void (%struct.B*)*** %tmp5, align 8 - %vfn6 = getelementptr inbounds void (%struct.B*)*, void (%struct.B*)** %vtable5, i64 2 - %tmp6 = load void (%struct.B*)*, void (%struct.B*)** %vfn6, align 8 - invoke void %tmp6(%struct.B* %tmp1) - to label %invoke.cont7 unwind label %lpad - -invoke.cont7: - br label %delete.end8 - -delete.end8: - br label %try.cont - -lpad: - %tmp7 = landingpad { i8*, i32 } - catch i8* bitcast (i8** @_ZTIi to i8*) - %tmp8 = extractvalue { i8*, i32 } %tmp7, 0 - %tmp9 = extractvalue { i8*, i32 } %tmp7, 1 - br label %catch.dispatch - -catch.dispatch: - %tmp10 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) - %matches = icmp eq i32 %tmp9, %tmp10 - br i1 %matches, label %catch, label %eh.resume - -catch: - %tmp11 = call i8* @__cxa_begin_catch(i8* %tmp8) - %tmp12 = bitcast i8* %tmp11 to i32* - %tmp13 = load i32, i32* %tmp12, align 4 - call void @__cxa_end_catch() - br label %try.cont - -try.cont: - ret i32 0 - -eh.resume: - %lpad.val = insertvalue { i8*, i32 } undef, i8* %tmp8, 0 - %lpad.val11 = insertvalue { i8*, i32 } %lpad.val, i32 %tmp9, 1 - resume { i8*, i32 } %lpad.val11 -} - -!1 = !{!"VP", i32 0, i64 12345, i64 -3913987384944532146, i64 12345} -; ICALL-PROM-NOT: !1 = !{!"VP", i32 0, i64 12345, i64 -3913987384944532146, i64 12345} -; ICALL-PROM: [[BRANCH_WEIGHT]] = !{!"branch_weights", i32 12345, i32 0} -; ICALL-PROM-NOT: !1 = !{!"VP", i32 0, i64 12345, i64 -3913987384944532146, i64 12345} diff --git a/llvm/test/Transforms/PGOProfile/icp_invoke.ll b/llvm/test/Transforms/PGOProfile/icp_invoke.ll deleted file mode 100644 index 1cacc1bc1ac..00000000000 --- a/llvm/test/Transforms/PGOProfile/icp_invoke.ll +++ /dev/null @@ -1,106 +0,0 @@ -; RUN: opt < %s -icp-lto -pgo-icall-prom -S | FileCheck %s --check-prefix=ICP -; RUN: opt < %s -icp-lto -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICP -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@foo1 = global void ()* null, align 8 -@foo2 = global i32 ()* null, align 8 -@_ZTIi = external constant i8* - -define internal void @_ZL4bar1v() !PGOFuncName !0 { -entry: - ret void -} - -define internal i32 @_ZL4bar2v() !PGOFuncName !1 { -entry: - ret i32 100 -} - -define i32 @_Z3goov() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { -entry: - %tmp = load void ()*, void ()** @foo1, align 8 -; ICP: [[CMP_IC1:%[0-9]+]] = icmp eq void ()* %tmp, @_ZL4bar1v -; ICP: br i1 [[CMP_IC1]], label %[[TRUE_LABEL_IC1:.*]], label %[[FALSE_LABEL_IC1:.*]], !prof [[BRANCH_WEIGHT:![0-9]+]] -; ICP:[[TRUE_LABEL_IC1]]: -; ICP: invoke void @_ZL4bar1v() -; ICP: to label %[[DCALL_NORMAL_DEST_IC1:.*]] unwind label %lpad -; ICP:[[FALSE_LABEL_IC1]]: - invoke void %tmp() - to label %try.cont unwind label %lpad, !prof !2 - -; ICP:[[DCALL_NORMAL_DEST_IC1]]: -; ICP: br label %try.cont - -lpad: - %tmp1 = landingpad { i8*, i32 } - catch i8* bitcast (i8** @_ZTIi to i8*) - %tmp2 = extractvalue { i8*, i32 } %tmp1, 0 - %tmp3 = extractvalue { i8*, i32 } %tmp1, 1 - %tmp4 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) - %matches = icmp eq i32 %tmp3, %tmp4 - br i1 %matches, label %catch, label %eh.resume - -catch: - %tmp5 = tail call i8* @__cxa_begin_catch(i8* %tmp2) - tail call void @__cxa_end_catch() - br label %try.cont - -try.cont: - %tmp6 = load i32 ()*, i32 ()** @foo2, align 8 -; ICP: [[CMP_IC2:%[0-9]+]] = icmp eq i32 ()* %tmp6, @_ZL4bar2v -; ICP: br i1 [[CMP_IC2]], label %[[TRUE_LABEL_IC2:.*]], label %[[FALSE_LABEL_IC2:.*]], !prof [[BRANCH_WEIGHT:![0-9]+]] -; ICP:[[TRUE_LABEL_IC2]]: -; ICP: [[RESULT_IC2_0:%[0-9]+]] = invoke i32 @_ZL4bar2v() -; ICP: to label %[[MERGE_BB:.*]] unwind label %lpad1 -; ICP:[[FALSE_LABEL_IC2]]: -; ICP: [[RESULT_IC2_1:%.+]] = invoke i32 %tmp6() -; ICP: to label %[[MERGE_BB]] unwind label %lpad1 - %call = invoke i32 %tmp6() - to label %try.cont8 unwind label %lpad1, !prof !3 - -; ICP:[[MERGE_BB]]: -; ICP: [[MERGE_PHI:%.+]] = phi i32 [ [[RESULT_IC2_1]], %[[FALSE_LABEL_IC2]] ], [ [[RESULT_IC2_0]], %[[TRUE_LABEL_IC2]] ] -; ICP: br label %try.cont8 -lpad1: - %tmp7 = landingpad { i8*, i32 } - catch i8* bitcast (i8** @_ZTIi to i8*) - %tmp8 = extractvalue { i8*, i32 } %tmp7, 0 - %tmp9 = extractvalue { i8*, i32 } %tmp7, 1 - %tmp10 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) - %matches5 = icmp eq i32 %tmp9, %tmp10 - br i1 %matches5, label %catch6, label %eh.resume - -catch6: - %tmp11 = tail call i8* @__cxa_begin_catch(i8* %tmp8) - tail call void @__cxa_end_catch() - br label %try.cont8 - -try.cont8: - %i.0 = phi i32 [ undef, %catch6 ], [ %call, %try.cont ] -; ICP: %i.0 = phi i32 [ undef, %catch6 ], [ [[MERGE_PHI]], %[[MERGE_BB]] ] - ret i32 %i.0 - -eh.resume: - %ehselector.slot.0 = phi i32 [ %tmp9, %lpad1 ], [ %tmp3, %lpad ] - %exn.slot.0 = phi i8* [ %tmp8, %lpad1 ], [ %tmp2, %lpad ] - %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn.slot.0, 0 - %lpad.val11 = insertvalue { i8*, i32 } %lpad.val, i32 %ehselector.slot.0, 1 - resume { i8*, i32 } %lpad.val11 -} - -declare i32 @__gxx_personality_v0(...) - -declare i32 @llvm.eh.typeid.for(i8*) - -declare i8* @__cxa_begin_catch(i8*) - -declare void @__cxa_end_catch() - -!0 = !{!"invoke.ll:_ZL4bar1v"} -!1 = !{!"invoke.ll:_ZL4bar2v"} -!2 = !{!"VP", i32 0, i64 1, i64 -2732222848796217051, i64 1} -!3 = !{!"VP", i32 0, i64 1, i64 -6116256810522035449, i64 1} -; ICP-NOT !3 = !{!"VP", i32 0, i64 1, i64 -2732222848796217051, i64 1} -; ICP-NOT !4 = !{!"VP", i32 0, i64 1, i64 -6116256810522035449, i64 1} -; ICP: [[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 0} diff --git a/llvm/test/Transforms/PGOProfile/icp_invoke_nouse.ll b/llvm/test/Transforms/PGOProfile/icp_invoke_nouse.ll deleted file mode 100644 index 096d2e0f222..00000000000 --- a/llvm/test/Transforms/PGOProfile/icp_invoke_nouse.ll +++ /dev/null @@ -1,68 +0,0 @@ -; RUN: opt < %s -icp-lto -pgo-icall-prom -S | FileCheck %s --check-prefix=ICP -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@_ZTISt9exception = external constant i8* -@pfptr = global i32()* null, align 8 - -define internal i32 @_ZL4bar1v() !PGOFuncName !0 { -entry: - ret i32 100 -} - -; Function Attrs: uwtable -define i32 @_Z3fooi(i32 %x) local_unnamed_addr personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { -entry: - %tobool = icmp eq i32 %x, 0 - br i1 %tobool, label %if.end, label %cleanup - -if.end: ; preds = %entry - %fptr = load i32 ()*, i32 ()** @pfptr, align 8 -; ICP: [[CMP_IC1:%[0-9]+]] = icmp eq i32 ()* %fptr, @_ZL4bar1v -; ICP: br i1 [[CMP_IC1]], label %[[TRUE_LABEL_IC1:.*]], label %[[FALSE_LABEL_IC1:.*]], !prof [[BRANCH_WEIGHT:![0-9]+]] -; ICP:[[TRUE_LABEL_IC1]]: -; ICP: invoke i32 @_ZL4bar1v() -; ICP: to label %[[DCALL_NORMAL_DEST_IC1:.*]] unwind label %lpad -; ICP:[[FALSE_LABEL_IC1]]: - %call = invoke i32 %fptr() - to label %cleanup unwind label %lpad, !prof !1 - -; ICP:[[DCALL_NORMAL_DEST_IC1]]: -; ICP: br label %cleanup - -lpad: ; preds = %if.end - %0 = landingpad { i8*, i32 } - cleanup - catch i8* bitcast (i8** @_ZTISt9exception to i8*) - %1 = extractvalue { i8*, i32 } %0, 1 - %2 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTISt9exception to i8*)) - %matches = icmp eq i32 %1, %2 - br i1 %matches, label %catch, label %ehcleanup - -catch: ; preds = %lpad - %3 = extractvalue { i8*, i32 } %0, 0 - %4 = tail call i8* @__cxa_begin_catch(i8* %3) - tail call void @__cxa_end_catch() - br label %cleanup - -cleanup: ; preds = %catch, %if.end, %entry -; ICP-NOT: %[0-9]+ = phi - ret i32 0 - -ehcleanup: ; preds = %lpad - resume { i8*, i32 } %0 -} - -declare i32 @_Z3barv() local_unnamed_addr - -declare i32 @__gxx_personality_v0(...) - -; Function Attrs: nounwind readnone -declare i32 @llvm.eh.typeid.for(i8*) - -declare i8* @__cxa_begin_catch(i8*) local_unnamed_addr - -declare void @__cxa_end_catch() local_unnamed_addr - -!0 = !{!"invoke.ll:_ZL4bar1v"} -!1 = !{!"VP", i32 0, i64 10000, i64 -2732222848796217051, i64 10000} diff --git a/llvm/test/Transforms/PGOProfile/icp_mismatch_msg.ll b/llvm/test/Transforms/PGOProfile/icp_mismatch_msg.ll deleted file mode 100644 index 5484d221a35..00000000000 --- a/llvm/test/Transforms/PGOProfile/icp_mismatch_msg.ll +++ /dev/null @@ -1,40 +0,0 @@ -; RUN: opt < %s -pgo-icall-prom -pass-remarks-missed=pgo-icall-prom -S 2>& 1 | FileCheck %s -; RUN: opt < %s -passes=pgo-icall-prom -pass-remarks-missed=pgo-icall-prom -S 2>& 1 | FileCheck %s - -; CHECK: remark: <unknown>:0:0: Cannot promote indirect call to func4 with count of 1234: The number of arguments mismatch -; CHECK: remark: <unknown>:0:0: Cannot promote indirect call: target with md5sum{{.*}} not found -; CHECK: remark: <unknown>:0:0: Cannot promote indirect call to func2 with count of 7890: Return type mismatch - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@foo = common global i32 ()* null, align 8 -@foo2 = common global i32 ()* null, align 8 -@foo3 = common global i32 ()* null, align 8 - -define i32 @func4(i32 %i) { -entry: - ret i32 %i -} - -define void @func2() { -entry: - ret void -} - -define i32 @bar() { -entry: - %tmp = load i32 ()*, i32 ()** @foo, align 8 - %call = call i32 %tmp(), !prof !1 - %tmp2 = load i32 ()*, i32 ()** @foo2, align 8 - %call1 = call i32 %tmp2(), !prof !2 - %add = add nsw i32 %call1, %call - %tmp3 = load i32 ()*, i32 ()** @foo3, align 8 - %call2 = call i32 %tmp3(), !prof !3 - %add2 = add nsw i32 %add, %call2 - ret i32 %add2 -} - -!1 = !{!"VP", i32 0, i64 1801, i64 7651369219802541373, i64 1234, i64 -4377547752858689819, i64 567} -!2 = !{!"VP", i32 0, i64 3023, i64 -6929281286627296573, i64 2345, i64 -4377547752858689819, i64 678} -!3 = !{!"VP", i32 0, i64 7890, i64 -4377547752858689819, i64 7890} diff --git a/llvm/test/Transforms/PGOProfile/icp_sample.ll b/llvm/test/Transforms/PGOProfile/icp_sample.ll deleted file mode 100644 index 73922d7aa06..00000000000 --- a/llvm/test/Transforms/PGOProfile/icp_sample.ll +++ /dev/null @@ -1,44 +0,0 @@ -; RUN: opt -pgo-icall-prom -icp-samplepgo -S < %s | FileCheck %s - -define i32* @_Z3fooPi(i32* readnone returned) { - ret i32* %0 -} - -; CHECK-LABEL: _Z3barPFPiS_E -; CHECK: if.true.direct_targ -; CHECK: call i32* @_Z3fooPi -define i32* @_Z3barPFPiS_E(i32* (i32*)* nocapture) { - %2 = tail call i32* %0(i32* null), !prof !33 - ret i32* %2 -} - -!llvm.module.flags = !{!3} - -!3 = !{i32 1, !"ProfileSummary", !4} -!4 = !{!5, !6, !7, !8, !9, !10, !11, !12} -!5 = !{!"ProfileFormat", !"SampleProfile"} -!6 = !{!"TotalCount", i64 0} -!7 = !{!"MaxCount", i64 0} -!8 = !{!"MaxInternalCount", i64 0} -!9 = !{!"MaxFunctionCount", i64 0} -!10 = !{!"NumCounts", i64 1} -!11 = !{!"NumFunctions", i64 1} -!12 = !{!"DetailedSummary", !13} -!13 = !{!14, !15, !16, !17, !18, !19, !19, !20, !20, !21, !22, !23, !24, !25, !26, !27, !28, !29} -!14 = !{i32 10000, i64 0, i32 0} -!15 = !{i32 100000, i64 0, i32 0} -!16 = !{i32 200000, i64 0, i32 0} -!17 = !{i32 300000, i64 0, i32 0} -!18 = !{i32 400000, i64 0, i32 0} -!19 = !{i32 500000, i64 0, i32 0} -!20 = !{i32 600000, i64 0, i32 0} -!21 = !{i32 700000, i64 0, i32 0} -!22 = !{i32 800000, i64 0, i32 0} -!23 = !{i32 900000, i64 0, i32 0} -!24 = !{i32 950000, i64 0, i32 0} -!25 = !{i32 990000, i64 0, i32 0} -!26 = !{i32 999000, i64 0, i32 0} -!27 = !{i32 999900, i64 0, i32 0} -!28 = !{i32 999990, i64 0, i32 0} -!29 = !{i32 999999, i64 0, i32 0} -!33 = !{!"VP", i32 0, i64 100, i64 8400159624858369790, i64 100} diff --git a/llvm/test/Transforms/PGOProfile/icp_vararg.ll b/llvm/test/Transforms/PGOProfile/icp_vararg.ll deleted file mode 100644 index ec243470290..00000000000 --- a/llvm/test/Transforms/PGOProfile/icp_vararg.ll +++ /dev/null @@ -1,33 +0,0 @@ -; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM -; RUN: opt < %s -passes=pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@foo = common global i32 (i32, ...)* null, align 8 - -define i32 @va_func(i32 %num, ...) { -entry: - ret i32 0 -} - -define i32 @bar() #1 { -entry: - %tmp = load i32 (i32, ...)*, i32 (i32, ...)** @foo, align 8 -; ICALL-PROM: [[CMP:%[0-9]+]] = icmp eq i32 (i32, ...)* %tmp, @va_func -; ICALL-PROM: br i1 [[CMP]], label %if.true.direct_targ, label %if.false.orig_indirect, !prof [[BRANCH_WEIGHT:![0-9]+]] -; ICALL-PROM:if.true.direct_targ: -; ICALL-PROM: [[DIRCALL_RET:%[0-9]+]] = call i32 (i32, ...) @va_func(i32 3, i32 12, i32 22, i32 4) -; ICALL-PROM: br label %if.end.icp - %call = call i32 (i32, ...) %tmp(i32 3, i32 12, i32 22, i32 4), !prof !1 -; ICALL-PROM:if.false.orig_indirect: -; ICALL-PROM: %call = call i32 (i32, ...) %tmp(i32 3, i32 12, i32 22, i32 4) -; ICALL-PROM: br label %if.end.icp - ret i32 %call -; ICALL-PROM:if.end.icp: -; ICALL-PROM: [[PHI_RET:%[0-9]+]] = phi i32 [ %call, %if.false.orig_indirect ], [ [[DIRCALL_RET]], %if.true.direct_targ ] -; ICALL-PROM: ret i32 [[PHI_RET]] - -} - -!1 = !{!"VP", i32 0, i64 12345, i64 989055279648259519, i64 12345} -; ICALL-PROM: [[BRANCH_WEIGHT]] = !{!"branch_weights", i32 12345, i32 0} diff --git a/llvm/test/Transforms/PGOProfile/indirect_call_annotation.ll b/llvm/test/Transforms/PGOProfile/indirect_call_annotation.ll deleted file mode 100644 index 6f72a998784..00000000000 --- a/llvm/test/Transforms/PGOProfile/indirect_call_annotation.ll +++ /dev/null @@ -1,36 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/indirect_call.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=VP-ANNOTATION -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=VP-ANNOTATION -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@foo = common global i32 (i32)* null, align 8 - -define i32 @func1(i32 %x) { -entry: - ret i32 %x -} - -define i32 @func2(i32 %x) { -entry: - %add = add nsw i32 %x, 1 - ret i32 %add -} - -define i32 @func3(i32 %x) { -entry: - %add = add nsw i32 %x, 3 - ret i32 %add -} - -define i32 @bar(i32 %i) { -entry: - %tmp = load i32 (i32)*, i32 (i32)** @foo, align 8 - %call = call i32 %tmp(i32 %i) -; VP-ANNOTATION: %call = call i32 %tmp(i32 %i) -; VP-ANNOTATION-SAME: !prof ![[VP:[0-9]+]] -; VP-ANNOTATION: ![[VP]] = !{!"VP", i32 0, i64 140, i64 -4377547752858689819, i64 80, i64 -2545542355363006406, i64 40, i64 -6929281286627296573, i64 20} - ret i32 %call -} - - diff --git a/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll b/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll deleted file mode 100644 index e1f499c08a7..00000000000 --- a/llvm/test/Transforms/PGOProfile/indirect_call_profile.ll +++ /dev/null @@ -1,71 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen,instrprof -S | FileCheck %s --check-prefix=LOWER - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -$foo3 = comdat any - -@bar = external global void ()*, align 8 -; GEN: @__profn_foo = private constant [3 x i8] c"foo" - -define void @foo() { -entry: -; GEN: entry: -; GEN-NEXT: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 [[FOO_HASH:[0-9]+]], i32 1, i32 0) - %tmp = load void ()*, void ()** @bar, align 8 -; GEN: [[ICALL_TARGET:%[0-9]+]] = ptrtoint void ()* %tmp to i64 -; GEN-NEXT: call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 [[FOO_HASH]], i64 [[ICALL_TARGET]], i32 0, i32 0) - call void %tmp() - ret void -} - -@bar2 = global void ()* null, align 8 -@_ZTIi = external constant i8* - -define i32 @foo2(i32 %arg, i8** nocapture readnone %arg1) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { -bb: - %tmp2 = load void ()*, void ()** @bar2, align 8 - invoke void %tmp2() - to label %bb10 unwind label %bb2 -; GEN: [[ICALL_TARGET2:%[0-9]+]] = ptrtoint void ()* %tmp2 to i64 -; GEN-NEXT: call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__profn_foo2, i32 0, i32 0), i64 [[FOO2_HASH:[0-9]+]], i64 [[ICALL_TARGET2]], i32 0, i32 0) - -bb2: ; preds = %bb - %tmp3 = landingpad { i8*, i32 } - catch i8* bitcast (i8** @_ZTIi to i8*) - %tmp4 = extractvalue { i8*, i32 } %tmp3, 1 - %tmp5 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) - %tmp6 = icmp eq i32 %tmp4, %tmp5 - br i1 %tmp6, label %bb7, label %bb11 - -bb7: ; preds = %bb2 - %tmp8 = extractvalue { i8*, i32 } %tmp3, 0 - %tmp9 = tail call i8* @__cxa_begin_catch(i8* %tmp8) - tail call void @__cxa_end_catch() - br label %bb10 - -bb10: ; preds = %bb7, %bb - ret i32 0 - -bb11: ; preds = %bb2 - resume { i8*, i32 } %tmp3 -} - -; Test that comdat function's address is recorded. -; LOWER: @__profd_foo3.[[FOO3_HASH:[0-9]+]] = linkonce_odr{{.*}}@__profc_foo3.[[FOO3_HASH]] -; Function Attrs: nounwind uwtable -define linkonce_odr i32 @foo3() comdat { - ret i32 1 -} - -declare i32 @__gxx_personality_v0(...) - -; Function Attrs: nounwind readnone -declare i32 @llvm.eh.typeid.for(i8*) #0 - -declare i8* @__cxa_begin_catch(i8*) - -declare void @__cxa_end_catch() - diff --git a/llvm/test/Transforms/PGOProfile/indirect_call_promotion.ll b/llvm/test/Transforms/PGOProfile/indirect_call_promotion.ll deleted file mode 100644 index 85df5260f19..00000000000 --- a/llvm/test/Transforms/PGOProfile/indirect_call_promotion.ll +++ /dev/null @@ -1,65 +0,0 @@ -; RUN: opt < %s -pgo-icall-prom -S -icp-total-percent-threshold=50 | FileCheck %s --check-prefix=ICALL-PROM -; RUN: opt < %s -pgo-icall-prom -S -icp-samplepgo -icp-total-percent-threshold=50 | FileCheck %s --check-prefix=ICALL-PROM -; RUN: opt < %s -passes=pgo-icall-prom -S -icp-total-percent-threshold=50 | FileCheck %s --check-prefix=ICALL-PROM -; RUN: opt < %s -pgo-icall-prom -S -pass-remarks=pgo-icall-prom -icp-remaining-percent-threshold=0 -icp-total-percent-threshold=0 -icp-max-prom=4 2>&1 | FileCheck %s --check-prefix=PASS-REMARK -; RUN: opt < %s -passes=pgo-icall-prom -S -pass-remarks=pgo-icall-prom -icp-remaining-percent-threshold=0 -icp-total-percent-threshold=0 -icp-max-prom=4 2>&1 | FileCheck %s --check-prefix=PASS-REMARK -; RUN: opt < %s -passes=pgo-icall-prom -S -pass-remarks=pgo-icall-prom -icp-remaining-percent-threshold=0 -icp-total-percent-threshold=20 -icp-max-prom=4 2>&1 | FileCheck %s --check-prefix=PASS2-REMARK - -; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func4 with count 1030 out of 1600 -; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func2 with count 410 out of 570 -; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func3 with count 150 out of 160 -; PASS-REMARK: remark: <unknown>:0:0: Promote indirect call to func1 with count 10 out of 10 - -; PASS2-REMARK: remark: <unknown>:0:0: Promote indirect call to func4 with count 1030 out of 1600 -; PASS2-REMARK: remark: <unknown>:0:0: Promote indirect call to func2 with count 410 out of 570 -; PASS2-REMARK-NOT: remark: <unknown>:0:0: Promote indirect call to func3 -; PASS2-REMARK-NOT: remark: <unknown>:0:0: Promote indirect call to func1 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@foo = common global i32 ()* null, align 8 - -define i32 @func1() { -entry: - ret i32 0 -} - -define i32 @func2() { -entry: - ret i32 1 -} - -define i32 @func3() { -entry: - ret i32 2 -} - -define i32 @func4() { -entry: - ret i32 3 -} - -define i32 @bar() { -entry: - %tmp = load i32 ()*, i32 ()** @foo, align 8 -; ICALL-PROM: [[CMP:%[0-9]+]] = icmp eq i32 ()* %tmp, @func4 -; ICALL-PROM: br i1 [[CMP]], label %if.true.direct_targ, label %if.false.orig_indirect, !prof [[BRANCH_WEIGHT:![0-9]+]] -; ICALL-PROM: if.true.direct_targ: -; ICALL-PROM: [[DIRCALL_RET:%[0-9]+]] = call i32 @func4() -; ICALL-PROM-SAMPLEPGO: call i32 @func4(), !prof [[CALL_METADATA:![0-9]+]] -; ICALL-PROM: br label %if.end.icp - %call = call i32 %tmp(), !prof !1 -; ICALL-PROM: if.false.orig_indirect: -; ICALL-PROM: %call = call i32 %tmp(), !prof [[NEW_VP_METADATA:![0-9]+]] - ret i32 %call -; ICALL-PROM: if.end.icp: -; ICALL-PROM: [[PHI_RET:%[0-9]+]] = phi i32 [ %call, %if.false.orig_indirect ], [ [[DIRCALL_RET]], %if.true.direct_targ ] -; ICALL-PROM: ret i32 [[PHI_RET]] -} - -!1 = !{!"VP", i32 0, i64 1600, i64 7651369219802541373, i64 1030, i64 -4377547752858689819, i64 410, i64 -6929281286627296573, i64 150, i64 -2545542355363006406, i64 10} - -; ICALL-PROM: [[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1030, i32 570} -; ICALL-PROM: [[NEW_VP_METADATA]] = !{!"VP", i32 0, i64 570, i64 -4377547752858689819, i64 410} -; ICALL-PROM-SAMPLEPGO: [[CALL_METADATA]] = !{!"branch_weights", i32 1030} diff --git a/llvm/test/Transforms/PGOProfile/indirect_call_promotion_vla.ll b/llvm/test/Transforms/PGOProfile/indirect_call_promotion_vla.ll deleted file mode 100644 index 0065031d147..00000000000 --- a/llvm/test/Transforms/PGOProfile/indirect_call_promotion_vla.ll +++ /dev/null @@ -1,28 +0,0 @@ -; RUN: opt < %s -pgo-icall-prom -S | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -%struct.A = type { i8 } -%struct.B = type { i8 } -@foo = common global i32 (%struct.A*, ...)* null, align 8 - -define i32 @func1(%struct.B* %x, ...) { -entry: - ret i32 0 -} - -define i32 @bar(%struct.A* %x) { -entry: - %tmp = load i32 (%struct.A*, ...)*, i32 (%struct.A*, ...)** @foo, align 8 -; CHECK: [[CMP:%[0-9]+]] = icmp eq i32 (%struct.A*, ...)* %tmp, bitcast (i32 (%struct.B*, ...)* @func1 to i32 (%struct.A*, ...)*) -; CHECK: br i1 [[CMP]], label %if.true.direct_targ, label %if.false.orig_indirect, !prof [[BRANCH_WEIGHT:![0-9]+]] -; CHECK: if.true.direct_targ: -; CHECK: [[DIRCALL_RET:%[0-9]+]] = call i32 (%struct.B*, ...) @func1 -; CHECK: br label %if.end.icp - %call = call i32 (%struct.A*, ...) %tmp(%struct.A* %x, i32 0), !prof !1 - ret i32 %call -} - -; CHECK: [[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1500, i32 100} -!1 = !{!"VP", i32 0, i64 1600, i64 -2545542355363006406, i64 1500} diff --git a/llvm/test/Transforms/PGOProfile/indirectbr.ll b/llvm/test/Transforms/PGOProfile/indirectbr.ll deleted file mode 100644 index ce7261d39a9..00000000000 --- a/llvm/test/Transforms/PGOProfile/indirectbr.ll +++ /dev/null @@ -1,50 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/indirectbr.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; New PM -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | opt -S -analyze -branch-prob | FileCheck %s --check-prefix=BRANCHPROB - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@foo.table = internal unnamed_addr constant [3 x i8*] [i8* blockaddress(@foo, %return), i8* blockaddress(@foo, %label2), i8* blockaddress(@foo, %label3)], align 16 - -define i32 @foo(i32 %i) { -entry: - %cmp = icmp ult i32 %i, 3 - br i1 %cmp, label %if.then, label %return - -if.then: - %idxprom = zext i32 %i to i64 - %arrayidx = getelementptr inbounds [3 x i8*], [3 x i8*]* @foo.table, i64 0, i64 %idxprom - %0 = load i8*, i8** %arrayidx, align 8 - indirectbr i8* %0, [label %return, label %label2, label %label3] -; USE: indirectbr i8* %0, [label %return, label %label2, label %label3] -; USE-SAME: !prof ![[BW_INDBR:[0-9]+]] -; USE: ![[BW_INDBR]] = !{!"branch_weights", i32 63, i32 20, i32 5} - -label2: - br label %return - -label3: - br label %return - -return: - %retval.0 = phi i32 [ 3, %label3 ], [ 2, %label2 ], [ 0, %entry ], [ 1, %if.then ] - ret i32 %retval.0 -} - -; BRANCHPROB: Printing analysis 'Branch Probability Analysis' for function 'foo': -; BRANCHPROB:---- Branch Probabilities ---- -; BRANCHPROB: edge entry -> if.then probability is 0x37c32b17 / 0x80000000 = 43.56% -; BRANCHPROB: edge entry -> return.clone probability is 0x483cd4e9 / 0x80000000 = 56.44% -; BRANCHPROB: edge if.then -> return probability is 0x5ba2e8ba / 0x80000000 = 71.59% -; BRANCHPROB: edge if.then -> label2 probability is 0x1d1745d1 / 0x80000000 = 22.73% -; BRANCHPROB: edge if.then -> label3 probability is 0x0745d174 / 0x80000000 = 5.68% -; BRANCHPROB: edge label2 -> return.clone probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] -; BRANCHPROB: edge label3 -> return.clone probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] -; BRANCHPROB: edge return -> .split probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] -; BRANCHPROB: edge return.clone -> .split probability is 0x80000000 / 0x80000000 = 100.00% [HOT edge] - - - diff --git a/llvm/test/Transforms/PGOProfile/infinite_loop.ll b/llvm/test/Transforms/PGOProfile/infinite_loop.ll deleted file mode 100644 index 68e9873f092..00000000000 --- a/llvm/test/Transforms/PGOProfile/infinite_loop.ll +++ /dev/null @@ -1,21 +0,0 @@ -; RUN: opt < %s -instrprof -S -o - -do-counter-promotion=1 | FileCheck %s -; CHECK: store - -@__profn_foo = private constant [3 x i8] c"foo" - -define void @foo() { -entry: - br label %while.body - - while.body: ; preds = %entry, %while.body - call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 14813359968, i32 1, i32 0) - call void (...) @bar() #2 - br label %while.body -} - -declare void @bar(...) - -declare void @llvm.instrprof.increment(i8*, i64, i32, i32) #0 - -attributes #0 = { nounwind } - diff --git a/llvm/test/Transforms/PGOProfile/infinite_loop_gen.ll b/llvm/test/Transforms/PGOProfile/infinite_loop_gen.ll deleted file mode 100644 index 4c5cb483a5d..00000000000 --- a/llvm/test/Transforms/PGOProfile/infinite_loop_gen.ll +++ /dev/null @@ -1,17 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S -o - | FileCheck %s - -define void @foo() { -entry: - br label %while.body - ; CHECK: llvm.instrprof.increment - - while.body: ; preds = %entry, %while.body - ; CHECK: llvm.instrprof.increment - call void (...) @bar() #2 - br label %while.body -} - -declare void @bar(...) - -attributes #0 = { nounwind } - diff --git a/llvm/test/Transforms/PGOProfile/irreducible.ll b/llvm/test/Transforms/PGOProfile/irreducible.ll deleted file mode 100644 index 9394b724f7e..00000000000 --- a/llvm/test/Transforms/PGOProfile/irreducible.ll +++ /dev/null @@ -1,139 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/irreducible.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE - -; GEN: $__llvm_profile_raw_version = comdat any - -; Function Attrs: noinline norecurse nounwind readnone uwtable -define i32 @_Z11irreducibleii(i32 %iter_outer, i32 %iter_inner) local_unnamed_addr #0 { -entry: - %cmp24 = icmp sgt i32 %iter_outer, 0 - br i1 %cmp24, label %for.body, label %entry.for.cond.cleanup_crit_edge - -entry.for.cond.cleanup_crit_edge: ; preds = %entry - br label %for.cond.cleanup - -for.cond.cleanup: ; preds = %entry.for.cond.cleanup_crit_edge, %for.end - %sum.0.lcssa = phi i32 [ 0, %entry.for.cond.cleanup_crit_edge ], [ %sum.1, %for.end ] - ret i32 %sum.0.lcssa - -for.body: ; preds = %entry, %for.end - %k.026 = phi i32 [ %inc12, %for.end ], [ 0, %entry ] - %sum.025 = phi i32 [ %sum.1, %for.end ], [ 0, %entry ] - %rem23 = and i32 %k.026, 1 - %cmp1 = icmp eq i32 %rem23, 0 - br i1 %cmp1, label %entry8, label %for.cond2 - -for.cond2: ; preds = %for.body, %if.end9 - %sum.1 = phi i32 [ %add10, %if.end9 ], [ %sum.025, %for.body ] - %i.0 = phi i32 [ %inc, %if.end9 ], [ 0, %for.body ] - %cmp3 = icmp slt i32 %i.0, %iter_inner - br i1 %cmp3, label %for.body4, label %for.end -; USE: br i1 %cmp3, label %for.body4, label %for.end, !prof !{{[0-9]+}}, -; USE-SAME: !irr_loop ![[FOR_COND2_IRR_LOOP:[0-9]+]] - -for.body4: ; preds = %for.cond2 - %rem5 = srem i32 %k.026, 3 - %cmp6 = icmp eq i32 %rem5, 0 - br i1 %cmp6, label %entry8, label %if.end9 - -entry8: ; preds = %for.body4, %for.body - %sum.2 = phi i32 [ %sum.025, %for.body ], [ %sum.1, %for.body4 ] - %i.1 = phi i32 [ 0, %for.body ], [ %i.0, %for.body4 ] - %add = add nsw i32 %sum.2, 4 - br label %if.end9 -; USE: br label %if.end9, -; USE-SAME: !irr_loop ![[ENTRY8_IRR_LOOP:[0-9]+]] - -if.end9: ; preds = %entry8, %for.body4 - %sum.3 = phi i32 [ %add, %entry8 ], [ %sum.1, %for.body4 ] - %i.2 = phi i32 [ %i.1, %entry8 ], [ %i.0, %for.body4 ] - %add10 = add nsw i32 %sum.3, 1 - %inc = add nsw i32 %i.2, 1 - br label %for.cond2 -; USE: br label %for.cond2, -; USE-SAME: !irr_loop ![[IF_END9_IRR_LOOP:[0-9]+]] - -for.end: ; preds = %for.cond2 - %inc12 = add nuw nsw i32 %k.026, 1 - %exitcond = icmp eq i32 %inc12, %iter_outer - br i1 %exitcond, label %for.cond.cleanup, label %for.body -} - - - -@targets = local_unnamed_addr global [256 x i8*] zeroinitializer, align 16 -@tracing = local_unnamed_addr global i32 0, align 4 - -; Function Attrs: noinline norecurse nounwind uwtable -define i32 @_Z11irreduciblePh(i8* nocapture readonly %p) { -entry: - %0 = load i32, i32* @tracing, align 4 - %1 = trunc i32 %0 to i8 - %tobool = icmp eq i32 %0, 0 - br label %for.cond1 - -for.cond1: ; preds = %sw.default, %entry - br label %dispatch_op - -dispatch_op: ; preds = %sw.bb6, %for.cond1 - switch i8 %1, label %sw.default [ - i8 0, label %sw.bb - i8 1, label %dispatch_op.sw.bb6_crit_edge - i8 2, label %sw.bb15 - ] - -dispatch_op.sw.bb6_crit_edge: ; preds = %dispatch_op - br label %sw.bb6 - -sw.bb: ; preds = %indirectgoto, %dispatch_op - br label %exit - -TARGET_1: ; preds = %indirectgoto - br label %sw.bb6 -; USE: br label %sw.bb6, !irr_loop {{.*}} - -sw.bb6: ; preds = %TARGET_1, %dispatch_op.sw.bb6_crit_edge - br i1 %tobool, label %dispatch_op, label %if.then -; USE: br i1 %tobool, label %dispatch_op, label %if.then, !prof !{{[0-9]+}}, -; USE-SAME: !irr_loop ![[SW_BB6_IRR_LOOP:[0-9]+]] - -if.then: ; preds = %sw.bb6 - br label %indirectgoto - -TARGET_2: ; preds = %indirectgoto - br label %sw.bb15 -; USE: br label %sw.bb15, !irr_loop {{.*}} - -sw.bb15: ; preds = %TARGET_2, %dispatch_op - br i1 %tobool, label %if.then18, label %exit -; USE: br i1 %tobool, label %if.then18, label %exit, !prof !{{[0-9]+}}, -; USE-SAME: !irr_loop ![[SW_BB15_IRR_LOOP:[0-9]+]] - -if.then18: ; preds = %sw.bb15 - br label %indirectgoto - -unknown_op: ; preds = %indirectgoto - br label %sw.default - -sw.default: ; preds = %unknown_op, %dispatch_op - br label %for.cond1 - -exit: ; preds = %sw.bb15, %sw.bb - ret i32 0 - -indirectgoto: ; preds = %if.then18, %if.then - %idxprom21 = zext i32 %0 to i64 - %arrayidx22 = getelementptr inbounds [256 x i8*], [256 x i8*]* @targets, i64 0, i64 %idxprom21 - %target = load i8*, i8** %arrayidx22, align 8 - indirectbr i8* %target, [label %unknown_op, label %sw.bb, label %TARGET_1, label %TARGET_2] -; USE: indirectbr i8* %target, [label %unknown_op, label %sw.bb, label %TARGET_1, label %TARGET_2], !prof !{{[0-9]+}}, -; USE-SAME: !irr_loop ![[INDIRECTGOTO_IRR_LOOP:[0-9]+]] -} - -; USE: ![[FOR_COND2_IRR_LOOP]] = !{!"loop_header_weight", i64 1050} -; USE: ![[ENTRY8_IRR_LOOP]] = !{!"loop_header_weight", i64 373} -; USE: ![[IF_END9_IRR_LOOP]] = !{!"loop_header_weight", i64 1000} -; USE: ![[SW_BB6_IRR_LOOP]] = !{!"loop_header_weight", i64 501} -; USE: ![[SW_BB15_IRR_LOOP]] = !{!"loop_header_weight", i64 100} -; USE: ![[INDIRECTGOTO_IRR_LOOP]] = !{!"loop_header_weight", i64 400} diff --git a/llvm/test/Transforms/PGOProfile/landingpad.ll b/llvm/test/Transforms/PGOProfile/landingpad.ll deleted file mode 100644 index 3a1a3eb57b0..00000000000 --- a/llvm/test/Transforms/PGOProfile/landingpad.ll +++ /dev/null @@ -1,129 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: llvm-profdata merge %S/Inputs/landingpad.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@val = global i32 0, align 4 -@_ZTIi = external constant i8* -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat -; GEN: @__profn_bar = private constant [3 x i8] c"bar" -; GEN: @__profn_foo = private constant [3 x i8] c"foo" - -define i32 @bar(i32 %i) { -entry: -; GEN: entry: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_bar, i32 0, i32 0), i64 24868915205, i32 2, i32 0) - %rem = srem i32 %i, 3 - %tobool = icmp ne i32 %rem, 0 - br i1 %tobool, label %if.then, label %if.end -; USE: br i1 %tobool, label %if.then, label %if.end -; USE-SAME: !prof ![[BW_BAR_ENTRY:[0-9]+]] - -if.then: -; GEN: if.then: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_bar, i32 0, i32 0), i64 24868915205, i32 2, i32 1) - %exception = call i8* @__cxa_allocate_exception(i64 4) - %tmp = bitcast i8* %exception to i32* - store i32 %i, i32* %tmp, align 16 - call void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) - unreachable - -if.end: -; GEN: if.end: -; GEN-NOT: call void @llvm.instrprof.increment -; GEN: ret i32 - ret i32 0 -} - -declare i8* @__cxa_allocate_exception(i64) - -declare void @__cxa_throw(i8*, i8*, i8*) - -define i32 @foo(i32 %i) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { -entry: -; GEN: entry: -; GEN-NOT: call void @llvm.instrprof.increment - %rem = srem i32 %i, 2 - %tobool = icmp ne i32 %rem, 0 - br i1 %tobool, label %if.then, label %if.end -; USE: br i1 %tobool, label %if.then, label %if.end -; USE-SAME: !prof ![[BW_FOO_ENTRY:[0-9]+]] - -if.then: -; GEN: if.then: -; GEN-NOT: call void @llvm.instrprof.increment - %mul = mul nsw i32 %i, 7 - %call = invoke i32 @bar(i32 %mul) - to label %invoke.cont unwind label %lpad - -invoke.cont: -; GEN: invoke.cont: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 59130013419, i32 4, i32 1) - br label %if.end - -lpad: -; GEN: lpad: -; GEN-NOT: call void @llvm.instrprof.increment - %tmp = landingpad { i8*, i32 } - catch i8* bitcast (i8** @_ZTIi to i8*) - %tmp1 = extractvalue { i8*, i32 } %tmp, 0 - %tmp2 = extractvalue { i8*, i32 } %tmp, 1 - br label %catch.dispatch - -catch.dispatch: -; GEN: catch.dispatch: -; GEN-NOT: call void @llvm.instrprof.increment - %tmp3 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) - %matches = icmp eq i32 %tmp2, %tmp3 - br i1 %matches, label %catch, label %eh.resume -; USE: br i1 %matches, label %catch, label %eh.resume -; USE-SAME: !prof ![[BW_CATCH_DISPATCH:[0-9]+]] - -catch: -; GEN: catch: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 59130013419, i32 4, i32 2) - %tmp4 = call i8* @__cxa_begin_catch(i8* %tmp1) - %tmp5 = bitcast i8* %tmp4 to i32* - %tmp6 = load i32, i32* %tmp5, align 4 - %tmp7 = load i32, i32* @val, align 4 - %sub = sub nsw i32 %tmp7, %tmp6 - store i32 %sub, i32* @val, align 4 - call void @__cxa_end_catch() - br label %try.cont - -try.cont: -; GEN: try.cont: -; GEN-NOT: call void @llvm.instrprof.increment - ret i32 -1 - -if.end: -; GEN: if.end: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 59130013419, i32 4, i32 0) - %tmp8 = load i32, i32* @val, align 4 - %add = add nsw i32 %tmp8, %i - store i32 %add, i32* @val, align 4 - br label %try.cont - -eh.resume: -; GEN: eh.resume: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 59130013419, i32 4, i32 3) - %lpad.val = insertvalue { i8*, i32 } undef, i8* %tmp1, 0 - %lpad.val3 = insertvalue { i8*, i32 } %lpad.val, i32 %tmp2, 1 - resume { i8*, i32 } %lpad.val3 -} - -declare i32 @__gxx_personality_v0(...) - -declare i32 @llvm.eh.typeid.for(i8*) - -declare i8* @__cxa_begin_catch(i8*) - -declare void @__cxa_end_catch() - -; USE: ![[BW_BAR_ENTRY]] = !{!"branch_weights", i32 2, i32 1} -; USE: ![[BW_FOO_ENTRY]] = !{!"branch_weights", i32 3, i32 2} -; USE: ![[BW_CATCH_DISPATCH]] = !{!"branch_weights", i32 2, i32 0} diff --git a/llvm/test/Transforms/PGOProfile/large_count_remarks.ll b/llvm/test/Transforms/PGOProfile/large_count_remarks.ll deleted file mode 100644 index 15088c39663..00000000000 --- a/llvm/test/Transforms/PGOProfile/large_count_remarks.ll +++ /dev/null @@ -1,22 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/large_count_remarks.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -pass-remarks=pgo-instrumentation -pgo-emit-branch-prob -S 2>&1| FileCheck %s --check-prefix=ANALYSIS -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pass-remarks=pgo-instrumentation -pgo-emit-branch-prob -S 2>&1| FileCheck %s --check-prefix=ANALYSIS - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @test(i32 %i) { -entry: - %cmp = icmp sgt i32 %i, 0 - br i1 %cmp, label %if.then, label %if.end - -if.then: - %add = add nsw i32 %i, 2 - br label %if.end - -if.end: - %retv = phi i32 [ %add, %if.then ], [ %i, %entry ] - ret i32 %retv -} - -; ANALYSIS:remark: <unknown>:0:0: sgt_i32_Zero {{.*}}50.00% (total count : 40000000000) diff --git a/llvm/test/Transforms/PGOProfile/loop1.ll b/llvm/test/Transforms/PGOProfile/loop1.ll deleted file mode 100644 index dbc728a49bb..00000000000 --- a/llvm/test/Transforms/PGOProfile/loop1.ll +++ /dev/null @@ -1,47 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: llvm-profdata merge %S/Inputs/loop1.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat -; GEN: @__profn_test_simple_for = private constant [15 x i8] c"test_simple_for" - -define i32 @test_simple_for(i32 %n) { -entry: -; GEN: entry: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_simple_for, i32 0, i32 0), i64 34137660316, i32 2, i32 1) - br label %for.cond - -for.cond: -; GEN: for.cond: -; GEN-NOT: call void @llvm.instrprof.increment - %i = phi i32 [ 0, %entry ], [ %inc1, %for.inc ] - %sum = phi i32 [ 1, %entry ], [ %inc, %for.inc ] - %cmp = icmp slt i32 %i, %n - br i1 %cmp, label %for.body, label %for.end -; USE: br i1 %cmp, label %for.body, label %for.end -; USE-SAME: !prof ![[BW_FOR_COND:[0-9]+]] -; USE: ![[BW_FOR_COND]] = !{!"branch_weights", i32 96, i32 4} - -for.body: -; GEN: for.body: -; GEN-NOT: call void @llvm.instrprof.increment - %inc = add nsw i32 %sum, 1 - br label %for.inc - -for.inc: -; GEN: for.inc: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_simple_for, i32 0, i32 0), i64 34137660316, i32 2, i32 0) - %inc1 = add nsw i32 %i, 1 - br label %for.cond - -for.end: -; GEN: for.end: -; GEN-NOT: call void @llvm.instrprof.increment -; GEN: ret i32 - ret i32 %sum -} diff --git a/llvm/test/Transforms/PGOProfile/loop2.ll b/llvm/test/Transforms/PGOProfile/loop2.ll deleted file mode 100644 index 5a86f0299ad..00000000000 --- a/llvm/test/Transforms/PGOProfile/loop2.ll +++ /dev/null @@ -1,75 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: llvm-profdata merge %S/Inputs/loop2.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat -; GEN: @__profn_test_nested_for = private constant [15 x i8] c"test_nested_for" - -define i32 @test_nested_for(i32 %r, i32 %s) { -entry: -; GEN: entry: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 2) - br label %for.cond.outer - -for.cond.outer: -; GEN: for.cond.outer: -; GEN-NOT: call void @llvm.instrprof.increment - %i.0 = phi i32 [ 0, %entry ], [ %inc.2, %for.inc.outer ] - %sum.0 = phi i32 [ 1, %entry ], [ %sum.1, %for.inc.outer ] - %cmp = icmp slt i32 %i.0, %r - br i1 %cmp, label %for.body.outer, label %for.end.outer -; USE: br i1 %cmp, label %for.body.outer, label %for.end.outer -; USE-SAME: !prof ![[BW_FOR_COND_OUTER:[0-9]+]] - -for.body.outer: -; GEN: for.body.outer: -; GEN-NOT: call void @llvm.instrprof.increment - br label %for.cond.inner - -for.cond.inner: -; GEN: for.cond.inner: -; GEN-NOT: call void @llvm.instrprof.increment - %j.0 = phi i32 [ 0, %for.body.outer ], [ %inc.1, %for.inc.inner ] - %sum.1 = phi i32 [ %sum.0, %for.body.outer ], [ %inc, %for.inc.inner ] - %cmp2 = icmp slt i32 %j.0, %s - br i1 %cmp2, label %for.body.inner, label %for.end.inner -; USE: br i1 %cmp2, label %for.body.inner, label %for.end.inner -; USE-SAME: !prof ![[BW_FOR_COND_INNER:[0-9]+]] - -for.body.inner: -; GEN: for.body.inner: -; GEN-NOT: call void @llvm.instrprof.increment - %inc = add nsw i32 %sum.1, 1 - br label %for.inc.inner - -for.inc.inner: -; GEN: for.inc.inner: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 0) - %inc.1 = add nsw i32 %j.0, 1 - br label %for.cond.inner - -for.end.inner: -; GEN: for.end.inner: - br label %for.inc.outer - -for.inc.outer: -; GEN: for.inc.outer: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 1) - %inc.2 = add nsw i32 %i.0, 1 - br label %for.cond.outer - -for.end.outer: -; GEN: for.end.outer: -; GEN-NOT: call void @llvm.instrprof.increment -; GEN: ret i32 - ret i32 %sum.0 -} - -; USE-DAG: ![[BW_FOR_COND_OUTER]] = !{!"branch_weights", i32 10, i32 6} -; USE-DAG: ![[BW_FOR_COND_INNER]] = !{!"branch_weights", i32 33, i32 10} - diff --git a/llvm/test/Transforms/PGOProfile/memcpy.ll b/llvm/test/Transforms/PGOProfile/memcpy.ll deleted file mode 100644 index 0a6c44b4374..00000000000 --- a/llvm/test/Transforms/PGOProfile/memcpy.ll +++ /dev/null @@ -1,35 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -instrprof -S | FileCheck %s -; RUN: opt <%s -passes=pgo-instr-gen,instrprof -S | FileCheck %s -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define void @foo(i8* %dst, i8* %src, i32* %a, i32 %n) { -entry: - br label %for.cond - -for.cond: - %i.0 = phi i32 [ 0, %entry ], [ %add, %for.cond1 ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.cond1, label %for.end6 - -for.cond1: - %j.0 = phi i32 [ %inc, %for.body3 ], [ 0, %for.cond ] - %idx.ext = sext i32 %i.0 to i64 - %add.ptr = getelementptr inbounds i32, i32* %a, i64 %idx.ext - %0 = load i32, i32* %add.ptr, align 4 - %cmp2 = icmp slt i32 %j.0, %0 - %add = add nsw i32 %i.0, 1 - br i1 %cmp2, label %for.body3, label %for.cond - -for.body3: - %conv = sext i32 %add to i64 -; CHECK: call void @__llvm_profile_instrument_range(i64 %conv, i8* bitcast ({ i64, i64, i64*, i8*, i8*, i32, [2 x i16] }* @__profd_foo to i8*), i32 0, i64 0, i64 8, i64 8192) - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false) - %inc = add nsw i32 %j.0, 1 - br label %for.cond1 - -for.end6: - ret void -} - -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) diff --git a/llvm/test/Transforms/PGOProfile/memop_clone.ll b/llvm/test/Transforms/PGOProfile/memop_clone.ll deleted file mode 100644 index 292dc10b5e8..00000000000 --- a/llvm/test/Transforms/PGOProfile/memop_clone.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt < %s -pgo-memop-opt -verify-dom-info -S | FileCheck %s - -define i32 @test(i8* %a, i8* %b) !prof !1 { -; CHECK_LABEL: test -; CHECK: MemOP.Case.3: -; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* undef, i8* %a, i32 3, i1 false) -; CHECK: MemOP.Case.2: -; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* undef, i8* %a, i32 2, i1 false) -; CHECK: MemOP.Default: -; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* undef, i8* %a, i32 undef, i1 false) -; CHECK: MemOP.Case.33: -; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* undef, i8* %b, i64 3, i1 false) -; CHECK MemOP.Case.24: -; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* undef, i8* %b, i64 2, i1 false) -; CHECK: MemOP.Default2: -; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* undef, i8* %b, i64 undef, i1 false) - tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* undef, i8* %a, i32 undef, i1 false), !prof !2 - tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* undef, i8* %b, i64 undef, i1 false), !prof !2 - unreachable -} - -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1) -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) - -!1 = !{!"function_entry_count", i64 5170} -!2 = !{!"VP", i32 1, i64 2585, i64 3, i64 1802, i64 2, i64 783} - diff --git a/llvm/test/Transforms/PGOProfile/memop_size_annotation.ll b/llvm/test/Transforms/PGOProfile/memop_size_annotation.ll deleted file mode 100644 index 4310d8ec9de..00000000000 --- a/llvm/test/Transforms/PGOProfile/memop_size_annotation.ll +++ /dev/null @@ -1,59 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/memop_size_annotation.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -memop-max-annotations=9 -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION9 -; RUN: opt < %s -passes=pgo-instr-use -memop-max-annotations=9 -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION9 -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION4 -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION4 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define void @foo(i8* %dst, i8* %src, i32* %a, i32 %n) { -entry: - br label %for.cond - -for.cond: - %i.0 = phi i32 [ 0, %entry ], [ %inc5, %for.inc4 ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end6 - -for.body: - br label %for.cond1 - -for.cond1: - %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ] - %idx.ext = sext i32 %i.0 to i64 - %add.ptr = getelementptr inbounds i32, i32* %a, i64 %idx.ext - %0 = load i32, i32* %add.ptr, align 4 - %cmp2 = icmp slt i32 %j.0, %0 - br i1 %cmp2, label %for.body3, label %for.end - -for.body3: - %add = add nsw i32 %i.0, 1 - %conv = sext i32 %add to i64 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false) -; MEMOP_ANNOTATION: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false) -; MEMOP_ANNOTATION-SAME: !prof ![[MEMOP_VALUESITE:[0-9]+]] -; MEMOP_ANNOTATION9: ![[MEMOP_VALUESITE]] = !{!"VP", i32 1, i64 556, i64 1, i64 99, i64 2, i64 88, i64 3, i64 77, i64 9, i64 72, i64 4, i64 66, i64 5, i64 55, i64 6, i64 44, i64 7, i64 33, i64 8, i64 22} -; MEMOP_ANNOTATION4: ![[MEMOP_VALUESITE]] = !{!"VP", i32 1, i64 556, i64 1, i64 99, i64 2, i64 88, i64 3, i64 77, i64 9, i64 72} - br label %for.inc - -for.inc: - %inc = add nsw i32 %j.0, 1 - br label %for.cond1 - -for.end: - br label %for.inc4 - -for.inc4: - %inc5 = add nsw i32 %i.0, 1 - br label %for.cond - -for.end6: - ret void -} - -declare void @llvm.lifetime.start(i64, i8* nocapture) - -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) - -declare void @llvm.lifetime.end(i64, i8* nocapture) diff --git a/llvm/test/Transforms/PGOProfile/memop_size_from_strlen.ll b/llvm/test/Transforms/PGOProfile/memop_size_from_strlen.ll deleted file mode 100644 index 1d8509a0b0b..00000000000 --- a/llvm/test/Transforms/PGOProfile/memop_size_from_strlen.ll +++ /dev/null @@ -1,14 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s - -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i1) -declare i32 @strlen(i8* nocapture) - -; CHECK_LABEL: test -; CHECK: %1 = zext i32 %c to i64 -; CHECK: call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__profn_test, i32 0, i32 0), i64 12884901887, i64 %1, i32 1, i32 0) - -define void @test(i8* %a, i8* %p) { - %c = call i32 @strlen(i8* %p) - call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %p, i32 %c, i1 false) - ret void -} diff --git a/llvm/test/Transforms/PGOProfile/memop_size_opt.ll b/llvm/test/Transforms/PGOProfile/memop_size_opt.ll deleted file mode 100644 index 69cdd81ddf7..00000000000 --- a/llvm/test/Transforms/PGOProfile/memop_size_opt.ll +++ /dev/null @@ -1,154 +0,0 @@ -; RUN: opt < %s -pgo-memop-opt -verify-dom-info -pgo-memop-count-threshold=90 -pgo-memop-percent-threshold=15 -S | FileCheck %s --check-prefix=MEMOP_OPT -; RUN: opt < %s -passes=pgo-memop-opt -verify-dom-info -pgo-memop-count-threshold=90 -pgo-memop-percent-threshold=15 -S | FileCheck %s --check-prefix=MEMOP_OPT -; RUN: opt < %s -pgo-memop-opt -verify-dom-info -pgo-memop-count-threshold=90 -pgo-memop-percent-threshold=15 -pass-remarks-with-hotness -pass-remarks-output=%t.opt.yaml -S | FileCheck %s --check-prefix=MEMOP_OPT -; RUN: FileCheck %s -input-file=%t.opt.yaml --check-prefix=YAML -; RUN: opt < %s -passes=pgo-memop-opt -verify-dom-info -pgo-memop-count-threshold=90 -pgo-memop-percent-threshold=15 -pass-remarks-with-hotness -pass-remarks-output=%t.opt.yaml -S | FileCheck %s --check-prefix=MEMOP_OPT -; RUN: FileCheck %s -input-file=%t.opt.yaml --check-prefix=YAML - - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define void @foo(i8* %dst, i8* %src, i8* %dst2, i8* %src2, i32* %a, i32 %n) !prof !27 { -entry: - br label %for.cond - -for.cond: - %i.0 = phi i32 [ 0, %entry ], [ %inc5, %for.inc4 ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end6, !prof !28 - -for.body: - br label %for.cond1 - -for.cond1: - %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ] - %idx.ext = sext i32 %i.0 to i64 - %add.ptr = getelementptr inbounds i32, i32* %a, i64 %idx.ext - %0 = load i32, i32* %add.ptr, align 4 - %cmp2 = icmp slt i32 %j.0, %0 - br i1 %cmp2, label %for.body3, label %for.end, !prof !29 - -for.body3: - %add = add nsw i32 %i.0, 1 - %conv = sext i32 %add to i64 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false), !prof !30 - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %src2, i64 %conv, i1 false), !prof !31 - br label %for.inc - -; MEMOP_OPT: switch i64 %conv, label %[[DEFAULT_LABEL:.*]] [ -; MEMOP_OPT: i64 1, label %[[CASE_1_LABEL:.*]] -; MEMOP_OPT: ], !prof [[SWITCH_BW:![0-9]+]] -; MEMOP_OPT: [[CASE_1_LABEL]]: -; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 1, i1 false) -; MEMOP_OPT: br label %[[MERGE_LABEL:.*]] -; MEMOP_OPT: [[DEFAULT_LABEL]]: -; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false), !prof [[NEWVP:![0-9]+]] -; MEMOP_OPT: br label %[[MERGE_LABEL]] -; MEMOP_OPT: [[MERGE_LABEL]]: -; MEMOP_OPT: switch i64 %conv, label %[[DEFAULT_LABEL2:.*]] [ -; MEMOP_OPT: i64 1, label %[[CASE_1_LABEL2:.*]] -; MEMOP_OPT: ], !prof [[SWITCH_BW:![0-9]+]] -; MEMOP_OPT: [[CASE_1_LABEL2]]: -; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %src2, i64 1, i1 false) -; MEMOP_OPT: br label %[[MERGE_LABEL2:.*]] -; MEMOP_OPT: [[DEFAULT_LABEL2]]: -; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst2, i8* %src2, i64 %conv, i1 false), !prof [[NEWVP]] -; MEMOP_OPT: br label %[[MERGE_LABEL2]] -; MEMOP_OPT: [[MERGE_LABEL2]]: -; MEMOP_OPT: br label %for.inc -; MEMOP_OPT: [[SWITCH_BW]] = !{!"branch_weights", i32 457, i32 99} -; Should be 457 total left (original total count 556, minus 99 from specialized -; value 1, which is removed from VP array. Also, we only end up with 5 total -; values, since the default max number of promotions is 5 and therefore -; the rest of the values are ignored when extracting the VP metadata. -; MEMOP_OPT: [[NEWVP]] = !{!"VP", i32 1, i64 457, i64 2, i64 88, i64 3, i64 77, i64 9, i64 72, i64 4, i64 66} - -for.inc: - %inc = add nsw i32 %j.0, 1 - br label %for.cond1 - -for.end: - br label %for.inc4 - -for.inc4: - %inc5 = add nsw i32 %i.0, 1 - br label %for.cond - -for.end6: - ret void -} - -!llvm.module.flags = !{!0} - -!0 = !{i32 1, !"ProfileSummary", !1} -!1 = !{!2, !3, !4, !5, !6, !7, !8, !9} -!2 = !{!"ProfileFormat", !"InstrProf"} -!3 = !{!"TotalCount", i64 579} -!4 = !{!"MaxCount", i64 556} -!5 = !{!"MaxInternalCount", i64 20} -!6 = !{!"MaxFunctionCount", i64 556} -!7 = !{!"NumCounts", i64 6} -!8 = !{!"NumFunctions", i64 3} -!9 = !{!"DetailedSummary", !10} -!10 = !{!11, !12, !13, !14, !15, !16, !16, !17, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26} -!11 = !{i32 10000, i64 556, i32 1} -!12 = !{i32 100000, i64 556, i32 1} -!13 = !{i32 200000, i64 556, i32 1} -!14 = !{i32 300000, i64 556, i32 1} -!15 = !{i32 400000, i64 556, i32 1} -!16 = !{i32 500000, i64 556, i32 1} -!17 = !{i32 600000, i64 556, i32 1} -!18 = !{i32 700000, i64 556, i32 1} -!19 = !{i32 800000, i64 556, i32 1} -!20 = !{i32 900000, i64 556, i32 1} -!21 = !{i32 950000, i64 556, i32 1} -!22 = !{i32 990000, i64 20, i32 2} -!23 = !{i32 999000, i64 1, i32 5} -!24 = !{i32 999900, i64 1, i32 5} -!25 = !{i32 999990, i64 1, i32 5} -!26 = !{i32 999999, i64 1, i32 5} -!27 = !{!"function_entry_count", i64 1} -!28 = !{!"branch_weights", i32 20, i32 1} -!29 = !{!"branch_weights", i32 556, i32 20} -!30 = !{!"VP", i32 1, i64 556, i64 1, i64 99, i64 2, i64 88, i64 3, i64 77, i64 9, i64 72, i64 4, i64 66, i64 5, i64 55, i64 6, i64 44, i64 7, i64 33, i64 8, i64 22} -!31 = !{!"VP", i32 1, i64 556, i64 1, i64 99, i64 2, i64 88, i64 3, i64 77, i64 9, i64 72, i64 4, i64 66, i64 5, i64 55, i64 6, i64 44, i64 7, i64 33, i64 8, i64 22} - -declare void @llvm.lifetime.start(i64, i8* nocapture) - -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) - -declare void @llvm.lifetime.end(i64, i8* nocapture) - -; YAML: --- !Passed -; YAML-NEXT: Pass: pgo-memop-opt -; YAML-NEXT: Name: memopt-opt -; YAML-NEXT: Function: foo -; YAML-NEXT: Hotness: 0 -; YAML-NEXT: Args: -; YAML-NEXT: - String: 'optimized ' -; YAML-NEXT: - Intrinsic: memcpy -; YAML-NEXT: - String: ' with count ' -; YAML-NEXT: - Count: '99' -; YAML-NEXT: - String: ' out of ' -; YAML-NEXT: - Total: '556' -; YAML-NEXT: - String: ' for ' -; YAML-NEXT: - Versions: '1' -; YAML-NEXT: - String: ' versions' -; YAML-NEXT: ... -; YAML-NEXT: --- !Passed -; YAML-NEXT: Pass: pgo-memop-opt -; YAML-NEXT: Name: memopt-opt -; YAML-NEXT: Function: foo -; YAML-NEXT: Hotness: 0 -; YAML-NEXT: Args: -; YAML-NEXT: - String: 'optimized ' -; YAML-NEXT: - Intrinsic: memcpy -; YAML-NEXT: - String: ' with count ' -; YAML-NEXT: - Count: '99' -; YAML-NEXT: - String: ' out of ' -; YAML-NEXT: - Total: '556' -; YAML-NEXT: - String: ' for ' -; YAML-NEXT: - Versions: '1' -; YAML-NEXT: - String: ' versions' -; YAML-NEXT: ... diff --git a/llvm/test/Transforms/PGOProfile/memop_size_opt_zero.ll b/llvm/test/Transforms/PGOProfile/memop_size_opt_zero.ll deleted file mode 100644 index 43ca710534e..00000000000 --- a/llvm/test/Transforms/PGOProfile/memop_size_opt_zero.ll +++ /dev/null @@ -1,19 +0,0 @@ -; Test to ensure the pgo memop optimization pass doesn't try to scale -; up a value profile with a 0 count, which would lead to divide by 0. -; RUN: opt < %s -passes=pgo-memop-opt -verify-dom-info -pgo-memop-count-threshold=1 -S | FileCheck %s --check-prefix=MEMOP_OPT -; RUN: opt < %s -pgo-memop-opt -verify-dom-info -pgo-memop-count-threshold=1 -S | FileCheck %s --check-prefix=MEMOP_OPT - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define void @foo(i8* %dst, i8* %src, i64 %conv) !prof !0 { - call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false), !prof !1 - ret void -} - -; MEMOP_OPT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dst, i8* %src, i64 %conv, i1 false), !prof !1 - -!0 = !{!"function_entry_count", i64 1} -!1 = !{!"VP", i32 1, i64 0, i64 1, i64 0, i64 2, i64 0, i64 3, i64 0, i64 9, i64 0, i64 4, i64 0, i64 5, i64 0, i64 6, i64 0, i64 7, i64 0, i64 8, i64 0} - -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1) diff --git a/llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll b/llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll deleted file mode 100644 index 6da94826a95..00000000000 --- a/llvm/test/Transforms/PGOProfile/multiple_hash_profile.ll +++ /dev/null @@ -1,36 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/multiple_hash_profile.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -$_Z3fooi = comdat any - -@g2 = local_unnamed_addr global i32 (i32)* null, align 8 - -define i32 @_Z3bari(i32 %i) { -entry: - %cmp = icmp sgt i32 %i, 2 - %mul = select i1 %cmp, i32 1, i32 %i - %retval.0 = mul nsw i32 %mul, %i - ret i32 %retval.0 -} - -define void @_Z4m2f1v() { -entry: - store i32 (i32)* @_Z3fooi, i32 (i32)** @g2, align 8 - ret void -} - -define linkonce_odr i32 @_Z3fooi(i32 %i) comdat { -entry: - %cmp.i = icmp sgt i32 %i, 2 - %mul.i = select i1 %cmp.i, i32 1, i32 %i -; CHECK: %mul.i = select i1 %cmp.i, i32 1, i32 %i -; CHECK-SAME: !prof ![[BW:[0-9]+]] -; CHECK: ![[BW]] = !{!"branch_weights", i32 12, i32 6} - %retval.0.i = mul nsw i32 %mul.i, %i - ret i32 %retval.0.i -} - - diff --git a/llvm/test/Transforms/PGOProfile/noreturncall.ll b/llvm/test/Transforms/PGOProfile/noreturncall.ll deleted file mode 100644 index c108a82abf0..00000000000 --- a/llvm/test/Transforms/PGOProfile/noreturncall.ll +++ /dev/null @@ -1,45 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/noreturncall.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; REQUIRES: asserts - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -declare i32 @bar0(i32) - -define i32 @bar2(i32 %i) { -entry: - unreachable -} - -define i32 @foo(i32 %i, i32 %j, i32 %k) { -entry: - %cmp = icmp slt i32 %i, 999 - br i1 %cmp, label %if.then, label %if.end -; USE: br i1 %cmp, label %if.then, label %if.end -; USE-SAME: !prof ![[BW_ENTRY:[0-9]+]] - -if.then: - %call = call i32 @bar0(i32 %i) - br label %if.end - -if.end: - %ret.0 = phi i32 [ %call, %if.then ], [ 0, %entry ] - %cmp1 = icmp sgt i32 %j, 1000 - %cmp3 = icmp sgt i32 %k, 99 - %or.cond = and i1 %cmp1, %cmp3 - br i1 %or.cond, label %if.then4, label %if.end7 -; USE: br i1 %or.cond, label %if.then4, label %if.end7 -; USE-SAME: !prof ![[BW_IF:[0-9]+]] - -if.then4: - %call5 = call i32 @bar2(i32 undef) - br label %if.end7 - -if.end7: - %mul = mul nsw i32 %ret.0, %ret.0 - ret i32 %mul -} -; USE: ![[BW_ENTRY]] = !{!"branch_weights", i32 21, i32 0} -; USE: ![[BW_IF]] = !{!"branch_weights", i32 0, i32 21} diff --git a/llvm/test/Transforms/PGOProfile/preinline.ll b/llvm/test/Transforms/PGOProfile/preinline.ll deleted file mode 100644 index 277baf99c33..00000000000 --- a/llvm/test/Transforms/PGOProfile/preinline.ll +++ /dev/null @@ -1,23 +0,0 @@ -; RUN: opt < %s -O2 -pgo-kind=pgo-instr-gen-pipeline -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -O2 -pgo-kind=pgo-instr-gen-pipeline -profile-file=default.profraw -S | FileCheck %s --check-prefix=GEN -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @foo(i32 %i) { -entry: -; GEN: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_foo -; GEN-NOT: %pgocount.i = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc__stdin__bar - %call = call i32 @bar() - %add = add nsw i32 %i, %call - ret i32 %add -} - -define internal i32 @bar() { -; check that bar is inlined into foo and eliminiated from IR. -; GEN-NOT: define internal i32 @bar -entry: - %call = call i32 (...) @bar1() - ret i32 %call -} - -declare i32 @bar1(...) diff --git a/llvm/test/Transforms/PGOProfile/remap.ll b/llvm/test/Transforms/PGOProfile/remap.ll deleted file mode 100644 index 2fdca9e33d1..00000000000 --- a/llvm/test/Transforms/PGOProfile/remap.ll +++ /dev/null @@ -1,28 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/remap.proftext -o %t.profdata -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-test-profile-remapping-file=%S/Inputs/remap.map -S | FileCheck %s --check-prefix=USE - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @_ZN3foo3barERKN1M1XINS_6detail3quxEEE(i32 %i) { -; USE-LABEL: @_ZN3foo3barERKN1M1XINS_6detail3quxEEE -; USE-SAME: !prof ![[FUNC_ENTRY_COUNT:[0-9]+]] -entry: - %cmp = icmp sgt i32 %i, 0 - br i1 %cmp, label %if.then, label %if.end -; USE: br i1 %cmp, label %if.then, label %if.end -; USE-SAME: !prof ![[BW_ENTRY:[0-9]+]] - -if.then: - %add = add nsw i32 %i, 2 - br label %if.end - -if.end: - %retv = phi i32 [ %add, %if.then ], [ %i, %entry ] - ret i32 %retv -} - -; USE-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}} -; USE-DAG: {{![0-9]+}} = !{!"DetailedSummary", {{![0-9]+}}} -; USE-DAG: ![[FUNC_ENTRY_COUNT]] = !{!"function_entry_count", i64 3} -; USE-DAG: ![[BW_ENTRY]] = !{!"branch_weights", i32 2, i32 1} diff --git a/llvm/test/Transforms/PGOProfile/select1.ll b/llvm/test/Transforms/PGOProfile/select1.ll deleted file mode 100644 index 34e30a23ab0..00000000000 --- a/llvm/test/Transforms/PGOProfile/select1.ll +++ /dev/null @@ -1,34 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -pgo-instr-select=true -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen -pgo-instr-select=true -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -pgo-instr-gen -pgo-instr-select=false -S | FileCheck %s --check-prefix=NOSELECT -; RUN: opt < %s -passes=pgo-instr-gen -pgo-instr-select=false -S | FileCheck %s --check-prefix=NOSELECT -; RUN: llvm-profdata merge %S/Inputs/select1.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-select=true -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-select=true -S | FileCheck %s --check-prefix=USE -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @test_br_2(i32 %i) { -entry: - %cmp = icmp sgt i32 %i, 0 - br i1 %cmp, label %if.then, label %if.else - -if.then: - %add = add nsw i32 %i, 2 -;GEN: %[[STEP:[0-9]+]] = zext i1 %cmp to i64 -;GEN: call void @llvm.instrprof.increment.step({{.*}} i32 3, i32 2, i64 %[[STEP]]) -;NOSELECT-NOT: call void @llvm.instrprof.increment.step - %s = select i1 %cmp, i32 %add, i32 0 -;USE: select i1 %cmp{{.*}}, !prof ![[BW_ENTRY:[0-9]+]] -;USE: ![[BW_ENTRY]] = !{!"branch_weights", i32 1, i32 3} - - br label %if.end - -if.else: - %sub = sub nsw i32 %i, 2 - br label %if.end - -if.end: - %retv = phi i32 [ %add, %if.then ], [ %sub, %if.else ] - ret i32 %retv -} diff --git a/llvm/test/Transforms/PGOProfile/select2.ll b/llvm/test/Transforms/PGOProfile/select2.ll deleted file mode 100644 index b19fa1ff798..00000000000 --- a/llvm/test/Transforms/PGOProfile/select2.ll +++ /dev/null @@ -1,37 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/select2.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-select=true -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-select=true -S | FileCheck %s --check-prefix=USE - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define i32 @foo(i32 %n) { -;USE: define i32 @foo(i32 %n) !prof ![[ENTRY_COUNT:[0-9]+]] { -entry: - br label %for.cond - -for.cond: - %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] - %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end -;USE: br i1 %cmp, label %for.body, label %for.end, !prof ![[BW_FOR_BR:[0-9]+]] - -for.body: - %cmp1 = icmp sgt i32 %sum.0, 10 - %cond = select i1 %cmp1, i32 20, i32 -10 -;USE: %cond = select i1 %cmp1, i32 20, i32 -10, !prof ![[BW_FOR_SELECT:[0-9]+]] - %add = add nsw i32 %sum.0, %cond - br label %for.inc - -for.inc: - %inc = add nsw i32 %i.0, 1 - br label %for.cond - -for.end: - ret i32 %sum.0 -} - -;USE: ![[ENTRY_COUNT]] = !{!"function_entry_count", i64 3} -;USE: ![[BW_FOR_BR]] = !{!"branch_weights", i32 800, i32 3} -;USE: ![[BW_FOR_SELECT]] = !{!"branch_weights", i32 300, i32 500} diff --git a/llvm/test/Transforms/PGOProfile/select_hash_conflict.ll b/llvm/test/Transforms/PGOProfile/select_hash_conflict.ll deleted file mode 100644 index e7c3cdb2184..00000000000 --- a/llvm/test/Transforms/PGOProfile/select_hash_conflict.ll +++ /dev/null @@ -1,97 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/select_hash_conflict.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-select=true -S | FileCheck %s -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-select=true -S | FileCheck %s - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@a = common dso_local local_unnamed_addr global [16 x i32] zeroinitializer, align 16 -@c0 = common dso_local local_unnamed_addr global i8 0, align 1 -@c1 = common dso_local local_unnamed_addr global i8 0, align 1 -@c2 = common dso_local local_unnamed_addr global i8 0, align 1 -@c3 = common dso_local local_unnamed_addr global i8 0, align 1 -@c4 = common dso_local local_unnamed_addr global i8 0, align 1 -@c5 = common dso_local local_unnamed_addr global i8 0, align 1 -@c6 = common dso_local local_unnamed_addr global i8 0, align 1 -@c7 = common dso_local local_unnamed_addr global i8 0, align 1 -@c8 = common dso_local local_unnamed_addr global i8 0, align 1 -@c9 = common dso_local local_unnamed_addr global i8 0, align 1 -@c10 = common dso_local local_unnamed_addr global i8 0, align 1 -@c11 = common dso_local local_unnamed_addr global i8 0, align 1 -@c12 = common dso_local local_unnamed_addr global i8 0, align 1 -@c13 = common dso_local local_unnamed_addr global i8 0, align 1 -@c14 = common dso_local local_unnamed_addr global i8 0, align 1 -@c15 = common dso_local local_unnamed_addr global i8 0, align 1 - -define i32 @foo(i32 %n) { -entry: - %0 = load i8, i8* @c0, align 1 - %tobool = icmp eq i8 %0, 0 - %cond = select i1 %tobool, i32 2, i32 1 - store i32 %cond, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 0), align 16 - %1 = load i8, i8* @c1, align 1 - %tobool2 = icmp eq i8 %1, 0 - %cond3 = select i1 %tobool2, i32 2, i32 1 - store i32 %cond3, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 1), align 4 - %2 = load i8, i8* @c2, align 1 - %tobool5 = icmp eq i8 %2, 0 - %cond6 = select i1 %tobool5, i32 2, i32 1 - store i32 %cond6, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 2), align 8 - %3 = load i8, i8* @c3, align 1 - %tobool8 = icmp eq i8 %3, 0 - %cond9 = select i1 %tobool8, i32 2, i32 1 - store i32 %cond9, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 3), align 4 - %4 = load i8, i8* @c4, align 1 - %tobool11 = icmp eq i8 %4, 0 - %cond12 = select i1 %tobool11, i32 2, i32 1 - store i32 %cond12, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 4), align 16 - %5 = load i8, i8* @c5, align 1 - %tobool14 = icmp eq i8 %5, 0 - %cond15 = select i1 %tobool14, i32 2, i32 1 - store i32 %cond15, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 5), align 4 - %6 = load i8, i8* @c6, align 1 - %tobool17 = icmp eq i8 %6, 0 - %cond18 = select i1 %tobool17, i32 2, i32 1 - store i32 %cond18, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 6), align 8 - %7 = load i8, i8* @c7, align 1 - %tobool20 = icmp eq i8 %7, 0 - %cond21 = select i1 %tobool20, i32 2, i32 1 - store i32 %cond21, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 7), align 4 - %8 = load i8, i8* @c8, align 1 - %tobool23 = icmp eq i8 %8, 0 - %cond24 = select i1 %tobool23, i32 2, i32 1 - store i32 %cond24, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 8), align 16 - %9 = load i8, i8* @c9, align 1 - %tobool26 = icmp eq i8 %9, 0 - %cond27 = select i1 %tobool26, i32 2, i32 1 - store i32 %cond27, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 9), align 4 - %10 = load i8, i8* @c10, align 1 - %tobool29 = icmp eq i8 %10, 0 - %cond30 = select i1 %tobool29, i32 2, i32 1 - store i32 %cond30, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 10), align 8 - %11 = load i8, i8* @c11, align 1 - %tobool32 = icmp eq i8 %11, 0 - %cond33 = select i1 %tobool32, i32 2, i32 1 - store i32 %cond33, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 11), align 4 - %12 = load i8, i8* @c12, align 1 - %tobool35 = icmp eq i8 %12, 0 - %cond36 = select i1 %tobool35, i32 2, i32 1 - store i32 %cond36, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 12), align 16 - %13 = load i8, i8* @c13, align 1 - %tobool38 = icmp eq i8 %13, 0 - %cond39 = select i1 %tobool38, i32 2, i32 1 - store i32 %cond39, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 13), align 4 - %14 = load i8, i8* @c14, align 1 - %tobool41 = icmp eq i8 %14, 0 - %cond42 = select i1 %tobool41, i32 2, i32 1 - store i32 %cond42, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 14), align 8 - %15 = load i8, i8* @c15, align 1 - %tobool44 = icmp eq i8 %15, 0 - %cond45 = select i1 %tobool44, i32 2, i32 1 - store i32 %cond45, i32* getelementptr inbounds ([16 x i32], [16 x i32]* @a, i64 0, i64 15), align 4 - ret i32 %n -} -; CHECK-LABEL: define i32 @foo(i32 %n) -; We should skip the profile. -; CHECK-NOT: %{{.*}} = select i1 %{{.*}}, i32 2, i32 1, !prof - diff --git a/llvm/test/Transforms/PGOProfile/single_bb.ll b/llvm/test/Transforms/PGOProfile/single_bb.ll deleted file mode 100644 index 874d8e4d22d..00000000000 --- a/llvm/test/Transforms/PGOProfile/single_bb.ll +++ /dev/null @@ -1,15 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat -; GEN: @__profn_single_bb = private constant [9 x i8] c"single_bb" - -define i32 @single_bb() { -entry: -; GEN: entry: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_single_bb, i32 0, i32 0), i64 12884901887, i32 1, i32 0) - ret i32 0 -} diff --git a/llvm/test/Transforms/PGOProfile/split-indirectbr-critical-edges.ll b/llvm/test/Transforms/PGOProfile/split-indirectbr-critical-edges.ll deleted file mode 100644 index dc834b7cd47..00000000000 --- a/llvm/test/Transforms/PGOProfile/split-indirectbr-critical-edges.ll +++ /dev/null @@ -1,39 +0,0 @@ -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s - -; Function Attrs: norecurse nounwind readnone uwtable -define i32 @bar(i32 %v) local_unnamed_addr #0 { -entry: - %mul = shl nsw i32 %v, 1 - ret i32 %mul -} - -; Function Attrs: norecurse nounwind readonly uwtable -define i32 @foo(i8* nocapture readonly %p) #1 { -entry: - %targets = alloca [256 x i8*], align 16 - %arrayidx1 = getelementptr inbounds [256 x i8*], [256 x i8*]* %targets, i64 0, i64 93 - store i8* blockaddress(@foo, %if.end), i8** %arrayidx1, align 8 - br label %for.cond2 - -for.cond2: ; preds = %if.end, %for.cond2, %entry -; CHECK: for.cond2: ; preds = %.split1 - %p.addr.0 = phi i8* [ %p, %entry ], [ %incdec.ptr5, %if.end ], [ %incdec.ptr, %for.cond2 ] - %incdec.ptr = getelementptr inbounds i8, i8* %p.addr.0, i64 1 - %0 = load i8, i8* %p.addr.0, align 1 - %cond = icmp eq i8 %0, 93 - br i1 %cond, label %if.end.preheader, label %for.cond2 - -if.end.preheader: ; preds = %for.cond2 - br label %if.end - -if.end: ; preds = %if.end.preheader, %if.end -; CHECK: if.end: ; preds = %.split1 - %p.addr.1 = phi i8* [ %incdec.ptr5, %if.end ], [ %incdec.ptr, %if.end.preheader ] - %incdec.ptr5 = getelementptr inbounds i8, i8* %p.addr.1, i64 1 - %1 = load i8, i8* %p.addr.1, align 1 - %idxprom6 = zext i8 %1 to i64 - %arrayidx7 = getelementptr inbounds [256 x i8*], [256 x i8*]* %targets, i64 0, i64 %idxprom6 - %2 = load i8*, i8** %arrayidx7, align 8 - indirectbr i8* %2, [label %for.cond2, label %if.end] -; CHECK: indirectbr i8* %2, [label %for.cond2, label %if.end] -} diff --git a/llvm/test/Transforms/PGOProfile/statics_counter_naming.ll b/llvm/test/Transforms/PGOProfile/statics_counter_naming.ll deleted file mode 100644 index c329ddba930..00000000000 --- a/llvm/test/Transforms/PGOProfile/statics_counter_naming.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: opt %s -pgo-instr-gen -static-func-full-module-prefix=false -S | FileCheck %s --check-prefix=NOPATH -; RUN: opt %s -passes=pgo-instr-gen -static-func-full-module-prefix=false -S | FileCheck %s --check-prefix=NOPATH -; RUN: opt %s --pgo-instr-gen -static-func-strip-dirname-prefix=1000 -S | FileCheck %s --check-prefix=NOPATH -; RUN: opt %s -passes=pgo-instr-gen -static-func-strip-dirname-prefix=1000 -S | FileCheck %s --check-prefix=NOPATH -; RUN: opt %s --pgo-instr-gen -static-func-strip-dirname-prefix=1 -S | FileCheck %s --check-prefix=HASPATH -; RUN: opt %s -passes=pgo-instr-gen -static-func-strip-dirname-prefix=1 -S | FileCheck %s --check-prefix=HASPATH -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; NOPATH: @__profn_statics_counter_naming.ll_func = private constant [30 x i8] c"statics_counter_naming.ll:func" -; HASPATH-NOT: @__profn_statics_counter_naming.ll_func = private constant [30 x i8] c"statics_counter_naming.ll:func" - -define internal i32 @func() { -entry: - ret i32 0 -} diff --git a/llvm/test/Transforms/PGOProfile/switch.ll b/llvm/test/Transforms/PGOProfile/switch.ll deleted file mode 100644 index e590e217013..00000000000 --- a/llvm/test/Transforms/PGOProfile/switch.ll +++ /dev/null @@ -1,51 +0,0 @@ -; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN -; RUN: llvm-profdata merge %S/Inputs/switch.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -; GEN: $__llvm_profile_raw_version = comdat any -; GEN: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat -; GEN: @__profn_test_switch = private constant [11 x i8] c"test_switch" - -define void @test_switch(i32 %i) { -entry: -; GEN: entry: -; GEN-NOT: call void @llvm.instrprof.increment - switch i32 %i, label %sw.default [ - i32 1, label %sw.bb - i32 2, label %sw.bb1 - i32 3, label %sw.bb2 - ] -; USE: ] -; USE-SAME: !prof ![[BW_SWITCH:[0-9]+]] -; USE: ![[BW_SWITCH]] = !{!"branch_weights", i32 3, i32 2, i32 0, i32 5} - -sw.bb: -; GEN: sw.bb: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__profn_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 2) - br label %sw.epilog - -sw.bb1: -; GEN: sw.bb1: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__profn_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 0) - br label %sw.epilog - -sw.bb2: -; GEN: sw.bb2: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__profn_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 1) - br label %sw.epilog - -sw.default: -; GEN: sw.default: -; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__profn_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 3) - br label %sw.epilog - -sw.epilog: -; GEN: sw.epilog: -; GEN-NOT: call void @llvm.instrprof.increment - ret void -; GEN: ret void -} diff --git a/llvm/test/Transforms/PGOProfile/thinlto_cspgo_gen.ll b/llvm/test/Transforms/PGOProfile/thinlto_cspgo_gen.ll deleted file mode 100644 index 1f6264378b8..00000000000 --- a/llvm/test/Transforms/PGOProfile/thinlto_cspgo_gen.ll +++ /dev/null @@ -1,88 +0,0 @@ -; REQUIRES: x86-registered-target - -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %S/Inputs/thinlto_cspgo_bar_gen.ll -o %t2.bc -; RUN: llvm-lto2 run -lto-cspgo-profile-file=alloc -lto-cspgo-gen -save-temps -o %t %t1.bc %t2.bc \ -; RUN: -r=%t1.bc,foo,pl \ -; RUN: -r=%t1.bc,bar,l \ -; RUN: -r=%t1.bc,main,plx \ -; RUN: -r=%t1.bc,__llvm_profile_filename,plx \ -; RUN: -r=%t1.bc,__llvm_profile_raw_version,plx \ -; RUN: -r=%t2.bc,bar,pl \ -; RUN: -r=%t2.bc,odd,pl \ -; RUN: -r=%t2.bc,even,pl \ -; RUN: -r=%t2.bc,__llvm_profile_filename,x \ -; RUN: -r=%t2.bc,__llvm_profile_raw_version,x -; RUN: llvm-dis %t.1.4.opt.bc -o - | FileCheck %s --check-prefix=CSGEN - -; CSGEN: @__profc_ -; CSGEN: @__profd_ - -source_filename = "cspgo.c" -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -$__llvm_profile_filename = comdat any -$__llvm_profile_raw_version = comdat any -@__llvm_profile_filename = constant [25 x i8] c"pass2/default_%m.profraw\00", comdat -@__llvm_profile_raw_version = constant i64 216172782113783812, comdat - -define dso_local void @foo() #0 !prof !29 { -entry: - br label %for.body - -for.body: - %i.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ] - tail call void @bar(i32 %i.06) - %add = or i32 %i.06, 1 - tail call void @bar(i32 %add) - %add1 = add nuw nsw i32 %i.06, 2 - %cmp = icmp ult i32 %add1, 200000 - br i1 %cmp, label %for.body, label %for.end, !prof !30 - -for.end: - ret void -} - -declare dso_local void @bar(i32) - -define dso_local i32 @main() !prof !29 { -entry: - tail call void @foo() - ret i32 0 -} - -attributes #0 = { "target-cpu"="x86-64" } - -!llvm.module.flags = !{!0, !1} - -!0 = !{i32 1, !"wchar_size", i32 4} -!1 = !{i32 1, !"ProfileSummary", !2} -!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} -!3 = !{!"ProfileFormat", !"InstrProf"} -!4 = !{!"TotalCount", i64 500002} -!5 = !{!"MaxCount", i64 200000} -!6 = !{!"MaxInternalCount", i64 100000} -!7 = !{!"MaxFunctionCount", i64 200000} -!8 = !{!"NumCounts", i64 6} -!9 = !{!"NumFunctions", i64 4} -!10 = !{!"DetailedSummary", !11} -!11 = !{!12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27} -!12 = !{i32 10000, i64 200000, i32 1} -!13 = !{i32 100000, i64 200000, i32 1} -!14 = !{i32 200000, i64 200000, i32 1} -!15 = !{i32 300000, i64 200000, i32 1} -!16 = !{i32 400000, i64 200000, i32 1} -!17 = !{i32 500000, i64 100000, i32 4} -!18 = !{i32 600000, i64 100000, i32 4} -!19 = !{i32 700000, i64 100000, i32 4} -!20 = !{i32 800000, i64 100000, i32 4} -!21 = !{i32 900000, i64 100000, i32 4} -!22 = !{i32 950000, i64 100000, i32 4} -!23 = !{i32 990000, i64 100000, i32 4} -!24 = !{i32 999000, i64 100000, i32 4} -!25 = !{i32 999900, i64 100000, i32 4} -!26 = !{i32 999990, i64 100000, i32 4} -!27 = !{i32 999999, i64 1, i32 6} -!29 = !{!"function_entry_count", i64 1} -!30 = !{!"branch_weights", i32 100000, i32 1} diff --git a/llvm/test/Transforms/PGOProfile/thinlto_cspgo_use.ll b/llvm/test/Transforms/PGOProfile/thinlto_cspgo_use.ll deleted file mode 100644 index 6a8b034315d..00000000000 --- a/llvm/test/Transforms/PGOProfile/thinlto_cspgo_use.ll +++ /dev/null @@ -1,82 +0,0 @@ -; REQUIRES: x86-registered-target - -; RUN: opt -module-summary %s -o %t1.bc -; RUN: opt -module-summary %S/Inputs/thinlto_cspgo_bar_use.ll -o %t2.bc -; RUN: llvm-profdata merge %S/Inputs/thinlto_cs.proftext -o %t3.profdata -; RUN: llvm-lto2 run -lto-cspgo-profile-file=%t3.profdata -save-temps -o %t %t1.bc %t2.bc \ -; RUN: -r=%t1.bc,foo,pl \ -; RUN: -r=%t1.bc,bar,l \ -; RUN: -r=%t1.bc,main,plx \ -; RUN: -r=%t2.bc,bar,pl \ -; RUN: -r=%t2.bc,odd,pl \ -; RUN: -r=%t2.bc,even,pl -; RUN: llvm-dis %t.1.4.opt.bc -o - | FileCheck %s --check-prefix=CSUSE - -; CSUSE: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}} -; CSUSE: {{![0-9]+}} = !{i32 1, !"CSProfileSummary", {{![0-9]+}}} -; CSUSE-DAG: {{![0-9]+}} = !{!"branch_weights", i32 100000, i32 0} -; CSUSE-DAG: {{![0-9]+}} = !{!"branch_weights", i32 0, i32 100000} - -source_filename = "cspgo.c" -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define dso_local void @foo() #0 !prof !29 { -entry: - br label %for.body - -for.body: - %i.06 = phi i32 [ 0, %entry ], [ %add1, %for.body ] - tail call void @bar(i32 %i.06) - %add = or i32 %i.06, 1 - tail call void @bar(i32 %add) - %add1 = add nuw nsw i32 %i.06, 2 - %cmp = icmp ult i32 %add1, 200000 - br i1 %cmp, label %for.body, label %for.end, !prof !30 - -for.end: - ret void -} - -declare dso_local void @bar(i32) - -define dso_local i32 @main() !prof !29 { -entry: - tail call void @foo() - ret i32 0 -} - -attributes #0 = { "target-cpu"="x86-64" } - -!llvm.module.flags = !{!0, !1} - -!0 = !{i32 1, !"wchar_size", i32 4} -!1 = !{i32 1, !"ProfileSummary", !2} -!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} -!3 = !{!"ProfileFormat", !"InstrProf"} -!4 = !{!"TotalCount", i64 500002} -!5 = !{!"MaxCount", i64 200000} -!6 = !{!"MaxInternalCount", i64 100000} -!7 = !{!"MaxFunctionCount", i64 200000} -!8 = !{!"NumCounts", i64 6} -!9 = !{!"NumFunctions", i64 4} -!10 = !{!"DetailedSummary", !11} -!11 = !{!12, !13, !14, !15, !16, !17, !18, !19, !20, !21, !22, !23, !24, !25, !26, !27} -!12 = !{i32 10000, i64 200000, i32 1} -!13 = !{i32 100000, i64 200000, i32 1} -!14 = !{i32 200000, i64 200000, i32 1} -!15 = !{i32 300000, i64 200000, i32 1} -!16 = !{i32 400000, i64 200000, i32 1} -!17 = !{i32 500000, i64 100000, i32 4} -!18 = !{i32 600000, i64 100000, i32 4} -!19 = !{i32 700000, i64 100000, i32 4} -!20 = !{i32 800000, i64 100000, i32 4} -!21 = !{i32 900000, i64 100000, i32 4} -!22 = !{i32 950000, i64 100000, i32 4} -!23 = !{i32 990000, i64 100000, i32 4} -!24 = !{i32 999000, i64 100000, i32 4} -!25 = !{i32 999900, i64 100000, i32 4} -!26 = !{i32 999990, i64 100000, i32 4} -!27 = !{i32 999999, i64 1, i32 6} -!29 = !{!"function_entry_count", i64 1} -!30 = !{!"branch_weights", i32 100000, i32 1} diff --git a/llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll b/llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll deleted file mode 100644 index 6d928eaca72..00000000000 --- a/llvm/test/Transforms/PGOProfile/thinlto_indirect_call_promotion.ll +++ /dev/null @@ -1,39 +0,0 @@ -; Do setup work for all below tests: generate bitcode and combined index -; RUN: opt -module-summary %s -o %t.bc -; RUN: opt -module-summary %p/Inputs/thinlto_indirect_call_promotion.ll -o %t2.bc -; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc - -; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -o %t4.bc -print-imports 2>&1 | FileCheck %s --check-prefix=IMPORTS -; IMPORTS-DAG: Import a -; IMPORTS-DAG: Import c - -; RUN: opt %t4.bc -icp-lto -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM -; RUN: opt %t4.bc -icp-lto -pgo-icall-prom -S -pass-remarks=pgo-icall-prom 2>&1 | FileCheck %s --check-prefix=PASS-REMARK -; PASS-REMARK: Promote indirect call to a with count 1 out of 1 -; PASS-REMARK: Promote indirect call to c.llvm.0 with count 1 out of 1 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@foo = external local_unnamed_addr global void ()*, align 8 -@bar = external local_unnamed_addr global void ()*, align 8 - -define i32 @main() local_unnamed_addr { -entry: - %0 = load void ()*, void ()** @foo, align 8 -; ICALL-PROM: br i1 %{{[0-9]+}}, label %if.true.direct_targ, label %if.false.orig_indirect, !prof [[BRANCH_WEIGHT:![0-9]+]] - tail call void %0(), !prof !1 - %1 = load void ()*, void ()** @bar, align 8 -; ICALL-PROM: br i1 %{{[0-9]+}}, label %if.true.direct_targ1, label %if.false.orig_indirect2, !prof [[BRANCH_WEIGHT:![0-9]+]] - tail call void %1(), !prof !2 - ret i32 0 -} - -!1 = !{!"VP", i32 0, i64 1, i64 -6289574019528802036, i64 1} -!2 = !{!"VP", i32 0, i64 1, i64 591260329866125152, i64 1} - -; Should not have a VP annotation on new indirect call (check before and after -; branch_weights annotation). -; ICALL-PROM-NOT: !"VP" -; ICALL-PROM: [[BRANCH_WEIGHT]] = !{!"branch_weights", i32 1, i32 0} -; ICALL-PROM-NOT: !"VP" diff --git a/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp.ll b/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp.ll deleted file mode 100644 index b6b668dbc29..00000000000 --- a/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp.ll +++ /dev/null @@ -1,63 +0,0 @@ -; Do setup work for all below tests: generate bitcode and combined index -; RUN: opt -module-summary %s -o %t.bc -; RUN: opt -module-summary %p/Inputs/thinlto_samplepgo_icp.ll -o %t2.bc -; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc - -; Checks if calls to static target functions are properly imported and promoted -; by ICP. Note that the GUID in the profile is from the oroginal name. -; RUN: opt -function-import -summary-file %t3.thinlto.bc %t.bc -o %t4.bc -print-imports 2>&1 | FileCheck %s --check-prefix=IMPORTS -; IMPORTS: Import _ZL3foov.llvm.0 -; RUN: opt %t4.bc -icp-lto -pgo-icall-prom -S | FileCheck %s --check-prefix=ICALL-PROM - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@fptr = local_unnamed_addr global void ()* null, align 8 - -; Function Attrs: norecurse uwtable -define i32 @main() local_unnamed_addr #0 !prof !34 { -entry: - %0 = load void ()*, void ()** @fptr, align 8 -; ICALL-PROM: br i1 %{{[0-9]+}}, label %if.true.direct_targ, label %if.false.orig_indirect - tail call void %0(), !prof !40 - ret i32 0 -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3,!4} -!llvm.ident = !{!31} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297016)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) -!1 = !DIFile(filename: "main.cc", directory: ".") -!2 = !{} -!3 = !{i32 2, !"Debug Info Version", i32 3} -!4 = !{i32 1, !"ProfileSummary", !5} -!5 = !{!6, !7, !8, !9, !10, !11, !12, !13} -!6 = !{!"ProfileFormat", !"SampleProfile"} -!7 = !{!"TotalCount", i64 3003} -!8 = !{!"MaxCount", i64 3000} -!9 = !{!"MaxInternalCount", i64 0} -!10 = !{!"MaxFunctionCount", i64 0} -!11 = !{!"NumCounts", i64 3} -!12 = !{!"NumFunctions", i64 1} -!13 = !{!"DetailedSummary", !14} -!14 = !{!15, !16, !17, !18, !19, !20, !20, !21, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30} -!15 = !{i32 10000, i64 3000, i32 1} -!16 = !{i32 100000, i64 3000, i32 1} -!17 = !{i32 200000, i64 3000, i32 1} -!18 = !{i32 300000, i64 3000, i32 1} -!19 = !{i32 400000, i64 3000, i32 1} -!20 = !{i32 500000, i64 3000, i32 1} -!21 = !{i32 600000, i64 3000, i32 1} -!22 = !{i32 700000, i64 3000, i32 1} -!23 = !{i32 800000, i64 3000, i32 1} -!24 = !{i32 900000, i64 3000, i32 1} -!25 = !{i32 950000, i64 3000, i32 1} -!26 = !{i32 990000, i64 3000, i32 1} -!27 = !{i32 999000, i64 3000, i32 1} -!28 = !{i32 999900, i64 2, i32 2} -!29 = !{i32 999990, i64 2, i32 2} -!30 = !{i32 999999, i64 2, i32 2} -!31 = !{!"clang version 5.0.0 (trunk 297016)"} -!34 = !{!"function_entry_count", i64 1} -!40 = !{!"VP", i32 0, i64 3000, i64 -8789629626369651636, i64 3000} diff --git a/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp2.ll b/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp2.ll deleted file mode 100644 index 7e3afb0775a..00000000000 --- a/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp2.ll +++ /dev/null @@ -1,78 +0,0 @@ -; Checks if indirect calls to static target functions that are actually -; dead in the new binary target (due to a profile collected from a slightly -; different binary) are properly traversed during ThinLTO liveness analysis. -; If the liveness analysis is changed to ignore indirect edges and the -; importer is changed to check liveness before importing, this test will -; need adjustment (in that case _ZL3foov should not be imported/promoted, -; and _ZL3barv can be internalized/removed). - -; REQUIRES: x86-registered-target - -; Do setup work for all below tests: generate bitcode and combined index -; RUN: opt -module-summary %s -o %t.bc -; RUN: opt -module-summary %p/Inputs/thinlto_samplepgo_icp2a.ll -o %t2a.bc -; RUN: opt -module-summary %p/Inputs/thinlto_samplepgo_icp2b.ll -o %t2b.bc - -; Use -import-instr-limit=5 so that we don't import _ZL3barv, which would -; hide the problem. -; RUN: llvm-lto2 run -save-temps -import-instr-limit=5 -o %t3 %t.bc %t2a.bc %t2b.bc -r %t.bc,fptr,plx -r %t.bc,main,plx -r %t2a.bc,_ZL3barv,l -r %t2b.bc,_ZL3barv,pl -print-imports 2>&1 | FileCheck %s --check-prefix=IMPORTS2 -; IMPORTS2-NOT: Import _ZL3barv -; IMPORTS2: Import _ZL3foov.llvm.0 -; IMPORTS2-NOT: Import _ZL3barv -; RUN: llvm-nm %t3.2 | FileCheck %s --check-prefix=NM -; NM: _ZL3barv -; RUN: llvm-dis < %t3.3.2.internalize.bc | FileCheck %s --check-prefix=INTERNALIZE -; INTERNALIZE: define dso_local void @_ZL3barv - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@fptr = local_unnamed_addr global void ()* null, align 8 - -; Function Attrs: norecurse uwtable -define i32 @main() local_unnamed_addr #0 !prof !34 { -entry: - %0 = load void ()*, void ()** @fptr, align 8 -; ICALL-PROM: br i1 %{{[0-9]+}}, label %if.true.direct_targ, label %if.false.orig_indirect - tail call void %0(), !prof !40 - ret i32 0 -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3,!4} -!llvm.ident = !{!31} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297016)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) -!1 = !DIFile(filename: "main.cc", directory: ".") -!2 = !{} -!3 = !{i32 2, !"Debug Info Version", i32 3} -!4 = !{i32 1, !"ProfileSummary", !5} -!5 = !{!6, !7, !8, !9, !10, !11, !12, !13} -!6 = !{!"ProfileFormat", !"SampleProfile"} -!7 = !{!"TotalCount", i64 3003} -!8 = !{!"MaxCount", i64 3000} -!9 = !{!"MaxInternalCount", i64 0} -!10 = !{!"MaxFunctionCount", i64 0} -!11 = !{!"NumCounts", i64 3} -!12 = !{!"NumFunctions", i64 1} -!13 = !{!"DetailedSummary", !14} -!14 = !{!15, !16, !17, !18, !19, !20, !20, !21, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30} -!15 = !{i32 10000, i64 3000, i32 1} -!16 = !{i32 100000, i64 3000, i32 1} -!17 = !{i32 200000, i64 3000, i32 1} -!18 = !{i32 300000, i64 3000, i32 1} -!19 = !{i32 400000, i64 3000, i32 1} -!20 = !{i32 500000, i64 3000, i32 1} -!21 = !{i32 600000, i64 3000, i32 1} -!22 = !{i32 700000, i64 3000, i32 1} -!23 = !{i32 800000, i64 3000, i32 1} -!24 = !{i32 900000, i64 3000, i32 1} -!25 = !{i32 950000, i64 3000, i32 1} -!26 = !{i32 990000, i64 3000, i32 1} -!27 = !{i32 999000, i64 3000, i32 1} -!28 = !{i32 999900, i64 2, i32 2} -!29 = !{i32 999990, i64 2, i32 2} -!30 = !{i32 999999, i64 2, i32 2} -!31 = !{!"clang version 5.0.0 (trunk 297016)"} -!34 = !{!"function_entry_count", i64 1} -!40 = !{!"VP", i32 0, i64 3000, i64 -8789629626369651636, i64 3000} diff --git a/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp3.ll b/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp3.ll deleted file mode 100644 index 3044964f33c..00000000000 --- a/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp3.ll +++ /dev/null @@ -1,64 +0,0 @@ -; REQUIRES: x86-registered-target - -; Do setup work for all below tests: generate bitcode and combined index -; RUN: opt -module-summary %s -o %t.bc -; RUN: opt -module-summary %p/Inputs/thinlto_samplepgo_icp3.ll -o %t2.bc - -; Test to make sure importing and dead stripping works in the -; case where the target is a local function that also indirectly calls itself. -; RUN: llvm-lto2 run -thinlto-threads=1 -save-temps -o %t3 %t.bc %t2.bc -r %t.bc,fptr,plx -r %t.bc,main,plx -r %t2.bc,_Z6updatei,pl -r %t2.bc,fptr,l -print-imports 2>&1 | FileCheck %s --check-prefix=IMPORTS -; Make sure we import the promted indirectly called target -; IMPORTS: Import _ZL3foov.llvm.0 - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@fptr = local_unnamed_addr global void ()* null, align 8 - -; Function Attrs: norecurse uwtable -define i32 @main() local_unnamed_addr #0 !prof !34 { -entry: - %0 = load void ()*, void ()** @fptr, align 8 -; ICALL-PROM: br i1 %{{[0-9]+}}, label %if.true.direct_targ, label %if.false.orig_indirect - tail call void %0(), !prof !40 - ret i32 0 -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3,!4} -!llvm.ident = !{!31} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297016)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) -!1 = !DIFile(filename: "main.cc", directory: ".") -!2 = !{} -!3 = !{i32 2, !"Debug Info Version", i32 3} -!4 = !{i32 1, !"ProfileSummary", !5} -!5 = !{!6, !7, !8, !9, !10, !11, !12, !13} -!6 = !{!"ProfileFormat", !"SampleProfile"} -!7 = !{!"TotalCount", i64 3003} -!8 = !{!"MaxCount", i64 3000} -!9 = !{!"MaxInternalCount", i64 0} -!10 = !{!"MaxFunctionCount", i64 0} -!11 = !{!"NumCounts", i64 3} -!12 = !{!"NumFunctions", i64 1} -!13 = !{!"DetailedSummary", !14} -!14 = !{!15, !16, !17, !18, !19, !20, !20, !21, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30} -!15 = !{i32 10000, i64 3000, i32 1} -!16 = !{i32 100000, i64 3000, i32 1} -!17 = !{i32 200000, i64 3000, i32 1} -!18 = !{i32 300000, i64 3000, i32 1} -!19 = !{i32 400000, i64 3000, i32 1} -!20 = !{i32 500000, i64 3000, i32 1} -!21 = !{i32 600000, i64 3000, i32 1} -!22 = !{i32 700000, i64 3000, i32 1} -!23 = !{i32 800000, i64 3000, i32 1} -!24 = !{i32 900000, i64 3000, i32 1} -!25 = !{i32 950000, i64 3000, i32 1} -!26 = !{i32 990000, i64 3000, i32 1} -!27 = !{i32 999000, i64 3000, i32 1} -!28 = !{i32 999900, i64 2, i32 2} -!29 = !{i32 999990, i64 2, i32 2} -!30 = !{i32 999999, i64 2, i32 2} -!31 = !{!"clang version 5.0.0 (trunk 297016)"} -!34 = !{!"function_entry_count", i64 1} -!40 = !{!"VP", i32 0, i64 3000, i64 -8789629626369651636, i64 3000} diff --git a/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp_droppeddead.ll b/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp_droppeddead.ll deleted file mode 100644 index fcbc2d64541..00000000000 --- a/llvm/test/Transforms/PGOProfile/thinlto_samplepgo_icp_droppeddead.ll +++ /dev/null @@ -1,71 +0,0 @@ -; REQUIRES: x86-registered-target - -; RUN: opt -module-summary %s -o %t.bc - -; Tests that with dead stripping in the thin link enabled (default), we do not -; promote to target of the dropped dead symbol _ZL3foov. This can happen with a -; sample profile collected for one binary used to optimize for another binary. -; RUN: llvm-lto2 run -save-temps -o %t2 %t.bc -r %t.bc,fptr,plx \ -; RUN: -r %t.bc,main,plx -r %t.bc,_ZL3foov,l -; RUN: llvm-dis < %t2.1.4.opt.bc | FileCheck %s --check-prefix=OPT -; RUN: llvm-lto2 run -save-temps -o %t2 %t.bc -r %t.bc,fptr,plx \ -; RUN: -r %t.bc,main,plx -r %t.bc,_ZL3foov,l -compute-dead=false -; RUN: llvm-dis < %t2.1.4.opt.bc | FileCheck %s --check-prefix=OPT-NODEAD - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -@fptr = local_unnamed_addr global void ()* null, align 8 - -define void @_ZL3foov() #1 { -entry: - ret void -} - -define i32 @main() local_unnamed_addr #0 !prof !34 { -entry: - %0 = load void ()*, void ()** @fptr, align 8 -; OPT-NOT: label %if.false.orig_indirect -; OPT-NODEAD: br i1 %{{[0-9]+}}, label %if.end.icp, label %if.false.orig_indirect - tail call void %0(), !prof !40 - ret i32 0 -} - -!llvm.dbg.cu = !{!0} -!llvm.module.flags = !{!3,!4} -!llvm.ident = !{!31} - -!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 5.0.0 (trunk 297016)", isOptimized: true, runtimeVersion: 0, emissionKind: NoDebug, enums: !2) -!1 = !DIFile(filename: "main.cc", directory: ".") -!2 = !{} -!3 = !{i32 2, !"Debug Info Version", i32 3} -!4 = !{i32 1, !"ProfileSummary", !5} -!5 = !{!6, !7, !8, !9, !10, !11, !12, !13} -!6 = !{!"ProfileFormat", !"SampleProfile"} -!7 = !{!"TotalCount", i64 3003} -!8 = !{!"MaxCount", i64 3000} -!9 = !{!"MaxInternalCount", i64 0} -!10 = !{!"MaxFunctionCount", i64 0} -!11 = !{!"NumCounts", i64 3} -!12 = !{!"NumFunctions", i64 1} -!13 = !{!"DetailedSummary", !14} -!14 = !{!15, !16, !17, !18, !19, !20, !20, !21, !21, !22, !23, !24, !25, !26, !27, !28, !29, !30} -!15 = !{i32 10000, i64 3000, i32 1} -!16 = !{i32 100000, i64 3000, i32 1} -!17 = !{i32 200000, i64 3000, i32 1} -!18 = !{i32 300000, i64 3000, i32 1} -!19 = !{i32 400000, i64 3000, i32 1} -!20 = !{i32 500000, i64 3000, i32 1} -!21 = !{i32 600000, i64 3000, i32 1} -!22 = !{i32 700000, i64 3000, i32 1} -!23 = !{i32 800000, i64 3000, i32 1} -!24 = !{i32 900000, i64 3000, i32 1} -!25 = !{i32 950000, i64 3000, i32 1} -!26 = !{i32 990000, i64 3000, i32 1} -!27 = !{i32 999000, i64 3000, i32 1} -!28 = !{i32 999900, i64 2, i32 2} -!29 = !{i32 999990, i64 2, i32 2} -!30 = !{i32 999999, i64 2, i32 2} -!31 = !{!"clang version 5.0.0 (trunk 297016)"} -!34 = !{!"function_entry_count", i64 1} -!40 = !{!"VP", i32 0, i64 3000, i64 -8789629626369651636, i64 3000} diff --git a/llvm/test/Transforms/PGOProfile/unreachable_bb.ll b/llvm/test/Transforms/PGOProfile/unreachable_bb.ll deleted file mode 100644 index a27fbe77526..00000000000 --- a/llvm/test/Transforms/PGOProfile/unreachable_bb.ll +++ /dev/null @@ -1,23 +0,0 @@ -; RUN: llvm-profdata merge %S/Inputs/unreachable_bb.proftext -o %t.profdata -; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE -; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE - -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-unknown-linux-gnu" - -define void @foo() { -entry: - call void @bar() - unreachable -return: - ret void -} - -declare void @bar() - -;USE: !0 = !{i32 1, !"ProfileSummary", !1} -;USE: !1 = !{!2, !3, !4, !5, !6, !7, !8, !9} -;USE: !2 = !{!"ProfileFormat", !"InstrProf"} -;USE: !3 = !{!"TotalCount", i64 0} - - |