[llvm] [LoopFusion] Fix sink instructions (PR #147501)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 04:05:46 PDT 2025


================
@@ -1176,6 +1176,27 @@ struct LoopFuser {
     return true;
   }
 
+  // This function fixes sunk PHI nodes after fusion.
+  void fixPHINodes(SmallVector<Instruction *, 4> &SafeToSink,
+                   const FusionCandidate &FC0,
+                   const FusionCandidate &FC1) const {
+    // Iterate over SafeToSink instructions and update PHI nodes
+    // to take values from the latch block of FC0 if they are taking
+    // from the latch block of FC1.
----------------
Meinersbur wrote:

"if they are taking from the latch block of FC1." ???

I don't understant this comment, but I think it should be subsumed by a description of this helper function.

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


More information about the llvm-commits mailing list