Ignore dead TLS loads

This commit is contained in:
Dmitry Stogov 2022-09-28 21:56:10 +03:00
parent a1361d77ba
commit fdaa0cea54
2 changed files with 10 additions and 0 deletions

View File

@ -4313,6 +4313,11 @@ static void ir_emit_tls(ir_ctx *ctx, ir_ref def, ir_insn *insn)
uint32_t code;
ir_reg reg = IR_REG_NUM(ctx->regs[def][0]);
if (ctx->use_lists[def].count == 1) {
/* dead load */
return;
}
||#ifdef __APPLE__
|| code = 0xd53bd060 | reg; // TODO: hard-coded: mrs reg, tpidrro_el0
| .long code

View File

@ -6842,6 +6842,11 @@ static void ir_emit_tls(ir_ctx *ctx, ir_ref def, ir_insn *insn)
dasm_State **Dst = &data->dasm_state;
ir_reg reg = IR_REG_NUM(ctx->regs[def][0]);
if (ctx->use_lists[def].count == 1) {
/* dead load */
return;
}
|.if X64
| fs
|| if (!insn->op3) {