[llvm-commits] CAST patch: #3: lib/Transforms (except instcombine)
Reid Spencer
rspencer at reidspencer.com
Tue Nov 21 00:01:56 PST 2006
FYI ..
On Mon, 2006-11-20 at 14:48 -0800, Chris Lattner wrote:
> --- lib/Transforms/Scalar/ScalarReplAggregates.cpp 8 Nov 2006 06:47:33
> -0000 1.49
> +++ lib/Transforms/Scalar/ScalarReplAggregates.cpp 18 Nov 2006
> 19:22:21 -0000
> @@ -649,13 +649,13 @@ void SROA::ConvertUsesToScalar(Value *Pt
> "tmp", SI);
> } else {
> // If SV is signed, convert it to unsigned, so that the
> next cast zero
> // extends the value.
> if (SV->getType()->isSigned())
> - SV = new CastInst(SV,
> SV->getType()->getUnsignedVersion(),
> + SV = CastInst::getCast(SV,
> SV->getType()->getUnsignedVersion(),
> SV->getName(), SI);
> - SV = new CastInst(SV, Old->getType(), SV->getName(), SI);
> + SV = CastInst::getCast(SV, Old->getType(), SV->getName(),
> SI);
> 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.
>
>
> 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()).
Reid.
More information about the llvm-commits
mailing list