[llvm] bba9172 - [RegAlloc] Strengthen asserts in LiveRangeEdit::scanRemattable [nfc] (#160765)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 26 06:55:10 PDT 2025
Author: Philip Reames
Date: 2025-09-26T06:55:07-07:00
New Revision: bba91727789bed302758dac282107a44c7b33504
URL: https://github.com/llvm/llvm-project/commit/bba91727789bed302758dac282107a44c7b33504
DIFF: https://github.com/llvm/llvm-project/commit/bba91727789bed302758dac282107a44c7b33504.diff
LOG: [RegAlloc] Strengthen asserts in LiveRangeEdit::scanRemattable [nfc] (#160765)
We should always be able to find the VNInfo in the original live
interval which corresponds to the subset we're trying to spill, and the
only cases where we have a VNInfo without a definition instruction are
if the vni is unused, or corresponds to a phi. Adjust the code structure
to explicitly check for PHIDef, and assert the stronger conditions.
Added:
Modified:
llvm/lib/CodeGen/LiveRangeEdit.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/LiveRangeEdit.cpp b/llvm/lib/CodeGen/LiveRangeEdit.cpp
index 59bc82dc267b5..4aeacc332476d 100644
--- a/llvm/lib/CodeGen/LiveRangeEdit.cpp
+++ b/llvm/lib/CodeGen/LiveRangeEdit.cpp
@@ -75,11 +75,11 @@ void LiveRangeEdit::scanRemattable() {
Register Original = VRM->getOriginal(getReg());
LiveInterval &OrigLI = LIS.getInterval(Original);
VNInfo *OrigVNI = OrigLI.getVNInfoAt(VNI->def);
- if (!OrigVNI)
+ assert(OrigVNI && "Corrupt interval mapping?");
+ if (OrigVNI->isPHIDef())
continue;
MachineInstr *DefMI = LIS.getInstructionFromIndex(OrigVNI->def);
- if (!DefMI)
- continue;
+ assert(DefMI && "Missing instruction for def slot");
if (TII.isReMaterializable(*DefMI))
Remattable.insert(OrigVNI);
}
More information about the llvm-commits
mailing list