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=instcombine -S | FileCheck %s
33
44declare i1 @gen1 ()
55
6+ ;.
7+ ; CHECK: @glb = global i8 0
8+ ;.
69define i1 @cond_eq_and (i8 %X , i8 %Y , i8 noundef %C ) {
710; CHECK-LABEL: @cond_eq_and(
811; CHECK-NEXT: [[COND:%.*]] = icmp eq i8 [[X:%.*]], [[C:%.*]]
@@ -16,16 +19,16 @@ define i1 @cond_eq_and(i8 %X, i8 %Y, i8 noundef %C) {
1619 ret i1 %res
1720}
1821
19- define i1 @cond_eq_and_const (i8 %X , i8 %Y ) {
22+ define i1 @cond_eq_and_const (i8 %X , i8 %Y ) !prof !0 {
2023; CHECK-LABEL: @cond_eq_and_const(
2124; CHECK-NEXT: [[COND:%.*]] = icmp eq i8 [[X:%.*]], 10
2225; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i8 [[Y:%.*]], 10
23- ; CHECK-NEXT: [[RES:%.*]] = select i1 [[COND]], i1 [[TMP1]], i1 false
26+ ; CHECK-NEXT: [[RES:%.*]] = select i1 [[COND]], i1 [[TMP1]], i1 false, !prof [[PROF1:![0-9]+]]
2427; CHECK-NEXT: ret i1 [[RES]]
2528;
2629 %cond = icmp eq i8 %X , 10
2730 %lhs = icmp ult i8 %X , %Y
28- %res = select i1 %cond , i1 %lhs , i1 false
31+ %res = select i1 %cond , i1 %lhs , i1 false , !prof !1
2932 ret i1 %res
3033}
3134
@@ -42,16 +45,16 @@ define i1 @cond_eq_or(i8 %X, i8 %Y, i8 noundef %C) {
4245 ret i1 %res
4346}
4447
45- define i1 @cond_eq_or_const (i8 %X , i8 %Y ) {
48+ define i1 @cond_eq_or_const (i8 %X , i8 %Y ) !prof !0 {
4649; CHECK-LABEL: @cond_eq_or_const(
4750; CHECK-NEXT: [[COND:%.*]] = icmp ne i8 [[X:%.*]], 10
4851; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i8 [[Y:%.*]], 10
49- ; CHECK-NEXT: [[RES:%.*]] = select i1 [[COND]], i1 true, i1 [[TMP1]]
52+ ; CHECK-NEXT: [[RES:%.*]] = select i1 [[COND]], i1 true, i1 [[TMP1]], !prof [[PROF1]]
5053; CHECK-NEXT: ret i1 [[RES]]
5154;
5255 %cond = icmp ne i8 %X , 10
5356 %lhs = icmp ult i8 %X , %Y
54- %res = select i1 %cond , i1 true , i1 %lhs
57+ %res = select i1 %cond , i1 true , i1 %lhs , !prof !1
5558 ret i1 %res
5659}
5760
@@ -793,3 +796,10 @@ define <2 x i1> @not_logical_and2(i1 %b, <2 x i32> %a) {
793796 %or = select <2 x i1 > %and , <2 x i1 > <i1 true , i1 true >, <2 x i1 > %implied
794797 ret <2 x i1 > %or
795798}
799+
800+ !0 = !{!"function_entry_count" , i64 1000 }
801+ !1 = !{!"branch_weights" , i32 2 , i32 3 }
802+ ;.
803+ ; CHECK: [[META0:![0-9]+]] = !{!"function_entry_count", i64 1000}
804+ ; CHECK: [[PROF1]] = !{!"branch_weights", i32 2, i32 3}
805+ ;.
0 commit comments