Skip to content

[llvm] Support multiple save/restore points in mir #119357

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

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
review
  • Loading branch information
enoskova-sc committed Apr 2, 2025
commit dbd589045c658c865690af9cd81bbb62afb1cbee
12 changes: 3 additions & 9 deletions llvm/include/llvm/CodeGen/MachineFrameInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -915,11 +915,8 @@ class MachineFrameInfo {
RestorePoints = std::move(NewRestorePoints);
}

void setSavePoint(MachineBasicBlock *MBB, std::vector<Register> &Regs) {
if (SavePoints.contains(MBB))
SavePoints[MBB] = Regs;
else
SavePoints.insert(std::make_pair(MBB, Regs));
void setSavePoint(MachineBasicBlock *MBB, const std::vector<Register> &Regs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no callers of this function. Drop it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

SavePoints[MBB] = Regs;
}

static const SaveRestorePoints constructSaveRestorePoints(
Expand All @@ -933,10 +930,7 @@ class MachineFrameInfo {
}

void setRestorePoint(MachineBasicBlock *MBB, std::vector<Register> &Regs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no callers of this function. Drop it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed

if (RestorePoints.contains(MBB))
RestorePoints[MBB] = Regs;
else
RestorePoints.insert(std::make_pair(MBB, Regs));
RestorePoints[MBB] = Regs;
}

MachineBasicBlock *getProlog() const { return Prolog; }
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/MIRParser/MIRParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ bool MIRParserImpl::initializeSaveRestorePoints(
SMDiagnostic Error;
MachineBasicBlock *MBB = nullptr;
llvm::SaveRestorePoints SRPoints;
std::vector<Register> Registers{};
std::vector<Register> Registers;

if (std::holds_alternative<std::vector<yaml::SaveRestorePointEntry>>(
YamlSRPoints)) {
Expand All @@ -1100,7 +1100,6 @@ bool MIRParserImpl::initializeSaveRestorePoints(
Register Reg;
if (parseNamedRegisterReference(PFS, Reg, RegStr.Value, Error))
return error(Error, RegStr.SourceRange);

Registers.push_back(Reg);
}
SRPoints.insert(std::make_pair(MBB, Registers));
Expand Down