[llvm-commits] [llvm] r142992 - in /llvm/trunk: lib/VMCore/Instructions.cpp test/Bitcode/shuffle.ll
Mon Ping Wang
monping at apple.com
Fri Oct 28 00:54:38 PDT 2011
The bit code reader tries to look up the constant based on an index. If it is hasn't encountered the constant yet, it places a placeholder and fixes it up later. This happens rarely and allows the reader to run in one pass. Updating the verifier is a good idea. I'll do that.
-- Mon Ping
On Oct 26, 2011, at 12:36 AM, Duncan Sands wrote:
> Hi,
>
>> 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>
>
> why does it create a placeholder - is it really needed? I mean, I don't see any
> other special casing of UserOp in Instructions.cpp, so it seems that no other
> instructions do this - in which case what makes shufflevector different? Also,
> if you do follow this route, maybe you can have the verifier check that the
> mask is really valid (no UserOp1). This would catch bugs in which the
> placeholder leaked out of the bitcode reader somehow.
>
> Ciao, Duncan.
>
>>
>> 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>)
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list