1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -instcombine -S | FileCheck %s 3 4declare void @llvm.experimental.guard(i1, ...) 5 6; Regression test. If %flag is false then %s == 0 and guard should be triggered. 7define i32 @a(i1 %flag, i32 %X) nounwind readnone { 8; CHECK-LABEL: @a( 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]] 14; 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"() ] 18 %r = sdiv i32 100, %s 19 ret i32 %r 20} 21