File tree 1 file changed +4
-3
lines changed
crates/cairo-lang-lowering/src/optimizations
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ use crate::{
21
21
///
22
22
/// The list of call statements that can be moved is currently hardcoded.
23
23
///
24
- /// Removing unnecessary remapping before this optimization will result in better code .
24
+ /// Unused remapping should be removed before running this optimization (using `optimize_remappings`) .
25
25
pub fn reorder_statements ( db : & dyn LoweringGroup , lowered : & mut FlatLowered ) {
26
26
if lowered. blocks . is_empty ( ) {
27
27
return ;
@@ -152,8 +152,9 @@ impl Analyzer<'_> for ReorderStatementsContext<'_> {
152
152
_target_block_id : BlockId ,
153
153
remapping : & VarRemapping ,
154
154
) {
155
- for VarUsage { var_id, .. } in remapping. values ( ) {
156
- info. next_use . insert ( * var_id, statement_location) ;
155
+ for ( dst, src) in remapping. iter ( ) {
156
+ assert ! ( info. next_use. contains_key( dst) , "Unused remappings should be removed before running this optimization." ) ;
157
+ info. next_use . insert ( src. var_id , statement_location) ;
157
158
}
158
159
}
159
160
You can’t perform that action at this time.
0 commit comments