[llvm] 5a641cf - Follow up of rGdea4a63e6359, which committed a slightly different version than

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 02:07:37 PST 2021


Author: Sjoerd Meijer
Date: 2021-02-17T10:07:26Z
New Revision: 5a641cf194d493752edade659f1e9f06294f4f9f

URL: https://github.com/llvm/llvm-project/commit/5a641cf194d493752edade659f1e9f06294f4f9f
DIFF: https://github.com/llvm/llvm-project/commit/5a641cf194d493752edade659f1e9f06294f4f9f.diff

LOG: Follow up of rGdea4a63e6359, which committed a slightly different version than
intended.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 75cd5e3a0933..963fe9a9ac49 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -161,6 +161,10 @@ static cl::opt<bool> FilterSameScaledReg(
     cl::desc("Narrow LSR search space by filtering non-optimal formulae"
              " with the same ScaledReg and Scale"));
 
+static cl::opt<bool> EnableBackedgeIndexing(
+    "lsr-backedge-indexing", cl::Hidden, cl::init(true),
+      cl::desc("Enable the generation of cross iteration indexed memops"));
+
 static cl::opt<unsigned> ComplexityLimit(
   "lsr-complexity-limit", cl::Hidden,
   cl::init(std::numeric_limits<uint16_t>::max()),
@@ -3806,7 +3810,9 @@ void LSRInstance::GenerateConstantOffsetsImpl(
   // means that a single pre-indexed access can be generated to become the new
   // base pointer for each iteration of the loop, resulting in no extra add/sub
   // instructions for pointer updating.
-  if (AMK == TTI::AMK_PreIndexed && LU.Kind == LSRUse::Address) {
+  bool FavorPreIndexed = EnableBackedgeIndexing &&
+          AMK == TTI::AMK_PreIndexed;
+  if (FavorPreIndexed && LU.Kind == LSRUse::Address) {
     if (auto *GAR = dyn_cast<SCEVAddRecExpr>(G)) {
       if (auto *StepRec =
           dyn_cast<SCEVConstant>(GAR->getStepRecurrence(SE))) {


        


More information about the llvm-commits mailing list