[InstCombine] add test for PR30327

llvm-svn: 281248
This commit is contained in:
Sanjay Patel 2016-09-12 19:50:08 +00:00
parent 2eea9a1d58
commit dea26950a0
1 changed files with 14 additions and 0 deletions

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
}