make truncate/sext elimination capable of changing phi's. This

implements rdar://6013816 and the testcase in Transforms/InstCombine/sext-misc.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52440 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2008-06-18 04:00:49 +00:00
parent fab8387384
commit 8114b718c9
2 changed files with 50 additions and 7 deletions

View File

@@ -1,6 +1,4 @@
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sext
; RUN: llvm-as < %s | llc -march=x86-64 | not grep movslq
; RUN: llvm-as < %s | llc -march=x86 | not grep sar
declare i32 @llvm.ctpop.i32(i32)
declare i32 @llvm.ctlz.i32(i32)
@@ -50,3 +48,18 @@ define i32 @woo(i8 %a, i32 %f, i1 %p, i32* %z) {
%n = sext i16 %s to i32
ret i32 %n
}
; rdar://6013816
define i16 @test(i16 %t, i1 %cond) nounwind {
entry:
br i1 %cond, label %T, label %F
T:
%t2 = sext i16 %t to i32
br label %F
F:
%V = phi i32 [%t2, %T], [42, %entry]
%W = trunc i32 %V to i16
ret i16 %W
}