qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] trivial:Loop invariant eode motion in tcg/optimize.


From: qemu_wanghuang
Subject: [Qemu-devel] [PATCH] trivial:Loop invariant eode motion in tcg/optimize.c
Date: Mon, 28 Nov 2011 11:31:49 +0800 (CST)

We find that the "new_base" doesn't change during in the following loop, so we can outer this judgement from this loop.

Signed-off-by: Wanghuang <address@hidden>

diff --git a/qemu/tcg/optimize.c b/qemu-local/tcg/optimize.c

index 9c65474..27164f0 100644

--- a/qemu/tcg/optimize.c

+++ b/qemu-local/tcg/optimize.c

@@ -67,12 +67,12 @@ static void reset_temp(TCGArg temp, int nb_temps, int nb_globals)

                 break;

             }

         }

-        for (i = temps[temp].next_copy; i != temp; i = temps[i].next_copy) {

-            if (new_base == (TCGArg)-1) {

+       if (new_base == (TCGArg)-1) {

+           for (i = temps[temp].next_copy; i != temp; i = temps[i].next_copy) 

                 temps[i].state = TCG_TEMP_ANY;

-            } else {

+       } else { 

+          for (i = temps[temp].next_copy; i != temp; i = temps[i].next_copy) 

                 temps[i].val = new_base;

-            }

         }

         temps[temps[temp].next_copy].prev_copy = temps[temp].prev_copy;

         temps[temps[temp].prev_copy].next_copy = temps[temp].next_copy;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]