Skip to content

LLVM21 bug workaround: getFixedValue() - #9374

Open
mcourteaux wants to merge 2 commits into
mainfrom
mcourteaux/llvm21-load-elim-workaround
Open

LLVM21 bug workaround: getFixedValue()#9374
mcourteaux wants to merge 2 commits into
mainfrom
mcourteaux/llvm21-load-elim-workaround

Conversation

@mcourteaux

Copy link
Copy Markdown
Contributor

Test to see if Claude's analysis on a recent issue I ran into is indeed the fix for more than just my particular use case, but so many other tests which are just skipped now, due to LLVM 21 bug: llvm/llvm-project@d1500d12be60 (PR #169764)

Fixes [no tracking issue it seems]

Checklist

  • Tests added or updated (not required for docs, CI config, or typo fixes)
  • Documentation updated (if public API changed)
  • Python bindings updated (if public API changed)
  • Benchmarks are included here if the change is intended to affect performance.
  • Commits include AI attribution where applicable (see Code of Conduct)

mcourteaux and others added 2 commits August 21, 2026 09:16
LLVM 21's LoopAccessAnalysis::getStrideFromAddRec() queries a
scalable-vector access type's fixed element count without guarding
against ScalableVectorType, hitting a fatal assertion
(TypeSize::getFixedValue on a scalable TypeSize) inside
LoopLoadEliminationPass, which the default O3 pipeline always runs
regardless of Halide's own loop-opt settings. Fixed upstream in
LLVM 22. Loop load elimination looks for opportunities to forward a
store to a later load across loop iterations, which Halide-generated
code essentially never benefits from, so skip it entirely on affected
SVE targets under the buggy LLVM versions via
PassInstrumentationCallbacks::registerShouldRunOptionalPassCallback
rather than crash (or, in a no-asserts LLVM build, silently compute a
bogus stride).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
These tests were skipped under LLVM 21 + SVE2 because they tripped a
TypeSize::getFixedValue() assertion in LoopAccessAnalysis, reached via
LLVM's LoopLoadEliminationPass. The previous commit skips that pass on
SVE targets under LLVM < 22, which should make the underlying crash
unreachable; drop the test-level skips so CI on real ARM hardware can
confirm.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mcourteaux mcourteaux changed the title Mcourteaux/llvm21 load elim workaround LLVM21 bug workaround: getFixedValue() Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.97%. Comparing base (5c21c82) to head (fcc9970).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9374      +/-   ##
==========================================
- Coverage   70.08%   69.97%   -0.12%     
==========================================
  Files         260      260              
  Lines       79287    79295       +8     
  Branches    19327    19328       +1     
==========================================
- Hits        55569    55486      -83     
- Misses      17923    17927       +4     
- Partials     5795     5882      +87     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant