[llvm] [SPARC] Preserve liveins after leaf register remapping (PR #213359)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 2 14:02:03 PDT 2026
================
@@ -462,6 +463,20 @@ bool MachineRegisterInfo::isLiveIn(Register Reg) const {
return false;
}
+void MachineRegisterInfo::replaceLiveInPhysReg(MCRegister FromReg,
+ MCRegister ToReg) {
+ assert(FromReg.isPhysical() && ToReg.isPhysical() && FromReg != ToReg);
+ auto From = llvm::find_if(LiveIns, [FromReg](const auto &LiveIn) {
+ return LiveIn.first == FromReg;
+ });
+ if (From == LiveIns.end())
+ return;
+ assert(llvm::none_of(
+ LiveIns, [ToReg](const auto &LiveIn) { return LiveIn.first == ToReg; }));
+ From->first = ToReg;
+ llvm::sort(LiveIns);
----------------
arsenm wrote:
I doubt these need to be sorted
https://github.com/llvm/llvm-project/pull/213359
More information about the llvm-commits
mailing list