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

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 21:47:08 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.
----------------
madhur13490 wrote:

Added more description.

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


More information about the llvm-commits mailing list