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
This commit is contained in:
Matt Arsenault 2016-04-27 00:32:09 +00:00
parent da168fbc2e
commit ba437c67d2
1 changed files with 3 additions and 1 deletions

View File

@ -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,