Skip to content

Commit 8c2497b

Browse files
committed
cache propagated const
1 parent a5fd8d9 commit 8c2497b

File tree

1 file changed

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

1 file changed

+4
-0
lines changed

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,6 +1373,10 @@ impl<'tcx> VnState<'_, 'tcx> {
13731373
assert!(!value.may_have_provenance(self.tcx, op.layout.size));
13741374

13751375
let const_ = Const::Val(value, op.layout.ty);
1376+
// cache the propagated const
1377+
if let Some(new_index) = self.insert_constant(const_) {
1378+
self.values.swap_indices(index.as_usize(), new_index.as_usize());
1379+
}
13761380
Some(ConstOperand { span: DUMMY_SP, user_ty: None, const_ })
13771381
}
13781382

0 commit comments

Comments
 (0)