[llvm] r267645 - SLSR: Use UnknownAddressSpace instead of 0 for pure arithmetic.
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 17:32:09 PDT 2016
Author: arsenm
Date: Tue Apr 26 19:32:09 2016
New Revision: 267645
URL: http://llvm.org/viewvc/llvm-project?rev=267645&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp?rev=267645&r1=267644&r2=267645&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp Tue Apr 26 19:32:09 2016
@@ -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(GetElementPtrI
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,
More information about the llvm-commits
mailing list