[llvm] r290726 - [LICM] Only recompute LCSSA when we actually promoted something.

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 14:37:14 PST 2016


Author: mkuper
Date: Thu Dec 29 16:37:13 2016
New Revision: 290726

URL: http://llvm.org/viewvc/llvm-project?rev=290726&view=rev
Log:
[LICM] Only recompute LCSSA when we actually promoted something.

We want to recompute LCSSA only when we actually promoted a value.
This means we only need to look at changes made by promotion when
deciding whether to recompute it or not, not at regular sinking/hoisting.

(This was what the code was documented as doing, just not what it did)

Hopefully NFC.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LICM.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=290726&r1=290725&r2=290726&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Thu Dec 29 16:37:13 2016
@@ -255,9 +255,11 @@ bool LoopInvariantCodeMotion::runOnLoop(
     SmallVector<Instruction *, 8> InsertPts;
     PredIteratorCache PIC;
 
+    bool Promoted = false;
+
     // Loop over all of the alias sets in the tracker object.
     for (AliasSet &AS : *CurAST)
-      Changed |= promoteLoopAccessesToScalars(
+      Promoted |= promoteLoopAccessesToScalars(
           AS, ExitBlocks, InsertPts, PIC, LI, DT, TLI, L, CurAST, &SafetyInfo);
 
     // Once we have promoted values across the loop body we have to recursively
@@ -266,9 +268,10 @@ bool LoopInvariantCodeMotion::runOnLoop(
     // FIXME: This is really heavy handed. It would be a bit better to use an
     // SSAUpdater strategy during promotion that was LCSSA aware and reformed
     // it as it went.
-    if (Changed) {
+    if (Promoted)
       formLCSSARecursively(*L, *DT, LI, SE);
-    }
+
+    Changed |= Promoted;
   }
 
   // Check that neither this loop nor its parent have had LCSSA broken. LICM is




More information about the llvm-commits mailing list