[PATCH] [TTI/CostModel] improve TTI::getGEPCost and use it in CostModel::getInstructionCost
Jingyue Wu
jingyue at google.com
Tue May 19 16:02:15 PDT 2015
================
Comment at: include/llvm/Analysis/TargetTransformInfoImpl.h:392
@@ +391,3 @@
+ unsigned getGEPCost(const Value *Ptr, ArrayRef<Value *> Operands) {
+ const GlobalValue *BaseGV = dyn_cast<GlobalValue>(Ptr);
+ bool HasBaseReg = (BaseGV == nullptr);
----------------
hfinkel wrote:
> hfinkel wrote:
> > You should call stripPointerCasts before doing the dyn_cast.
> Should be dyn_cast_or_null b/c the cost model should not require the base pointer be known when estimating costs.
Interesting -- when Ptr == nullptr, what is a good estimation? Fall back to using `getAddressComputationCost`?
http://reviews.llvm.org/D9819
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list