Skip to content

Commit fde15b0

Browse files
committed
Perform GVN inside coroutines.
1 parent 8f974ec commit fde15b0

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
@@ -216,7 +216,6 @@ struct VnState<'body, 'tcx> {
216216
tcx: TyCtxt<'tcx>,
217217
ecx: InterpCx<'tcx, DummyMachine>,
218218
local_decls: &'body LocalDecls<'tcx>,
219-
is_coroutine: bool,
220219
/// Value stored in each local.
221220
locals: IndexVec<Local, Option<VnIndex>>,
222221
/// Locals that are assigned that value.
@@ -254,7 +253,6 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
254253
tcx,
255254
ecx: InterpCx::new(tcx, DUMMY_SP, typing_env, DummyMachine),
256255
local_decls,
257-
is_coroutine: body.coroutine.is_some(),
258256
locals: IndexVec::from_elem(None, local_decls),
259257
rev_locals: IndexVec::with_capacity(num_values),
260258
values: FxIndexSet::with_capacity_and_hasher(num_values, Default::default()),
@@ -383,11 +381,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
383381
use Value::*;
384382
let ty = self.ty(value);
385383
// Avoid computing layouts inside a coroutine, as that can cause cycles.
386-
let ty = if !self.is_coroutine || ty.is_scalar() {
387-
self.ecx.layout_of(ty).ok()?
388-
} else {
389-
return None;
390-
};
384+
let ty = self.ecx.layout_of(ty).ok()?;
391385
let op = match *self.get(value) {
392386
_ if ty.is_zst() => ImmTy::uninit(ty).into(),
393387

0 commit comments

Comments
 (0)