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=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -switch-range-to-icmp < %s | FileCheck %s
33; RUN: opt -S -data-layout="p:32:32-p1:16:16" -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -switch-range-to-icmp < %s | FileCheck -check-prefix=CHECK -check-prefix=DL %s
44
55declare void @foo1 ()
66
77declare void @foo2 ()
88
9- define void @test1 (i32 %V ) {
9+ define void @test1 (i32 %V ) !prof !0 {
1010; CHECK-LABEL: @test1(
1111; CHECK-NEXT: switch i32 [[V:%.*]], label [[F:%.*]] [
1212; CHECK-NEXT: i32 17, label [[T:%.*]]
1313; CHECK-NEXT: i32 4, label [[T]]
14- ; CHECK-NEXT: ]
14+ ; CHECK-NEXT: ], !prof [[PROF1:![0-9]+]]
1515; CHECK: common.ret:
1616; CHECK-NEXT: ret void
1717; CHECK: T:
@@ -24,7 +24,7 @@ define void @test1(i32 %V) {
2424 %C1 = icmp eq i32 %V , 4 ; <i1> [#uses=1]
2525 %C2 = icmp eq i32 %V , 17 ; <i1> [#uses=1]
2626 %CN = or i1 %C1 , %C2 ; <i1> [#uses=1]
27- br i1 %CN , label %T , label %F
27+ br i1 %CN , label %T , label %F , !prof !1
2828T: ; preds = %0
2929 call void @foo1 ( )
3030 ret void
@@ -116,12 +116,12 @@ F: ; preds = %0
116116 ret void
117117}
118118
119- define void @test2 (i32 %V ) {
119+ define void @test2 (i32 %V ) !prof !0 {
120120; CHECK-LABEL: @test2(
121121; CHECK-NEXT: switch i32 [[V:%.*]], label [[T:%.*]] [
122122; CHECK-NEXT: i32 17, label [[F:%.*]]
123123; CHECK-NEXT: i32 4, label [[F]]
124- ; CHECK-NEXT: ]
124+ ; CHECK-NEXT: ], !prof [[PROF2:![0-9]+]]
125125; CHECK: common.ret:
126126; CHECK-NEXT: ret void
127127; CHECK: T:
@@ -134,7 +134,7 @@ define void @test2(i32 %V) {
134134 %C1 = icmp ne i32 %V , 4 ; <i1> [#uses=1]
135135 %C2 = icmp ne i32 %V , 17 ; <i1> [#uses=1]
136136 %CN = and i1 %C1 , %C2 ; <i1> [#uses=1]
137- br i1 %CN , label %T , label %F
137+ br i1 %CN , label %T , label %F , !prof !1
138138T: ; preds = %0
139139 call void @foo1 ( )
140140 ret void
@@ -1313,3 +1313,16 @@ if.then:
13131313if.end:
13141314 ret void
13151315}
1316+
1317+ !0 = !{!"function_entry_count" , i32 100 }
1318+ !1 = !{!"branch_weights" , i32 6 , i32 10 }
1319+ ;.
1320+ ; DL: attributes #[[ATTR0:[0-9]+]] = { noredzone nounwind ssp }
1321+ ; DL: attributes #[[ATTR1:[0-9]+]] = { nounwind }
1322+ ; DL: attributes #[[ATTR2]] = { noredzone nounwind }
1323+ ; DL: attributes #[[ATTR3]] = { noredzone }
1324+ ;.
1325+ ; DL: [[META0:![0-9]+]] = !{!"function_entry_count", i32 100}
1326+ ; DL: [[PROF1]] = !{!"branch_weights", i32 10, i32 3, i32 3}
1327+ ; DL: [[PROF2]] = !{!"branch_weights", i32 6, i32 5, i32 5}
1328+ ;.
0 commit comments