mirror of
https://github.com/danog/ir.git
synced 2025-01-22 05:31:32 +01:00
Fix load fusion in combination with depended register spill load
This commit is contained in:
parent
a85f59a62d
commit
5103c18269
1
ir_ra.c
1
ir_ra.c
@ -564,6 +564,7 @@ int ir_compute_live_ranges(ir_ctx *ctx)
|
||||
do {
|
||||
if (ctx->ir_base[input].op == IR_LOAD) {
|
||||
input = ctx->ir_base[input].op2;
|
||||
use_flags = IR_USE_MUST_BE_IN_REG;
|
||||
if (input < 0 || ctx->rules[input] != IR_SKIP_MEM) {
|
||||
break;
|
||||
}
|
||||
|
@ -1956,14 +1956,14 @@ static int32_t ir_fuse_load(ir_ctx *ctx, ir_ref ref, ir_reg *preg)
|
||||
if (!IR_IS_CONST_REF(load_insn->op2)
|
||||
&& ir_rule(ctx, load_insn->op2) != IR_SKIP_MEM) {
|
||||
/* just fuse the LOAD itself */
|
||||
if (*preg != IR_REG_NONE) {
|
||||
if (*preg != IR_REG_NONE && *preg != ctx->regs[load_insn->op2][0]) {
|
||||
IR_ASSERT(!((*preg) & IR_REG_SPILL_LOAD));
|
||||
} else {
|
||||
ir_reg reg = ctx->regs[load_insn->op2][0];
|
||||
IR_ASSERT(reg != IR_REG_NONE);
|
||||
if (reg & IR_REG_SPILL_LOAD) {
|
||||
reg &= ~IR_REG_SPILL_LOAD;
|
||||
ir_emit_load(ctx, load_insn->type, reg, load_insn->op2);
|
||||
ir_emit_load(ctx, IR_ADDR, reg, load_insn->op2);
|
||||
}
|
||||
*preg = reg;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user