[llvm] TwoAddressInstructions: Move the rescheduled copy chain back to front (PR #227289)
Christudasan Devadasan via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 06:50:38 PDT 2026
================
@@ -1065,8 +1065,9 @@ bool TwoAddressInstructionImpl::rescheduleMIBelowKill(
if (LIS) {
// We have to move the copies (and any interleaved debug instructions)
// first so that the MBB is still well-formed when calling handleMove().
- for (MachineBasicBlock::iterator MBBI = AfterMI; MBBI != End;) {
- auto CopyMI = MBBI++;
+ // Move them back to front, so a copy never ends up above its source def.
+ for (MachineBasicBlock::iterator MIIt(MI); std::next(MIIt) != End;) {
+ MachineBasicBlock::iterator CopyMI = std::prev(End);
----------------
cdevadas wrote:
Can't we hoist it somehow outside of the loop?
https://github.com/llvm/llvm-project/pull/227289
More information about the llvm-commits
mailing list