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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 18 03:28:51 PDT 2025


================
@@ -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;
----------------
jayfoad wrote:

```suggestion
        Record.payload.Reg = VirtRegs.at(SDV);
```

https://github.com/llvm/llvm-project/pull/131722


More information about the llvm-commits mailing list