The examples and validation below are recorded in the linked PRs. Merge and review status was refreshed on 8 October 2026.
The wrong result
A valid pair of nested loops used the ranges range(0, 4, 2) and range(0, 4, 3), with the loop indices unused. Each range has two iterations, so the inner body must run four times. xDSL’s loop-flattening pass combined them into a loop that ran only twice.
Expected: 2 × 2 = 4 body executions
Before fix: 2 body executions
After fix: 4, with the loops kept nested
The transformed intermediate representation still passed structural verification. The check that it was well formed did not establish that it preserved behavior.
The assumption behind the failure
The pass calculated the inner trip count using floor division: (4 − 0) // 3 = 1. But the range visits both 0 and 3. That formula was only safe when the span divided exactly by the step. A partial tile exposed the missing precondition.
The smallest defensible repair
Before changing the loop structure, the repair requires statically known positive steps and nonnegative spans that divide exactly by their steps. Partial or unknown ranges remain nested. Supported exact-tile cases still flatten, with their carried values preserved.
This intentionally gives up some optimization opportunities. It does not introduce a broader dynamic or ceiling-division algorithm, claim a speedup, or settle every overflow and type limit of the pass.
What the review changed
A maintainer asked how upstream MLIR handled the same boundary. I compared its broader coalescing algorithm, which uses ceiling division, and explained why this patch instead conservatively declines the unsupported cases. Review then moved the regression evidence into xDSL’s existing FileCheck tests with comments explaining the expected result.
The final coverage includes inner and outer remainders, unknown bounds, empty ranges and supported nonzero bounds, alongside existing exact-tile and carried-value checks. The repair merged on 22 September 2026. The value is a preserved computation and a regression check maintainers can keep using.
A program can be valid and still change meaning.
In one case, xDSL treated positive and negative zero as equal when comparing floating-point attributes. An optimization could then combine constants and expressions that needed to remain distinct.
For an input of negative zero, the example’s two additions should preserve different signs.
Expected: (+0.0, −0.0)
Before fix: (+0.0, +0.0)
Both versions passed structural verification. Comparing behavior exposed the difference.
When a calculation silently does nothing.
With dynamically shaped arrays, the linear-algebra interpreter could use an unknown static dimension as a loop bound and run zero iterations. A valid program could return normally without computing the intended result.
A program intended to fill a three-element array with sevens left the output at zero.
Expected: [7, 7, 7]
Before fix: [0, 0, 0]
After fix: [7, 7, 7]
The fix derives loop bounds from the actual runtime array shapes. Its regression coverage includes different sizes, empty arrays, tensor and buffer operations, and transpose.
This repair is limited to interpreter execution. Compiler-pass shape inference and indexing-map support are unchanged.
All six repairs and their distinct value
I narrowed each issue to a specific semantic condition, repaired the implementation and added regression coverage. The signed-zero fix keeps equal values of the same sign mergeable while preserving the distinction between opposite signs.
- Preserve signed zero in floating-point equalityPrevent constant elimination from merging expressions with different signed-zero behavior. Review refined equality logic, NaN checks and the integration fixture.
- Preserve special values in division foldingPreserve the sign of infinity and NaN behavior during constant folding. For example, 1.0 / −0.0 must produce negative infinity. Review consolidated the special-value cases into the project’s integration-test convention.
- Require positive factors for loop-range foldingPrevent a valid positive-step loop from becoming an invalid zero- or negative-step loop. Review distinguished valid source input from the invalid loop the rewrite introduced.
- Require exact tiling before loop flatteningPreserve iteration counts for partial ranges; leave them nested when the existing flattening formula is not justified. Review compared MLIR and refined the regression fixtures.
- Use runtime shapes for interpreter loop boundsPrevent valid array operations from silently doing no work. Review checked scalar inputs; existing scalar-output limitations remain explicit.
- Reject unsupported LLVM call operand bundlesMake unsupported call metadata fail explicitly before LLVM IR is emitted, including empty bundles represented by size metadata. Ordinary calls still lower. The final review requested a type-stub annotation; that was supplied before merge.
The accepted result
All six fixes were merged into xDSL’s main branch. Official GitHub records were checked on 8 October 2026; no authored xDSL PR remains open. Each leaves a focused regression check alongside the repair. The contribution is bounded correctness work; it does not establish the correctness of the compiler as a whole.
Developed with AI assistance. The linked contributions describe the executed checks, review changes and remaining limits.