1- ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1+ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
22; RUN: opt -S -passes='sroa<preserve-cfg>' < %s | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG
33; RUN: opt -S -passes='sroa<modify-cfg>' < %s | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG
44
55%pair = type { i32 , i32 }
66
7+ ;.
8+ ; CHECK: @g = global %pair zeroinitializer, align 4
9+ ;.
710define i32 @test_sroa_phi_gep (i1 %cond ) {
811; CHECK-LABEL: @test_sroa_phi_gep(
912; CHECK-NEXT: entry:
@@ -334,18 +337,18 @@ exit:
334337 unreachable
335338}
336339
337- define void @test_sroa_gep_phi_select_same_block (i1 %c1 , i1 %c2 , ptr %ptr ) {
340+ define void @test_sroa_gep_phi_select_same_block (i1 %c1 , i1 %c2 , ptr %ptr ) !prof !0 {
338341; CHECK-LABEL: @test_sroa_gep_phi_select_same_block(
339342; CHECK-NEXT: entry:
340343; CHECK-NEXT: [[ALLOCA:%.*]] = alloca [[PAIR:%.*]], align 8
341344; CHECK-NEXT: br label [[WHILE_BODY:%.*]]
342345; CHECK: while.body:
343346; CHECK-NEXT: [[PHI:%.*]] = phi ptr [ [[ALLOCA]], [[ENTRY:%.*]] ], [ [[SELECT:%.*]], [[WHILE_BODY]] ]
344- ; CHECK-NEXT: [[SELECT]] = select i1 [[C1:%.*]], ptr [[PHI]], ptr [[PTR:%.*]]
347+ ; CHECK-NEXT: [[SELECT]] = select i1 [[C1:%.*]], ptr [[PHI]], ptr [[PTR:%.*]], !prof [[PROF1:![0-9]+]]
345348; CHECK-NEXT: [[PHI_SROA_GEP:%.*]] = getelementptr inbounds [[PAIR]], ptr [[PHI]], i64 1
346349; CHECK-NEXT: [[PTR_SROA_GEP:%.*]] = getelementptr inbounds [[PAIR]], ptr [[PTR]], i64 1
347- ; CHECK-NEXT: [[SELECT_SROA_SEL:%.*]] = select i1 [[C1]], ptr [[PHI_SROA_GEP]], ptr [[PTR_SROA_GEP]]
348- ; CHECK-NEXT: br i1 [[C2:%.*]], label [[EXIT:%.*]], label [[WHILE_BODY]]
350+ ; CHECK-NEXT: [[SELECT_SROA_SEL:%.*]] = select i1 [[C1]], ptr [[PHI_SROA_GEP]], ptr [[PTR_SROA_GEP]], !prof [[PROF1]]
351+ ; CHECK-NEXT: br i1 [[C2:%.*]], label [[EXIT:%.*]], label [[WHILE_BODY]], !prof [[PROF2:![0-9]+]]
349352; CHECK: exit:
350353; CHECK-NEXT: ret void
351354;
@@ -355,9 +358,9 @@ entry:
355358
356359while.body:
357360 %phi = phi ptr [ %alloca , %entry ], [ %select , %while.body ]
358- %select = select i1 %c1 , ptr %phi , ptr %ptr
361+ %select = select i1 %c1 , ptr %phi , ptr %ptr , !prof !1
359362 %gep = getelementptr inbounds %pair , ptr %select , i64 1
360- br i1 %c2 , label %exit , label %while.body
363+ br i1 %c2 , label %exit , label %while.body , !prof !2
361364
362365exit:
363366 ret void
@@ -747,6 +750,18 @@ declare ptr @foo()
747750declare i32 @__gxx_personality_v0 (...)
748751
749752declare void @llvm.memcpy.p0.p0.i64 (ptr noalias nocapture writeonly , ptr noalias nocapture readonly , i64 , i1 immarg)
753+
754+ !0 = !{!"function_entry_count" , i32 10 }
755+ !1 = !{!"branch_weights" , i32 3 , i32 5 }
756+ !2 = !{!"branch_weights" , i32 7 , i32 11 }
757+
758+ ;.
759+ ; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
760+ ;.
761+ ; CHECK: [[META0:![0-9]+]] = !{!"function_entry_count", i32 10}
762+ ; CHECK: [[PROF1]] = !{!"branch_weights", i32 3, i32 5}
763+ ; CHECK: [[PROF2]] = !{!"branch_weights", i32 7, i32 11}
764+ ;.
750765;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
751766; CHECK-MODIFY-CFG: {{.*}}
752767; CHECK-PRESERVE-CFG: {{.*}}
0 commit comments