summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-04-27 00:32:09 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-04-27 00:32:09 +0000
commitba437c67d2460ed6848a58a34407d5b4afe5468c (patch)
treea20bd5a9ae554aae28fdd0aa2e45746ddc02dd51
parentda168fbc2e71c9ab77ce88f5fb1422bbf9ed5b4e (diff)
downloadbcm5719-llvm-ba437c67d2460ed6848a58a34407d5b4afe5468c.tar.gz
bcm5719-llvm-ba437c67d2460ed6848a58a34407d5b4afe5468c.zip
SLSR: Use UnknownAddressSpace instead of 0 for pure arithmetic.
In the case where isLegalAddressingMode is used for cases not related to addressing modes, such as pure adds and muls, it should not be using address space 0. LSR already passes -1 as the address space in these cases. llvm-svn: 267645
-rw-r--r--llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
index 03de393ca73..c9761b74bd1 100644
--- a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
@@ -74,6 +74,8 @@ using namespace PatternMatch;
namespace {
+static const unsigned UnknownAddressSpace = ~0u;
+
class StraightLineStrengthReduce : public FunctionPass {
public:
// SLSR candidate. Such a candidate must be in one of the forms described in
@@ -276,7 +278,7 @@ static bool isGEPFoldable(GetElementPtrInst *GEP,
static bool isAddFoldable(const SCEV *Base, ConstantInt *Index, Value *Stride,
TargetTransformInfo *TTI) {
return TTI->isLegalAddressingMode(Base->getType(), nullptr, 0, true,
- Index->getSExtValue());
+ Index->getSExtValue(), UnknownAddressSpace);
}
bool StraightLineStrengthReduce::isFoldable(const Candidate &C,
OpenPOWER on IntegriCloud