[llvm] [InstCombine] Make backedge check in op of phi transform more precise (PR #106075)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 1 11:47:54 PDT 2024


================
@@ -5373,6 +5371,18 @@ bool InstCombinerImpl::prepareWorklist(Function &F) {
   return MadeIRChange;
 }
 
+void InstCombiner::computeBackEdges() {
+  // Collect backedges.
+  SmallPtrSet<BasicBlock *, 16> Visited;
+  for (BasicBlock *BB : RPOT) {
+    Visited.insert(BB);
+    for (BasicBlock *Succ : successors(BB))
+      if (Visited.contains(Succ))
+        BackEdges.insert({BB, Succ});
----------------
goldsteinn wrote:

I'd say not having an extra special case is preferable then.

https://github.com/llvm/llvm-project/pull/106075


More information about the llvm-commits mailing list