[llvm-commits] CAST patch: #3: lib/Transforms (except instcombine)
Reid Spencer
rspencer at reidspencer.com
Tue Nov 21 08:30:52 PST 2006
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.
>
> -Chris
More information about the llvm-commits
mailing list