[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 30/35] tcg: Eliminate duplicate env store operations
|
From: |
Richard Henderson |
|
Subject: |
[PATCH 30/35] tcg: Eliminate duplicate env store operations |
|
Date: |
Mon, 6 Nov 2023 18:48:37 -0800 |
Notice when a constant is stored to the same location twice.
Reviewed-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tcg/optimize.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tcg/optimize.c b/tcg/optimize.c
index b32ef0be0f..a4fe9ee9bb 100644
--- a/tcg/optimize.c
+++ b/tcg/optimize.c
@@ -2269,6 +2269,19 @@ static bool fold_tcg_st_memcopy(OptContext *ctx, TCGOp
*op)
src = arg_temp(op->args[0]);
ofs = op->args[2];
type = ctx->type;
+
+ /*
+ * Eliminate duplicate stores of a constant.
+ * This happens frequently when the target ISA zero-extends.
+ */
+ if (ts_is_const(src)) {
+ TCGTemp *prev = find_mem_copy_for(ctx, type, ofs);
+ if (src == prev) {
+ tcg_op_remove(ctx->tcg, op);
+ return true;
+ }
+ }
+
last = ofs + tcg_type_size(type) - 1;
remove_mem_copy_in(ctx, ofs, last);
record_mem_copy(ctx, type, src, ofs, last);
--
2.34.1
- [PATCH 19/35] tcg: Move tcg_temp_free_* out of line, (continued)
- [PATCH 19/35] tcg: Move tcg_temp_free_* out of line, Richard Henderson, 2023/11/06
- [PATCH 20/35] tcg/mips: Split out tcg_out_setcond_int, Richard Henderson, 2023/11/06
- [PATCH 21/35] tcg/mips: Always implement movcond, Richard Henderson, 2023/11/06
- [PATCH 06/35] host/include/loongarch64: Add atomic16 load and store, Richard Henderson, 2023/11/06
- [PATCH 22/35] tcg: Remove TCG_TARGET_HAS_movcond_{i32,i64}, Richard Henderson, 2023/11/06
- [PATCH 23/35] tcg/mips: Implement neg opcodes, Richard Henderson, 2023/11/06
- [PATCH 24/35] tcg/loongarch64: Implement neg opcodes, Richard Henderson, 2023/11/06
- [PATCH 26/35] tcg: Don't free vector results, Richard Henderson, 2023/11/06
- [PATCH 27/35] tcg/optimize: Pipe OptContext into reset_ts, Richard Henderson, 2023/11/06
- [PATCH 29/35] tcg/optimize: Optimize env memory operations, Richard Henderson, 2023/11/06
- [PATCH 30/35] tcg: Eliminate duplicate env store operations,
Richard Henderson <=
- [PATCH 25/35] tcg: Remove TCG_TARGET_HAS_neg_{i32,i64}, Richard Henderson, 2023/11/06
- [PATCH 28/35] tcg/optimize: Split out cmp_better_copy, Richard Henderson, 2023/11/06
- [PATCH 31/35] tcg/optimize: Split out arg_new_constant, Richard Henderson, 2023/11/06
- [PATCH 32/35] tcg: Canonicalize subi to addi during opcode generation, Richard Henderson, 2023/11/06
- [PATCH 33/35] tcg/optimize: Canonicalize subi to addi during optimization, Richard Henderson, 2023/11/06
- [PATCH 34/35] tcg/optimize: Canonicalize sub2 with constants to add2, Richard Henderson, 2023/11/06
- [PATCH 35/35] tcg/sparc64: Implement tcg_out_extrl_i64_i32, Richard Henderson, 2023/11/06
- [PULL 00/35] tcg patch queue, Richard Henderson, 2023/11/06
- Re: [PATCH 00/35] tcg patch queue, Stefan Hajnoczi, 2023/11/07