summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2014-04-01 18:50:06 +0000
committerHal Finkel <hfinkel@anl.gov>2014-04-01 18:50:06 +0000
commitb4e001cc818257b771ab4b743fa89266de14bee9 (patch)
treeabe481282bc27b2576fab22df5e3b3689dde866c /llvm/lib/Analysis
parentc97323ea8b68a08b80b38a43bdc0805f2169f67e (diff)
downloadbcm5719-llvm-b4e001cc818257b771ab4b743fa89266de14bee9.tar.gz
bcm5719-llvm-b4e001cc818257b771ab4b743fa89266de14bee9.zip
Use TopTTI->getGEPCost from within getUserCost
The implementation of getUserCost had duplicated (and hard-coded) the default logic in getGEPCost. Instead, it is better to use getGEPCost directly, which limits the default logic to the implementation of one function, and allows targets to override the behavior. No functionality change intended. llvm-svn: 205346
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/TargetTransformInfo.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 75d053c6891..04d09f1372a 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -415,10 +415,10 @@ struct NoTTI final : ImmutablePass, TargetTransformInfo {
if (isa<PHINode>(U))
return TCC_Free; // Model all PHI nodes as free.
- if (const GEPOperator *GEP = dyn_cast<GEPOperator>(U))
- // In the basic model we just assume that all-constant GEPs will be
- // folded into their uses via addressing modes.
- return GEP->hasAllConstantIndices() ? TCC_Free : TCC_Basic;
+ if (const GEPOperator *GEP = dyn_cast<GEPOperator>(U)) {
+ SmallVector<const Value *, 4> Indices(GEP->idx_begin(), GEP->idx_end());
+ return TopTTI->getGEPCost(GEP->getPointerOperand(), Indices);
+ }
if (ImmutableCallSite CS = U) {
const Function *F = CS.getCalledFunction();
OpenPOWER on IntegriCloud