Auto merge of #76899 - wesleywiser:experimental_unsound_mir_opts_flag, r=oli-obk
[mir-opt] Introduce a new flag to enable experimental/unsound mir opts This implements part of https://github.com/rust-lang/compiler-team/issues/319. The exact name of this flag was not decided as part of that MCP and some people expressed that it should include "unsound" in some way. I've chosen to use `enable-experimental-unsound-mir-opts` as the name. While long, I don't think that matters too much as really it will only be used by some mir-opt tests. If you object or have a better name, please leave a comment! r? `@oli-obk` cc `@rust-lang/wg-mir-opt` `@RalfJung`
This commit is contained in:
commit
d62d3f7fa9
11 changed files with 263 additions and 216 deletions
|
@ -31,9 +31,11 @@ pub struct CopyPropagation;
|
|||
|
||||
impl<'tcx> MirPass<'tcx> for CopyPropagation {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) {
|
||||
let opts = &tcx.sess.opts.debugging_opts;
|
||||
// We only run when the MIR optimization level is > 1.
|
||||
// This avoids a slow pass, and messing up debug info.
|
||||
if tcx.sess.opts.debugging_opts.mir_opt_level <= 1 {
|
||||
// FIXME(76740): This optimization is buggy and can cause unsoundness.
|
||||
if opts.mir_opt_level <= 1 || !opts.unsound_mir_opts {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue