Skip to content

Commit b95ff5c

Browse files
committed
Fix GVN
1 parent 491dd4d commit b95ff5c

File tree

1 file changed

+4
-1
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+4
-1
lines changed

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ impl<'tcx> crate::MirPass<'tcx> for GVN {
131131
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
132132
debug!(def_id = ?body.source.def_id());
133133

134-
let typing_env = body.typing_env(tcx);
134+
let typing_env = match self {
135+
GVN::Polymorphic => body.typing_env(tcx),
136+
GVN::PostMono => ty::TypingEnv::fully_monomorphized(),
137+
};
135138
let ssa = SsaLocals::new(tcx, body, typing_env);
136139
// Clone dominators because we need them while mutating the body.
137140
let dominators = body.basic_blocks.dominators().clone();

0 commit comments

Comments
 (0)