[llvm-commits] [llvm-gcc-4.2] r67690 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h
Evan Cheng
echeng at apple.com
Wed Mar 25 10:42:24 PDT 2009
On Mar 25, 2009, at 10:13 AM, Duncan Sands wrote:
> Hi Evan,
>
>> + if (BitCastInst *BC = dyn_cast<BitCastInst>(Size))
>> + Size = BC->getOperand(0);
>
> why would this ever be a bitcast?
This code in llvm-convert.cpp:
Value *RHS = Emit(rhs, 0);
const Type *LHSTy = ConvertType(TREE_TYPE(lhs));
// The value may need to be replaced later if this temporary is
multiply
// defined - ensure it can be uniquely identified by not folding
the cast.
Instruction::CastOps opc = CastInst::getCastOpcode(RHS, RHSSigned,
LHSTy, LHSSigned);
CastInst *Cast = CastInst::Create(opc, RHS, LHSTy, RHS-
>getNameStart());
This emits a noop bitcast:
%1 = bitcast i32 -1 to i32
I'll fix the rest.
Evan
>
>> + ConstantInt *LenCI = dyn_cast<ConstantInt>(Len);
>> + if (!LenCI)
>> + return false;
>
> If Size can be a bitcast, why not Len?
>
>> + if (LenCI->getZExtValue() >= SizeCI->getZExtValue()) {
>
> This will blow up if Len or Size doesn't fit in 64 bits.
> Of course real code will never have such big values, but
> that's no reason ignore this possibility.
>
> Ciao,
>
> Duncan.
More information about the llvm-commits
mailing list