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: [[CMP:%.*]] = icmp ne i32 [[X:%.*]], 0
10 ; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[CMP]]) #2 [ "deopt"() ]
11 ; CHECK-NEXT: [[R:%.*]] = sdiv i32 100, [[X]]
12 ; CHECK-NEXT: ret i32 [[R]]
14 %s = select i1 %flag, i32 %X, i32 0
15 %cmp = icmp ne i32 %s, 0
16 call void(i1, ...) @llvm.experimental.guard( i1 %cmp )[ "deopt"() ]