]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
accel/tcg: Avoid load of icount_decr if unused
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 14 Sep 2023 14:39:07 +0000 (07:39 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Thu, 28 Sep 2023 17:07:32 +0000 (10:07 -0700)
With CF_NOIRQ and without !CF_USE_ICOUNT, the load isn't used.
Avoid emitting it.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
accel/tcg/translator.c

index 1a6a5448c8fb16080cfd90c2c018ad46049d550f..a3983019a5286e1f4beb49dc7ae61495a7968b47 100644 (file)
@@ -49,12 +49,15 @@ bool translator_io_start(DisasContextBase *db)
 
 static TCGOp *gen_tb_start(uint32_t cflags)
 {
-    TCGv_i32 count = tcg_temp_new_i32();
+    TCGv_i32 count = NULL;
     TCGOp *icount_start_insn = NULL;
 
-    tcg_gen_ld_i32(count, cpu_env,
-                   offsetof(ArchCPU, neg.icount_decr.u32) -
-                   offsetof(ArchCPU, env));
+    if ((cflags & CF_USE_ICOUNT) || !(cflags & CF_NOIRQ)) {
+        count = tcg_temp_new_i32();
+        tcg_gen_ld_i32(count, cpu_env,
+                       offsetof(ArchCPU, neg.icount_decr.u32) -
+                       offsetof(ArchCPU, env));
+    }
 
     if (cflags & CF_USE_ICOUNT) {
         /*