summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
diff options
context:
space:
mode:
authorJun Bum Lim <junbuml@codeaurora.org>2017-10-04 18:33:52 +0000
committerJun Bum Lim <junbuml@codeaurora.org>2017-10-04 18:33:52 +0000
commitd40e03c2d8bef1635d2ff2f0aae43eb1ba0ec9a1 (patch)
tree685c677b527b29765aa0dfb42faa52622da3cf67 /llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
parentbef94bcbae5f5f4e01f0247322e3381f0cc07c5e (diff)
downloadbcm5719-llvm-d40e03c2d8bef1635d2ff2f0aae43eb1ba0ec9a1.tar.gz
bcm5719-llvm-d40e03c2d8bef1635d2ff2f0aae43eb1ba0ec9a1.zip
Recommit : Use the basic cost if a GEP is not used as addressing mode
Recommitting r314517 with the fix for handling ConstantExpr. Original commit message: Currently, getGEPCost() returns TCC_FREE whenever a GEP is a legal addressing mode in the target. However, since it doesn't check its actual users, it will return FREE even in cases where the GEP cannot be folded away as a part of actual addressing mode. For example, if an user of the GEP is a call instruction taking the GEP as a parameter, then the GEP may not be folded in isel. llvm-svn: 314923
Diffstat (limited to 'llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
index 8b8d6590aa6..3f93eaecc5d 100644
--- a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
@@ -239,7 +239,7 @@ static bool isGEPFoldable(GetElementPtrInst *GEP,
SmallVector<const Value*, 4> Indices;
for (auto I = GEP->idx_begin(); I != GEP->idx_end(); ++I)
Indices.push_back(*I);
- return TTI->getGEPCost(GEP->getSourceElementType(), GEP->getPointerOperand(),
+ return TTI->getGEPCost(cast<GEPOperator>(GEP),
Indices) == TargetTransformInfo::TCC_Free;
}
OpenPOWER on IntegriCloud