[llvm-commits] [llvm] r108117 - in /llvm/trunk: lib/VMCore/Instructions.cpp test/Transforms/InstCombine/cast.ll
Chris Lattner
sabre at nondot.org
Sun Jul 11 18:19:22 PDT 2010
Author: lattner
Date: Sun Jul 11 20:19:22 2010
New Revision: 108117
URL: http://llvm.org/viewvc/llvm-project?rev=108117&view=rev
Log:
fix PR7311 by avoiding breaking casts when a bitcast from scalar->vector
is involved.
Modified:
llvm/trunk/lib/VMCore/Instructions.cpp
llvm/trunk/test/Transforms/InstCombine/cast.ll
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=108117&r1=108116&r2=108117&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Sun Jul 11 20:19:22 2010
@@ -2006,6 +2006,14 @@
{ 99,99,99,99,99,99,99,99,99,13,99,12 }, // IntToPtr |
{ 5, 5, 5, 6, 6, 5, 5, 6, 6,11, 5, 1 }, // BitCast -+
};
+
+ // If either of the casts are a bitcast from scalar to vector, disallow the
+ // merging.
+ if ((firstOp == Instruction::BitCast &&
+ isa<VectorType>(SrcTy) != isa<VectorType>(MidTy)) ||
+ (secondOp == Instruction::BitCast &&
+ isa<VectorType>(MidTy) != isa<VectorType>(DstTy)))
+ return 0; // Disallowed
int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin]
[secondOp-Instruction::CastOpsBegin];
Modified: llvm/trunk/test/Transforms/InstCombine/cast.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast.ll?rev=108117&r1=108116&r2=108117&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast.ll Sun Jul 11 20:19:22 2010
@@ -638,3 +638,14 @@
; CHECK-NEXT: ret
}
+; PR7311 - Don't create invalid IR on scalar->vector cast.
+define <2 x float> @test63(i64 %tmp8) nounwind {
+entry:
+ %a = bitcast i64 %tmp8 to <2 x i32>
+ %vcvt.i = uitofp <2 x i32> %a to <2 x float>
+ ret <2 x float> %vcvt.i
+; CHECK: @test63
+; CHECK: bitcast
+; CHECK: uitofp
+}
+
More information about the llvm-commits
mailing list