Skip to content

fix(LLVM): add --disable-non-volatile-memops and use it consistently#6416

Open
marxin wants to merge 20 commits intomainfrom
llvm-annotated-memory-ops
Open

fix(LLVM): add --disable-non-volatile-memops and use it consistently#6416
marxin wants to merge 20 commits intomainfrom
llvm-annotated-memory-ops

Conversation

@marxin
Copy link
Copy Markdown
Contributor

@marxin marxin commented Apr 8, 2026

This PR introduces the --disable-non-volatile-memops CLI option, which preserves the use of the volatile keyword for memory operations (as it was prior to #6212). Additionally, it refactors how load and store operations are emitted, significantly simplifying and unifying the Operator::X expansion.

Fixes: #6401

@marxin marxin requested a review from syrusakbary as a code owner April 8, 2026 15:26
Copilot AI review requested due to automatic review settings April 8, 2026 15:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a CLI switch to control LLVM’s “non-volatile memory ops” behavior (restoring pre-#6212 trap-on-OOB semantics when disabled) and refactors LLVM codegen to centralize/standardize how loads, stores, and atomics are emitted and annotated.

Changes:

  • Add --disable-non-volatile-memops (LLVM-only) and use it to conditionally enable enable_non_volatile_memops() in CLI engine configuration.
  • Refactor LLVM translator load/store/atomic emission via new build_annotated_* helpers (and pass TargetData into the function code generator for size computations).
  • Add a regression test for #6401 covering the “dropped SIMD load should still trap” behavior under volatile memops.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/compilers/issues.rs Adds a regression test for #6401 validating trap behavior differences between volatile vs non-volatile memops in LLVM.
lib/compiler-llvm/src/translator/code.rs Introduces helper builders for annotated load/store/atomics and refactors operator lowering to use them consistently.
lib/cli/src/backend.rs Adds the --disable-non-volatile-memops runtime option and wires it into LLVM engine/config setup.

@marxin marxin requested a review from theduke April 9, 2026 07:45
marxin and others added 2 commits April 9, 2026 13:35
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

LLVM backend does not trap on out-of-bounds SIMD load when result is dropped

2 participants