[llvm-commits] [llvm] r94987 - in /llvm/trunk: include/llvm/Analysis/ScalarEvolution.h include/llvm/Analysis/ScalarEvolutionExpressions.h lib/Analysis/ConstantFolding.cpp lib/Analysis/ScalarEvolution.cpp lib/Analysis/ScalarEvolutionExpander.cpp lib/VMCore/ConstantFold.cpp test/Other/constant-fold-gep.ll test/Transforms/InstCombine/getelementptr.ll
Duncan Sands
baldrick at free.fr
Tue Feb 2 02:05:34 PST 2010
Hi Dan,
> + /// getSizeOfExpr - Return an expression for alignof on the given type.
> + ///
> + const SCEV *getAlignOfExpr(const Type *AllocTy);
> +
> + /// getSizeOfExpr - Return an expression for offsetof on the given field.
> + ///
> + const SCEV *getOffsetOfExpr(const StructType *STy, unsigned FieldNo);
> +
> + /// getSizeOfExpr - Return an expression for offsetof on the given field.
> + ///
> + const SCEV *getOffsetOfExpr(const Type *CTy, Constant *FieldNo);
> +
> /// getNegativeSCEV - Return the SCEV object corresponding to -V.
> ///
> const SCEV *getNegativeSCEV(const SCEV *V);
the method names in the comments do not match the real method names.
> + if (!Any) return 0;
> +
> + Constant *C =
> + ConstantExpr::getGetElementPtr(Ops[0], &NewIdxs[0], NewIdxs.size());
> + if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
> + if (Constant *Folded = ConstantFoldConstantExpression(CE, TD))
> + C = Folded;
You could just return Folded here.
> + return C;
> +}
Ciao,
Duncan.
More information about the llvm-commits
mailing list