aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-03-18 00:26:59 -0700
committerGitHub <noreply@github.com>2025-03-18 00:26:59 -0700
commit62204482c02e896d7c86b2483952169968ad1ae5 (patch)
tree86e56cfdf4f23684b6c4d9f84926bf786ebfec48 /llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
parentf6ad65a8248d8fdc03b602891aabbdf715e589b0 (diff)
downloadllvm-62204482c02e896d7c86b2483952169968ad1ae5.zip
llvm-62204482c02e896d7c86b2483952169968ad1ae5.tar.gz
llvm-62204482c02e896d7c86b2483952169968ad1ae5.tar.bz2
[CodeGen] Avoid repeated hash lookups (NFC) (#131722)
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
index 735dcef..80aeefe 100644
--- a/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/StatepointLowering.cpp
@@ -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;
+ }
} else if (Loc.getNode()) {
Record.type = RecordType::Spill;
Record.payload.FI = cast<FrameIndexSDNode>(Loc)->getIndex();