qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] trivial:Loop invariant eode motion in tcg/optimize.c
@ 2011-11-28  3:31 qemu_wanghuang
  2011-11-28  8:16 ` Peter Maydell
  2011-11-28  8:25 ` qemu_wanghuang
  0 siblings, 2 replies; 3+ messages in thread
From: qemu_wanghuang @ 2011-11-28  3:31 UTC (permalink / raw)
  Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]

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 <qemu_wanghuang@126.com>

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;



[-- Attachment #2: Type: text/html, Size: 2186 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-11-28  8:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-28  3:31 [Qemu-devel] [PATCH] trivial:Loop invariant eode motion in tcg/optimize.c qemu_wanghuang
2011-11-28  8:16 ` Peter Maydell
2011-11-28  8:25 ` qemu_wanghuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).