[InstCombine] add test for PR30327

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281248 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2016-09-12 19:50:08 +00:00
parent 6979660cda
commit 06b5f13936

View File

@ -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
}