File tree 1 file changed +3
-3
lines changed
compiler/rustc_mir_transform/src
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -78,20 +78,20 @@ impl<'tcx> InstSimplifyContext<'_, 'tcx> {
78
78
/// GVN can also do this optimization, but GVN is only run at mir-opt-level 2 so having this in
79
79
/// InstSimplify helps unoptimized builds.
80
80
fn simplify_repeated_aggregate ( & self , rvalue : & mut Rvalue < ' tcx > ) {
81
- let Rvalue :: Aggregate ( box AggregateKind :: Array ( _) , fields) = rvalue else {
81
+ let Rvalue :: Aggregate ( box AggregateKind :: Array ( _) , fields) = & * rvalue else {
82
82
return ;
83
83
} ;
84
84
if fields. len ( ) < 5 {
85
85
return ;
86
86
}
87
- let first = & fields[ rustc_abi :: FieldIdx :: ZERO ] ;
87
+ let ( first, rest ) = fields[ .. ] . split_first ( ) . unwrap ( ) ;
88
88
let Operand :: Constant ( first) = first else {
89
89
return ;
90
90
} ;
91
91
let Ok ( first_val) = first. const_ . eval ( self . tcx , self . typing_env , first. span ) else {
92
92
return ;
93
93
} ;
94
- if fields . iter ( ) . all ( |field| {
94
+ if rest . iter ( ) . all ( |field| {
95
95
let Operand :: Constant ( field) = field else {
96
96
return false ;
97
97
} ;
You can’t perform that action at this time.
0 commit comments