1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
4 declare void @llvm.experimental.guard(i1, ...)
6 ; Regression test. If %flag is false then %s == 0 and guard should be triggered.
7 define i32 @a(i1 %flag, i32 %X) nounwind readnone {
9 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[X:%.*]], 0
10 ; CHECK-NEXT: [[CMP:%.*]] = and i1 [[CMP1]], [[FLAG:%.*]]
11 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[CMP]]) #1 [ "deopt"() ]
12 ; CHECK-NEXT: [[R:%.*]] = sdiv i32 100, [[X]]
13 ; CHECK-NEXT: ret i32 [[R]]
15 %s = select i1 %flag, i32 %X, i32 0
16 %cmp = icmp ne i32 %s, 0
17 call void(i1, ...) @llvm.experimental.guard( i1 %cmp )[ "deopt"() ]