[llvm] [LoopFusion] Fix sink instructions (PR #147501)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 10 18:20:36 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:
At this point, it seems that whether fusion will be performed has not yet been determined. At the very least, it could potentially be rejected at the later beneficial check (although it currently always returns true). The IR should not be modified until we actually decide to perform the fusion. Maybe `fixPHINodes` should be executed in `performFusion`.
https://github.com/llvm/llvm-project/pull/147501
More information about the llvm-commits
mailing list