Skip to content

[CodeGen] Avoid repeated hash lookups (NFC) #131722

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
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
17 changes: 10 additions & 7 deletions llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,13 +916,16 @@ SDValue SelectionDAGBuilder::LowerAsSTATEPOINT(
bool IsLocal = (Relocate->getParent() == StatepointInstr->getParent());

RecordType Record;
if (IsLocal && LowerAsVReg.count(SDV)) {
// Result is already stored in StatepointLowering
Record.type = RecordType::SDValueNode;
} else if (LowerAsVReg.count(SDV)) {
Record.type = RecordType::VReg;
assert(VirtRegs.count(SDV));
Record.payload.Reg = VirtRegs[SDV];
if (LowerAsVReg.count(SDV)) {
if (IsLocal) {
// Result is already stored in StatepointLowering
Record.type = RecordType::SDValueNode;
} else {
Record.type = RecordType::VReg;
auto It = VirtRegs.find(SDV);
assert(It != VirtRegs.end());
Record.payload.Reg = It->second;
Comment on lines +925 to +927
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
auto It = VirtRegs.find(SDV);
assert(It != VirtRegs.end());
Record.payload.Reg = It->second;
Record.payload.Reg = VirtRegs.at(SDV);

}
} else if (Loc.getNode()) {
Record.type = RecordType::Spill;
Record.payload.FI = cast<FrameIndexSDNode>(Loc)->getIndex();
Expand Down