Skip to content

Commit e0c2e81

Browse files
committed
explain why we ignore nested arrays
1 parent 65a9c75 commit e0c2e81

File tree

1 file changed

+5
-3
lines changed
  • compiler/rustc_mir_transform/src

1 file changed

+5
-3
lines changed

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
389389
AggregateTy::Array => {
390390
assert!(fields.len() > 0);
391391
let field_ty = fields[0].layout.ty;
392-
// Ignore nested array
392+
// FIXME: Ignore nested arrays, because arrays is large. Nested arrays are rarer and bigger
393+
// while we already process 1-dimension arrays, which is enough?
393394
if field_ty.is_array() {
394395
trace!(
395396
"ignoring nested array of type: [{field_ty}; {len}]",
@@ -814,7 +815,7 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
814815
}
815816
Operand::Copy(ref mut place) | Operand::Move(ref mut place) => {
816817
let value = self.simplify_place_value(place, location)?;
817-
// Ignore arrays in operands.
818+
// In MIR, the array assignments are previously processed before operands.
818819
if let Value::Aggregate(AggregateTy::Array, ..) = self.get(value) {
819820
return None;
820821
}
@@ -927,7 +928,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
927928
let (mut ty, variant_index) = match *kind {
928929
AggregateKind::Array(ty) => {
929930
assert!(!field_ops.is_empty());
930-
// Ignore nested arrays
931+
// FIXME: Ignore nested arrays, because arrays is large. Nested arrays are rarer and bigger
932+
// while we already process 1-dimension arrays, which is enough?
931933
if ty.is_array() {
932934
return None;
933935
}

0 commit comments

Comments
 (0)