1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2;RUN: opt -instcombine -S %s | FileCheck %s 3 4@A = extern_weak global i32, align 4 5@B = extern_weak global i32, align 4 6 7define i32 @foo(i1 %which) { 8; CHECK-LABEL: @foo( 9; CHECK-NEXT: entry: 10; CHECK-NEXT: br i1 true, label [[FINAL:%.*]], label [[DELAY:%.*]] 11; CHECK: delay: 12; CHECK-NEXT: br label [[FINAL]] 13; CHECK: 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]] 19; 20entry: 21 br i1 true, label %final, label %delay 22 23delay: ; preds = %entry 24 br label %final 25 26final: ; 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 32 ret i32 %value 33} 34