From 3082da881d92fbc05a3af7601635dacf3661dd5a Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Wed, 27 Apr 2016 00:32:09 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267645 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/StraightLineStrengthReduce.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp index 03de393ca73..c9761b74bd1 100644 --- a/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp +++ b/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, -- 2.11.0