Result of PARAM may be stored into a spill slot without register

This commit is contained in:
Dmitry Stogov 2022-05-04 09:50:23 +03:00
parent a5b676b590
commit 4f294109e8
2 changed files with 11 additions and 1 deletions

10
ir_ra.c
View File

@ -1506,7 +1506,15 @@ static ir_reg ir_allocate_blocked_reg(ir_ctx *ctx, int current, uint32_t len, ir
/* all other intervals are used before current, so it is best to spill current itself */
/* assign spill slot to current */
/* split current before its first use position that requires a register */
ir_live_pos split_pos = ir_find_optimal_split_position(ctx, current, ival, ival->range.start, next_use_pos - 1);
ir_live_pos split_pos;
if (next_use_pos == ival->range.start) {
IR_ASSERT(use_pos && use_pos->op_num == 0);
/* split right after definition */
split_pos = next_use_pos + 1;
} else {
split_pos = ir_find_optimal_split_position(ctx, current, ival, ival->range.start, next_use_pos - 1);
}
if (split_pos > ival->range.start) {
IR_LOG_LSRA(" ---- Conflict with others", current, ival, " (all others are used before)");

View File

@ -959,6 +959,8 @@ uint8_t ir_get_use_flags(ir_ctx *ctx, ir_ref ref, int op_num)
case IR_DIV_INT:
case IR_MOD_INT:
return (op_num == 2) ? IR_USE_SHOULD_BE_IN_REG : IR_USE_MUST_BE_IN_REG;
case IR_PARAM:
return IR_USE_SHOULD_BE_IN_REG;
}
return IR_USE_MUST_BE_IN_REG;