1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ;RUN: opt -instcombine -S %s | FileCheck %s
4 @A = extern_weak global i32, align 4
5 @B = extern_weak global i32, align 4
7 define i32 @foo(i1 %which) {
10 ; CHECK-NEXT: br i1 true, label [[FINAL:%.*]], label [[DELAY:%.*]]
12 ; CHECK-NEXT: br label [[FINAL]]
14 ; CHECK-NEXT: [[USE2:%.*]] = phi i32 [ 1, [[ENTRY:%.*]] ], [ select (i1 icmp eq (i32* @A, i32* @B), i32 2, i32 1), [[DELAY]] ]
15 ; CHECK-NEXT: [[B7:%.*]] = mul i32 [[USE2]], 2147483647
16 ; CHECK-NEXT: [[C3:%.*]] = icmp eq i32 [[B7]], 0
17 ; CHECK-NEXT: store i1 [[C3]], i1* undef, align 1
18 ; CHECK-NEXT: ret i32 [[USE2]]
21 br i1 true, label %final, label %delay
23 delay: ; preds = %entry
26 final: ; preds = %delay, %entry
27 %use2 = phi i1 [ false, %entry ], [ icmp eq (i32* @A, i32* @B), %delay ]
28 %value = select i1 %use2, i32 2, i32 1
29 %B7 = mul i32 %value, 2147483647
30 %C3 = icmp ule i32 %B7, 0
31 store i1 %C3, i1* undef