Skip to content

RegisterCoalescer: Avoid repeated getRegClass on all paths #129490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/lib/CodeGen/RegisterCoalescer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ bool CoalescerPair::setRegisters(const MachineInstr *MI) {
}

const MachineRegisterInfo &MRI = MI->getMF()->getRegInfo();
const TargetRegisterClass *SrcRC = MRI.getRegClass(Src);

if (Dst.isPhysical()) {
// Eliminate DstSub on a physreg.
Expand All @@ -490,15 +491,14 @@ bool CoalescerPair::setRegisters(const MachineInstr *MI) {

// Eliminate SrcSub by picking a corresponding Dst superregister.
if (SrcSub) {
Dst = TRI.getMatchingSuperReg(Dst, SrcSub, MRI.getRegClass(Src));
Dst = TRI.getMatchingSuperReg(Dst, SrcSub, SrcRC);
if (!Dst)
return false;
} else if (!MRI.getRegClass(Src)->contains(Dst)) {
} else if (!SrcRC->contains(Dst)) {
return false;
}
} else {
// Both registers are virtual.
const TargetRegisterClass *SrcRC = MRI.getRegClass(Src);
const TargetRegisterClass *DstRC = MRI.getRegClass(Dst);

// Both registers have subreg indices.
Expand Down
Loading