[PATCH] D19521: SLSR: Use UnknownAddressSpace instead of default

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 20:51:58 PDT 2016


arsenm created this revision.
arsenm added a reviewer: jingyue.
arsenm added a subscriber: llvm-commits.

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.

http://reviews.llvm.org/D19521

Files:
  lib/Transforms/Scalar/StraightLineStrengthReduce.cpp

Index: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
===================================================================
--- lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
+++ lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
@@ -74,6 +74,8 @@
 
 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 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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19521.54964.patch
Type: text/x-patch
Size: 916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160426/0847b57d/attachment.bin>


More information about the llvm-commits mailing list