add -Z flag for AddValidation pass
This commit is contained in:
parent
e869cf2be7
commit
23cd90ed41
@ -1025,6 +1025,8 @@ fn parse_optimization_fuel(slot: &mut Option<(String, u64)>, v: Option<&str>) ->
|
||||
"the directory the MIR is dumped into"),
|
||||
dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED],
|
||||
"if set, exclude the pass number when dumping MIR (used in tests)"),
|
||||
mir_emit_validate: bool = (false, parse_bool, [TRACKED],
|
||||
"emit Validate MIR statements, interpreted e.g. by miri"),
|
||||
perf_stats: bool = (false, parse_bool, [UNTRACKED],
|
||||
"print some performance-related statistics"),
|
||||
hir_stats: bool = (false, parse_bool, [UNTRACKED],
|
||||
|
@ -85,6 +85,10 @@ fn run_pass<'a, 'tcx>(&self,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
_: MirSource,
|
||||
mir: &mut Mir<'tcx>) {
|
||||
if !tcx.sess.opts.debugging_opts.mir_emit_validate {
|
||||
return;
|
||||
}
|
||||
|
||||
let local_decls = mir.local_decls.clone(); // TODO: Find a way to get rid of this clone.
|
||||
|
||||
/// Convert an lvalue to a validation operand.
|
||||
|
@ -77,6 +77,12 @@ fn visit_statement(&mut self,
|
||||
block: BasicBlock,
|
||||
statement: &mut Statement<'tcx>,
|
||||
location: Location) {
|
||||
if !self.tcx.sess.opts.debugging_opts.mir_emit_validate {
|
||||
if let StatementKind::EndRegion(_) = statement.kind {
|
||||
statement.kind = StatementKind::Nop;
|
||||
}
|
||||
}
|
||||
|
||||
self.in_validation_statement = match statement.kind {
|
||||
StatementKind::Validate(..) => true,
|
||||
_ => false,
|
||||
|
Loading…
Reference in New Issue
Block a user