Skip to content

Commit 9fa040e

Browse files
committed
explain why don't eval array locals as const operands
1 parent 779fa40 commit 9fa040e

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
805805
}
806806
Operand::Copy(ref mut place) | Operand::Move(ref mut place) => {
807807
let value = self.simplify_place_value(place, location)?;
808-
// In MIR, the array assignments are previously processed before operands.
808+
// NOTE(tesuji): We just want to promote rvalues of array kind that assigned to a local, and
809+
// not evaluate this local as a const operand of a function to avoid bloating MIR.
809810
if let Value::Aggregate(AggregateTy::Array, ..) = self.get(value) {
810811
return None;
811812
}

0 commit comments

Comments
 (0)