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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 17 21:08:18 PDT 2025


================
@@ -916,13 +916,15 @@ 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;
+        assert(VirtRegs.count(SDV));
+        Record.payload.Reg = VirtRegs[SDV];
----------------
arsenm wrote:

could replace this with a if (!VirtRegs.insert) llvm_unreachable

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


More information about the llvm-commits mailing list