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

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 15 03:13:06 PDT 2025


================
@@ -988,8 +988,8 @@ struct LoopFuser {
 
             // If it is not safe to hoist/sink all instructions in the
             // pre-header, we cannot fuse these loops.
-            if (!collectMovablePreheaderInsts(*FC0, *FC1, SafeToHoist,
-                                              SafeToSink)) {
+            if (!collectAndFixMovablePreheaderInsts(*FC0, *FC1, SafeToHoist,
+                                                    SafeToSink)) {
----------------
kasuga-fj wrote:

Sorry, I didn’t fully check the surrounding context, but considering what the each function is supposed to do, it might make more sense to call `fixPHINodes` in `movePreheaderInsts` (I'm not familiar enough to determine which is better...).

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


More information about the llvm-commits mailing list