diff --git a/test/Transforms/InstCombine/zext-bool-add-sub.ll b/test/Transforms/InstCombine/zext-bool-add-sub.ll index 735b07c6b92..d252ad0c011 100644 --- a/test/Transforms/InstCombine/zext-bool-add-sub.ll +++ b/test/Transforms/InstCombine/zext-bool-add-sub.ll @@ -1,5 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt < %s -instcombine -S | FileCheck %s + ; rdar://11748024 define i32 @a(i1 zeroext %x, i1 zeroext %y) { @@ -17,3 +18,16 @@ define i32 @a(i1 zeroext %x, i1 zeroext %y) { ret i32 %add } +define i32 @PR30273(i1 %a, i1 %b) { +; CHECK-LABEL: @PR30273( +; CHECK-NEXT: [[ZEXT:%.*]] = zext i1 %a to i32 +; CHECK-NEXT: [[SEL1:%.*]] = select i1 %a, i32 2, i32 1 +; CHECK-NEXT: [[SEL2:%.*]] = select i1 %b, i32 [[SEL1]], i32 [[ZEXT]] +; CHECK-NEXT: ret i32 [[SEL2]] +; + %zext = zext i1 %a to i32 + %sel1 = select i1 %a, i32 2, i32 1 + %sel2 = select i1 %b, i32 %sel1, i32 %zext + ret i32 %sel2 +} +