On Mon, 2006-12-18 at 08:56 -0800, Chris Lattner wrote: > On Dec 18, 2006, at 12:16 AM, Reid Spencer wrote: > > > > > Convert the last use of two-argument ConstantExpr::getCast into > > another > > form so we can remove that method from ConstantExpr. > > --- > > Diffs of the changes: (+3 -1) > > > > ExprTypeConvert.cpp | 4 +++- > > 1 files changed, 3 insertions(+), 1 deletion(-) > > > > > > Index: llvm/lib/Transforms/ExprTypeConvert.cpp > > diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.115 llvm/lib/ > > Transforms/ExprTypeConvert.cpp:1.116 > > --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.115 Wed Dec 6 > > 19:30:31 2006 > > +++ llvm/lib/Transforms/ExprTypeConvert.cpp Mon Dec 18 02:16:27 2006 > > @@ -210,7 +210,9 @@ > > Constant *CPV = cast<Constant>(V); > > // Constants are converted by constant folding the cast that > > is required. > > // We assume here that all casts are implemented for constant > > prop. > > - Value *Result = ConstantExpr::getCast(CPV, Ty); > > + Instruction::CastOps opcode = CastInst::getCastOpcode(CPV, > > + CPV->getType()->isSigned(), Ty, Ty->isSigned()); > > + Value *Result = ConstantExpr::getCast(opcode, CPV, Ty); > > // Add the instruction to the expression map > > //VMC.ExprMap[V] = Result; > > return Result; > > How is this safe? Do you know that signedness can be trusted here?
I know it is safe because all I have done is replaced getCast call with its contents. There can't be any functional change as this is what it was doing before. What's different is that we've moved the calls to isSigned() out to this file instead of burying them into VMCore. I'll revisit this when it is time to remove isSigned(). > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits