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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 1 01:08:45 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});
----------------
nikic wrote:

We can, but I don't see a difference in compile-time from adding this special case.

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


More information about the llvm-commits mailing list