From 75f6895400f547a70597c3a5ea465413225fd5ee Mon Sep 17 00:00:00 2001 From: Evan Carroll Date: Mon, 19 Oct 2026 14:14:06 -0500 Subject: [PATCH] Raise MAX_SPLITS_PER_SPILLSET from 2 to 4 With a limit of 2, a bundle that spans a loop containing calls on x64, where every vector register is a clobber, is split twice and then falls back to `split_into_minimal_bundles`. That puts every gap between uses in the spill bundle, and the spill bundle crosses the calls, so it is given a stack slot: an accumulator updated in a call-free inner loop is then loaded and stored on every iteration. Allowing four splits keeps such values in registers in the inner loop, while still bounding the cost on inputs that need O(|bundle|) splits, which is what the fallback was added for in #59. --- src/ion/data_structures.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ion/data_structures.rs b/src/ion/data_structures.rs index ba036a11..8a81e537 100644 --- a/src/ion/data_structures.rs +++ b/src/ion/data_structures.rs @@ -310,7 +310,12 @@ pub struct SpillSet { pub range: CodeRange, } -pub(crate) const MAX_SPLITS_PER_SPILLSET: u8 = 2; +/// How many times a bundle (counted per spillset) is split in two before +/// `split_into_minimal_bundles` takes over. That fallback bounds compile time on +/// inputs needing O(|bundle|) splits, but it leaves every gap between uses in the +/// spill bundle, so a long bundle that only needed a few splits to get around +/// call clobbers also spills in the loops it spans. +pub(crate) const MAX_SPLITS_PER_SPILLSET: u8 = 4; #[derive(Clone, Debug)] pub struct VRegData {