[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
================
@@ -1176,9 +1176,31 @@ struct LoopFuser {
return true;
}
+ 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.
+ for (Instruction *Inst : SafeToSink) {
+ LLVM_DEBUG(dbgs() << "UPDATING: Instruction: " << *Inst << "\n");
+ // Continue if the instruction is not a PHI node.
+ if (!isa<PHINode>(Inst))
+ continue;
+ PHINode *Phi = dyn_cast<PHINode>(Inst);
+ LLVM_DEBUG(dbgs() << "UPDATING: PHI node: " << *Phi << "\n");
----------------
kasuga-fj wrote:
Are the debug messages duplicated?
https://github.com/llvm/llvm-project/pull/147501
More information about the llvm-commits
mailing list