Skip to content

Commit 25fcefb

Browse files
committed
Perform GVN inside coroutines.
1 parent 9d378de commit 25fcefb

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
@@ -340,7 +340,6 @@ struct VnState<'body, 'tcx> {
340340
tcx: TyCtxt<'tcx>,
341341
ecx: InterpCx<'tcx, DummyMachine>,
342342
local_decls: &'body LocalDecls<'tcx>,
343-
is_coroutine: bool,
344343
/// Value stored in each local.
345344
locals: IndexVec<Local, Option<VnIndex>>,
346345
/// Locals that are assigned that value.
@@ -376,7 +375,6 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
376375
tcx,
377376
ecx: InterpCx::new(tcx, DUMMY_SP, typing_env, DummyMachine),
378377
local_decls,
379-
is_coroutine: body.coroutine.is_some(),
380378
locals: IndexVec::from_elem(None, local_decls),
381379
rev_locals: IndexVec::with_capacity(num_values),
382380
values: ValueSet::new(num_values),
@@ -516,11 +514,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
516514
use Value::*;
517515
let ty = self.ty(value);
518516
// Avoid computing layouts inside a coroutine, as that can cause cycles.
519-
let ty = if !self.is_coroutine || ty.is_scalar() {
520-
self.ecx.layout_of(ty).ok()?
521-
} else {
522-
return None;
523-
};
517+
let ty = self.ecx.layout_of(ty).ok()?;
524518
let op = match *self.get(value) {
525519
_ if ty.is_zst() => ImmTy::uninit(ty).into(),
526520

0 commit comments

Comments
 (0)