[llvm-commits] CAST patch: #3: lib/Transforms (except instcombine)
Chris Lattner
clattner at apple.com
Tue Nov 21 08:32:57 PST 2006
On Nov 21, 2006, at 8:30 AM, Reid Spencer wrote:
> On Tue, 2006-11-21 at 07:56 -0800, Chris Lattner wrote:
>> On Nov 21, 2006, at 12:01 AM, Reid Spencer wrote:
>
>>>> These two casts should just be:
>>>>
>>>>
>>>> // Always zero extend the value.
>>>> if (different size)
>>>> SV = new ZExtInst(SV, Old->getType(), SV->getName(),
>>>> SI);
>>>> else
>>>> SV = new BitCast(..)
>>>> if (Offset && Offset < TD.getTypeSize(SV->getType())*8)
>>>> SV = new ShiftInst(Instruction::Shl, SV,
>>>> ConstantInt::get(Type::UByteTy,
>>>> Offset),
>>>> SV->getName()+".adj", SI);
>>>> // Mask out the bits we are about to insert from the old
>>>> value.
>>>
>>> I tried this. It causes ZExt failures. I undid the change. The
>>> might be
>>> some cases where sizeof(SV->getType()) == sizeof(Old->getType()).
>>
>> In that case, won't the bitcast work?
>
> I'm not sure what was going on there. I checked the size with
> getPrimitiveSizeInBits to ensure that SV->getType() was smaller than
> Old->getType() before making the zext. Perhaps a bool or pointer or
> packed crept in there? I dunnot, but it didn't work.
I realize it is not a priority for you, but after the patch goes in,
please try to figure out what is happening.
-Chris
More information about the llvm-commits
mailing list