Skip to content

Commit cf377dc

Browse files
committed
Perform GVN inside coroutines.
1 parent 02eeaf9 commit cf377dc

File tree

1 file changed

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

1 file changed

+1
-7
lines changed

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ struct VnState<'body, 'tcx> {
215215
tcx: TyCtxt<'tcx>,
216216
ecx: InterpCx<'tcx, DummyMachine>,
217217
local_decls: &'body LocalDecls<'tcx>,
218-
is_coroutine: bool,
219218
/// Value stored in each local.
220219
locals: IndexVec<Local, Option<VnIndex>>,
221220
/// Locals that are assigned that value.
@@ -253,7 +252,6 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
253252
tcx,
254253
ecx: InterpCx::new(tcx, DUMMY_SP, typing_env, DummyMachine),
255254
local_decls,
256-
is_coroutine: body.coroutine.is_some(),
257255
locals: IndexVec::from_elem(None, local_decls),
258256
rev_locals: IndexVec::with_capacity(num_values),
259257
values: FxIndexSet::with_capacity_and_hasher(num_values, Default::default()),
@@ -382,11 +380,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
382380
use Value::*;
383381
let ty = self.ty(value);
384382
// Avoid computing layouts inside a coroutine, as that can cause cycles.
385-
let ty = if !self.is_coroutine || ty.is_scalar() {
386-
self.ecx.layout_of(ty).ok()?
387-
} else {
388-
return None;
389-
};
383+
let ty = self.ecx.layout_of(ty).ok()?;
390384
let op = match *self.get(value) {
391385
_ if ty.is_zst() => ImmTy::uninit(ty).into(),
392386

0 commit comments

Comments
 (0)