Skip to content

Commit 2d9c57c

Browse files
committed
Perform GVN inside coroutines.
1 parent 2e7e956 commit 2d9c57c

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
@@ -362,7 +362,6 @@ struct VnState<'body, 'a, 'tcx> {
362362
tcx: TyCtxt<'tcx>,
363363
ecx: InterpCx<'tcx, DummyMachine>,
364364
local_decls: &'body LocalDecls<'tcx>,
365-
is_coroutine: bool,
366365
/// Value stored in each local.
367366
locals: IndexVec<Local, Option<VnIndex>>,
368367
/// Locals that are assigned that value.
@@ -403,7 +402,6 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> {
403402
tcx,
404403
ecx: InterpCx::new(tcx, DUMMY_SP, typing_env, DummyMachine),
405404
local_decls,
406-
is_coroutine: body.coroutine.is_some(),
407405
locals: IndexVec::from_elem(None, local_decls),
408406
rev_locals: IndexVec::with_capacity(num_values),
409407
values: ValueSet::new(num_values),
@@ -561,11 +559,7 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> {
561559
use Value::*;
562560
let ty = self.ty(value);
563561
// Avoid computing layouts inside a coroutine, as that can cause cycles.
564-
let ty = if !self.is_coroutine || ty.is_scalar() {
565-
self.ecx.layout_of(ty).ok()?
566-
} else {
567-
return None;
568-
};
562+
let ty = self.ecx.layout_of(ty).ok()?;
569563
let op = match self.get(value) {
570564
_ if ty.is_zst() => ImmTy::uninit(ty).into(),
571565

0 commit comments

Comments
 (0)