1; RUN: opt < %s -instcombine -S | FileCheck %s 2; 3; This test ensures that InstCombine does not distribute And over Xor 4; using simplifications involving undef. 5 6define zeroext i1 @foo(i32 %arg) { 7; CHECK-LABEL: @foo( 8 9entry: 10 %cmp1 = icmp eq i32 %arg, 37 11 br i1 %cmp1, label %bb_then, label %bb_else 12 13bb_then: 14 call void @bar() 15 br label %bb_exit 16 17bb_else: 18 %cmp2 = icmp slt i32 %arg, 17 19 br label %bb_exit 20 21; CHECK: bb_exit: 22; CHECK-NEXT: [[PHI1:%.*]] = phi i1 [ [[CMP2:%.*]], [[BB_ELSE:%.*]] ], [ undef, [[BB_THEN:%.*]] ] 23; CHECK-NEXT: [[XOR1:%.*]] = xor i1 [[CMP1:%.*]], true 24; CHECK-NEXT: [[AND1:%.*]] = and i1 [[PHI1]], [[XOR1]] 25; CHECK-NEXT: ret i1 [[AND1]] 26bb_exit: 27 %phi1 = phi i1 [ %cmp2, %bb_else ], [ undef, %bb_then ] 28 %xor1 = xor i1 %cmp1, true 29 %and1 = and i1 %phi1, %xor1 30 ret i1 %and1 31} 32 33declare void @bar() 34