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 | a7a02cb7377a1c0843bee6d42e4d4d8f1dddb2ed (patch) | |
tree | d6b0d5707e9aa5b458244d38d45c652526f25a1b /lib/Analysis/TargetTransformInfo.cpp | |
parent | 54c55edb0a6c58c4fc7083c73c3f6bb7240ca14e (diff) | |
download | llvm-a7a02cb7377a1c0843bee6d42e4d4d8f1dddb2ed.tar.gz llvm-a7a02cb7377a1c0843bee6d42e4d4d8f1dddb2ed.tar.bz2 llvm-a7a02cb7377a1c0843bee6d42e4d4d8f1dddb2ed.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205346 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/TargetTransformInfo.cpp')
-rw-r--r-- | lib/Analysis/TargetTransformInfo.cpp | 8 |
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(); |