[llvm-commits] [llvm] r142992 - in /llvm/trunk: lib/VMCore/Instructions.cpp test/Bitcode/shuffle.ll
Mon P Wang
wangmp at apple.com
Tue Oct 25 17:34:48 PDT 2011
Author: wangmp
Date: Tue Oct 25 19:34:48 2011
New Revision: 142992
URL: http://llvm.org/viewvc/llvm-project?rev=142992&view=rev
Log:
The bitcode reader can create an shuffle with a place holder mask which it will
fix up later. For this special case, allow such a mask to be considered valid.
<rdar://problem/8622574>
Added:
llvm/trunk/test/Bitcode/shuffle.ll
Modified:
llvm/trunk/lib/VMCore/Instructions.cpp
Modified: llvm/trunk/lib/VMCore/Instructions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=142992&r1=142991&r2=142992&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Instructions.cpp (original)
+++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Oct 25 19:34:48 2011
@@ -1576,10 +1576,17 @@
return false;
}
}
- }
- else if (!isa<UndefValue>(Mask) && !isa<ConstantAggregateZero>(Mask))
+ } else if (!isa<UndefValue>(Mask) && !isa<ConstantAggregateZero>(Mask)) {
+ // The bitcode reader can create a place holder for a forward reference
+ // used as the shuffle mask. When this occurs, the shuffle mask will
+ // fall into this case and fail. To avoid this error, do this bit of
+ // ugliness to allow such a mask pass.
+ if (const ConstantExpr* CE = dyn_cast<ConstantExpr>(Mask)) {
+ if (CE->getOpcode() == Instruction::UserOp1)
+ return true;
+ }
return false;
-
+ }
return true;
}
Added: llvm/trunk/test/Bitcode/shuffle.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bitcode/shuffle.ll?rev=142992&view=auto
==============================================================================
--- llvm/trunk/test/Bitcode/shuffle.ll (added)
+++ llvm/trunk/test/Bitcode/shuffle.ll Tue Oct 25 19:34:48 2011
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | llvm-dis
+
+; <rdar://problem/8622574>
+; tests the bitcodereader can handle the case where the reader will initially
+; create shuffle with a place holder mask.
+
+
+define <4 x float> @test(<2 x double> %d2) {
+entry:
+ %call20.i = tail call <4 x float> @cmp(<2 x double> %d2,
+ <2 x double> bitcast (
+ <4 x float> shufflevector (
+ <3 x float> shufflevector (
+ <4 x float> shufflevector (
+ <3 x float> bitcast (
+ i96 trunc (
+ i128 bitcast (<2 x double> bitcast (
+ <4 x i32> <i32 0, i32 0, i32 0, i32 undef> to <2 x double>)
+ to i128) to i96)
+ to <3 x float>),
+ <3 x float> undef,
+ <4 x i32> <i32 0, i32 1, i32 2, i32 undef>),
+ <4 x float> undef,
+ <3 x i32> <i32 0, i32 1, i32 2>),
+ <3 x float> undef,
+ <4 x i32> <i32 0, i32 1, i32 2, i32 undef>)
+ to <2 x double>))
+ ret <4 x float> %call20.i
+}
+
+declare <4 x float> @cmp(<2 x double>, <2 x double>)
More information about the llvm-commits
mailing list