summaryrefslogtreecommitdiff
path: root/lib/Analysis/TargetTransformInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/TargetTransformInfo.cpp')
-rw-r--r--lib/Analysis/TargetTransformInfo.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Analysis/TargetTransformInfo.cpp b/lib/Analysis/TargetTransformInfo.cpp
index 75d053c689..04d09f1372 100644
--- a/lib/Analysis/TargetTransformInfo.cpp
+++ b/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();