[PATCH] D123230: [UnifyLoopExits] Reduce number of guard blocks
    Sameer Sahasrabuddhe via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat Apr  9 03:30:18 PDT 2022
    
    
  
sameerds added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/UnifyLoopExits.cpp:235-242
+      for (auto Pred : predecessors(G)) {
+        auto PredLoop = LI.getLoopFor(Pred);
+        if (!ParentLoop->contains(PredLoop)) {
+          if (PredLoop)
+            LI.removeBlock(Pred);
+          ParentLoop->addBasicBlockToLoop(Pred, LI);
+        }
----------------
bcahoon wrote:
> sameerds wrote:
> > Scary stuff. Could you please add a comment? I think this is related to the test "unreachable_from_inner_loop" ... but an explanation in English will help a lot.
> Agreed. Please let me know if this requires additional clarification.
I am able to follow the test unreachable_from_inner_loop, but not seeing how the part about "if (PredLoop) remove pred" works. In the test, { B D F} is an inner loop, inside { A B D F G} and two guards are generated. But neither guard causes a node to move from a non-child loop to ParentLoop.
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123230/new/
https://reviews.llvm.org/D123230
    
    
More information about the llvm-commits
mailing list