Repository navigation
fix(mlir): null-init ptr statics + short-circuit and/or (#230) - #249
Merged
Merged
Conversation
Bare `llvm.mlir.global … : !llvm.ptr` lowered to `ptr undef`, so doom-flow null checks failed. Emit `llvm.mlir.zero` init bodies instead. Boolean `and`/`or` used eager `arith.andi`/`ori`, so `getenv(...) == null or p[0] == 0` dereferenced null. Lower with `scf.if` so the RHS is skipped when the LHS decides (needed for #230). Co-authored-by: Abhishek Shivakumar <[email protected]>
Contributor
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
The generator now emits llvm.mlir.zero bodies for module-scope pointer globals; update the stale bare-global assertion so CI passes. Co-authored-by: Abhishek Shivakumar <[email protected]>
cursor Bot
pushed a commit
that referenced
this pull request
Aug 9, 2026
Co-authored-by: Abhishek Shivakumar <[email protected]>
godofecht
pushed a commit
that referenced
this pull request
Aug 9, 2026
…b994 fix(mlir): null-init ptr statics + short-circuit and/or (#230)
godofecht
added a commit
that referenced
this pull request
Aug 9, 2026
Co-authored-by: Abhishek Shivakumar <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Toward #230 (doom-flow on MLIR).
Triage / merge order: independent of #248 (no overlapping files). Prefer merging this first — it unblocks further #230 WAD/I/O work. #248 is gallery/pthreads and can land anytime.
Browser testing showed MLIR doom either crashing or booting to a black canvas with
W_ReadLump: incomplete read. Two generator bugs contributed to the crash/UB path:Fixes
llvm.mlir.global … : !llvm.ptrlowered to LLVMptr undef, so null checks failed. Emit an init region withllvm.mlir.zero.and/or— eagerarith.andi/orievaluatedgetenv(...) == null or p[0] == 0and dereferenced null. Lower withscf.ifso the RHS is skipped when the LHS decides.Still open for #230
Even with these fixes +
#247--wasm32, MLIR doom reaches “running 640×400” but does not render; page log shows incomplete WAD reads. C→emcc still plays. Next likely: remaining LP64-vs-ILP32 handle/layout mismatches in wad I/O beyond the libc remap.doom-flow Pages
Cannot push to
godofecht/doom-flow(403). Local patch keeps Pages on the working C bundle until MLIR renders.Test plan
pytest tests/unit/test_mlir_null_ptr_statics.pypytest tests/unit/test_mlir_generator.py::TestMLIRNullPointerLiterals(updated for null-init globals)pytest tests/unit/test_mlir_chained_ast.py