llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Vikram Hegde (vikramRH)

<details>
<summary>Changes</summary>

New pass manager mandates every loop pass to preserve LCSSA form. LSR doesn't 
to do it completely although there is some effort to preserve LCSSA currently. 
Ideal situation would be that LSR handles this as part of the pass (I did try 
attempting it by basically toggling "preserveSSA" flags in SCEVExpander, 
however I saw several test case differences which didn't pass alive2 checks, 
hence am not really confident about the approach).  
Any comments on how to go about this are welcome. I would think we can go with 
this approach until we have a proper solution since this is a blocker enabling 
backend NPM .

---
Full diff: https://github.com/llvm/llvm-project/pull/176692.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp (+4) 


``````````diff
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp 
b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index e9d78baece25b..91d2f65a05e62 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -7135,6 +7135,10 @@ PreservedAnalyses LoopStrengthReducePass::run(Loop &L, 
LoopAnalysisManager &AM,
   if (!ReduceLoopStrength(&L, AM.getResult<IVUsersAnalysis>(L, AR), AR.SE,
                           AR.DT, AR.LI, AR.TTI, AR.AC, AR.TLI, AR.MSSA))
     return PreservedAnalyses::all();
+  
+  // TODO: Remove this once the LSR handles LCSSA preservation completely.
+  if (auto *OuterLoop = L.getOutermostLoop())
+    formLCSSARecursively(*OuterLoop, AR.DT, &AR.LI, &AR.SE);
 
   auto PA = getLoopPassPreservedAnalyses();
   if (AR.MSSA)

``````````

</details>


https://github.com/llvm/llvm-project/pull/176692
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to