> -/// getCastedVersionOf - Return the specified value casted to > uintptr_t. > +/// getCastedVersionOf - Return the specified value casted to > uintptr_t. This > +/// assumes that the Value* V is of integer or pointer type only. > /// > Value *LoopStrengthReduce::getCastedVersionOf(Value *V) { > if (V->getType() == UIntPtrTy) return V; > if (Constant *CB = dyn_cast<Constant>(V)) > - return ConstantExpr::getCast(CB, UIntPtrTy); > + if (CB->getType()->isInteger()) > + return ConstantExpr::getIntegerCast(CB, UIntPtrTy, > + CB->getType()->isSigned());
You're going to have to decide on the signedness at some point. Considering that this is used for gep indices, I'd guess they must be signed. > + else > + return ConstantExpr::getPtrToInt(CB, UIntPtrTy); > > Value *&New = CastedPointers[V]; > if (New) return New; > > > Index: llvm/lib/Transforms/Scalar/SCCP.cpp > diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 llvm/lib/ > Transforms/Scalar/SCCP.cpp:1.141 > --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 Wed Dec 6 19:30:31 2006 > +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Dec 11 23:04:59 2006 > @@ -589,7 +589,8 @@ > if (VState.isOverdefined()) // Inherit overdefinedness > of operand > markOverdefined(&I); > else if (VState.isConstant()) // Propagate constant value > - markConstant(&I, ConstantExpr::getCast(VState.getConstant(), > I.getType())); > + markConstant(&I, ConstantExpr::getCast(I.getOpcode(), > + VState.getConstant(), > I.getType())); > } Nice bug. -Chris _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits