File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -912,6 +912,19 @@ cfg_builder_use_label(cfg_builder *g, jump_target_label lbl)
912
912
return cfg_builder_maybe_start_new_block (g );
913
913
}
914
914
915
+ static inline int
916
+ basicblock_append_instructions (basicblock * target , basicblock * source )
917
+ {
918
+ for (int i = 0 ; i < source -> b_iused ; i ++ ) {
919
+ int n = basicblock_next_instr (target );
920
+ if (n < 0 ) {
921
+ return -1 ;
922
+ }
923
+ target -> b_instr [n ] = source -> b_instr [i ];
924
+ }
925
+ return 0 ;
926
+ }
927
+
915
928
static basicblock *
916
929
copy_basicblock (cfg_builder * g , basicblock * block )
917
930
{
@@ -923,12 +936,8 @@ copy_basicblock(cfg_builder *g, basicblock *block)
923
936
if (result == NULL ) {
924
937
return NULL ;
925
938
}
926
- for (int i = 0 ; i < block -> b_iused ; i ++ ) {
927
- int n = basicblock_next_instr (result );
928
- if (n < 0 ) {
929
- return NULL ;
930
- }
931
- result -> b_instr [n ] = block -> b_instr [i ];
939
+ if (basicblock_append_instructions (result , block ) < 0 ) {
940
+ return NULL ;
932
941
}
933
942
return result ;
934
943
}
@@ -9268,12 +9277,8 @@ inline_small_exit_blocks(basicblock *bb) {
9268
9277
basicblock * target = last -> i_target ;
9269
9278
if (basicblock_exits_scope (target ) && target -> b_iused <= MAX_COPY_SIZE ) {
9270
9279
last -> i_opcode = NOP ;
9271
- for (int i = 0 ; i < target -> b_iused ; i ++ ) {
9272
- int index = basicblock_next_instr (bb );
9273
- if (index < 0 ) {
9274
- return -1 ;
9275
- }
9276
- bb -> b_instr [index ] = target -> b_instr [i ];
9280
+ if (basicblock_append_instructions (bb , target ) < 0 ) {
9281
+ return -1 ;
9277
9282
}
9278
9283
return 1 ;
9279
9284
}
You can’t perform that action at this time.
0 commit comments