diff options
author | Hal Finkel <hfinkel@anl.gov> | 2014-04-01 18:50:06 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2014-04-01 18:50:06 +0000 |
commit | b4e001cc818257b771ab4b743fa89266de14bee9 (patch) | |
tree | abe481282bc27b2576fab22df5e3b3689dde866c /llvm/lib/Analysis | |
parent | c97323ea8b68a08b80b38a43bdc0805f2169f67e (diff) | |
download | bcm5719-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.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(); |