-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -Zlint-llvm-ir
#128970
Add -Zlint-llvm-ir
#128970
Conversation
I can now use
|
🤔 I though this can already be done, stabley, with |
I want to run lint the LLVM IR that rustc generates. Of course, I can use it together with |
@@ -652,6 +652,10 @@ impl Session { | |||
self.opts.unstable_opts.verify_llvm_ir || option_env!("RUSTC_VERIFY_LLVM_IR").is_some() | |||
} | |||
|
|||
pub fn lint_llvm_ir(&self) -> bool { | |||
self.opts.unstable_opts.lint_llvm_ir || option_env!("RUSTC_LINT_LLVM_IR").is_some() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This env var isn't set anywhere.
Sorry for the delay. My understanding is limited unfortunately, I can't tell the difference between |
The main difference is that with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with adding the flag. It may be more convenient to use in a larger compilation where -C no-prepopulate-passes
may be undesirable.
@@ -90,6 +91,9 @@ unsafe fn configure_llvm(sess: &Session) { | |||
if sess.opts.unstable_opts.print_llvm_passes { | |||
add("-debug-pass=Structure", false); | |||
} | |||
if llvm_version >= (19, 0, 0) && sess.opts.unstable_opts.lint_llvm_ir { | |||
add("-lint-abort-on-error", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should hardcode this option. You can add it via -Cllvm-args=-lint-abort-on-error
if desired.
@bors r+ |
…llaumeGomez Rollup of 7 pull requests Successful merges: - rust-lang#123940 (debug-fmt-detail option) - rust-lang#128166 (Improved `checked_isqrt` and `isqrt` methods) - rust-lang#128970 (Add `-Zlint-llvm-ir`) - rust-lang#129316 (riscv64imac: allow shadow call stack sanitizer) - rust-lang#129690 (Add `needs-unwind` compiletest directive to `libtest-thread-limit` and replace some `Path` with `path` in `run-make`) - rust-lang#129732 (Add `unreachable_pub`, round 3) - rust-lang#129743 (Fix rustdoc clippy lints) r? `@ghost` `@rustbot` modify labels: rollup
…llaumeGomez Rollup of 7 pull requests Successful merges: - rust-lang#123940 (debug-fmt-detail option) - rust-lang#128166 (Improved `checked_isqrt` and `isqrt` methods) - rust-lang#128970 (Add `-Zlint-llvm-ir`) - rust-lang#129316 (riscv64imac: allow shadow call stack sanitizer) - rust-lang#129690 (Add `needs-unwind` compiletest directive to `libtest-thread-limit` and replace some `Path` with `path` in `run-make`) - rust-lang#129732 (Add `unreachable_pub`, round 3) - rust-lang#129743 (Fix rustdoc clippy lints) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#128970 - DianQK:lint-llvm-ir, r=nikic Add `-Zlint-llvm-ir` This flag is similar to `-Zverify-llvm-ir` and allows us to lint the generated IR. r? compiler
This flag is similar to
-Zverify-llvm-ir
and allows us to lint the generated IR.r? compiler