mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-05 19:10:19 +00:00
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
This commit is contained in:
parent
0d60ee32af
commit
a99e5d777e
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user