[PATCH] D119683: [LV] Mark induction PHI nodes as allowed exits (NFC).

Ricky Zhou via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 11:20:24 PDT 2022


rickyz updated this revision to Diff 425855.
rickyz added a comment.
Herald added a project: All.

Rebase.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119683/new/

https://reviews.llvm.org/D119683

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp


Index: llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -568,14 +568,12 @@
       PrimaryInduction = Phi;
   }
 
-  // Both the PHI node itself, and the "post-increment" value feeding
-  // back into the PHI node may have external users.
-  // We can allow those uses, except if the SCEVs we have for them rely
-  // on predicates that only hold within the loop, since allowing the exit
-  // currently means re-using this SCEV outside the loop (see PR33706 for more
-  // details).
+  AllowedExit.insert(Phi);
+
+  // Allow external uses of the "post-increment" value feeding back into
+  // the PHI node unless its SCEV relies on predicates that may not hold
+  // outside of the loop (see PR33706 for more details).
   if (PSE.getPredicate().isAlwaysTrue()) {
-    AllowedExit.insert(Phi);
     AllowedExit.insert(Phi->getIncomingValueForBlock(TheLoop->getLoopLatch()));
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119683.425855.patch
Type: text/x-patch
Size: 1091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220428/50131004/attachment.bin>


More information about the llvm-commits mailing list