[llvm] [InlineSpiller][WIP] Hoist spills only when all of its subranges are available (PR #177703)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 26 09:54:11 PST 2026
================
@@ -1409,8 +1409,11 @@ bool HoistSpillHelper::isSpillCandBB(LiveInterval &OrigLI, VNInfo &OrigVNI,
for (const Register &SibReg : Siblings) {
LiveInterval &LI = LIS.getInterval(SibReg);
- VNInfo *VNI = LI.getVNInfoAt(Idx);
- if (VNI) {
+ if (!LI.getVNInfoAt(Idx))
+ continue;
+ if (all_of(LI.subranges(), [&](const LiveInterval::SubRange &SR) {
+ return SR.getVNInfoAt(Idx);
----------------
mshockwave wrote:
If you're suggesting checking against OrigVNI, my understanding is that it might lead to false negative: the sibling registers here are split from the original register. And when a new split register interval is created, its value number always starts from zero.
For example, a live interval `%438 [2792r,3104r:0)[3688r,6816r:1) 0 at 2792r 1 at 3688r`is split into two sibling registers
- `%438 [2792r,3104r:0) 0 at 2792r`
- `%439 [3688r,6816r:0) 0 at 3688r`
Let's say the OrigVNI (which is a pre-split VNI) is `1 at 3688r` here, and it's checking against a sibling VNI (which is a post-split VNI) of `0 at 3688r`. Even their value numbers are different, they're actually referring to the same value. It suffices to check just the slot index because I think the splitter creates two new LiveIntervals with different value numbers only if they have disjoint slot index ranges.
https://github.com/llvm/llvm-project/pull/177703
More information about the llvm-commits
mailing list