diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/TargetTransformInfo.cpp | 8 |
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(); |

