From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VE3uB-0002nE-Bf for qemu-devel@nongnu.org; Mon, 26 Aug 2013 17:01:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VE3u5-00057p-GH for qemu-devel@nongnu.org; Mon, 26 Aug 2013 17:00:55 -0400 Received: from mail-qc0-x22e.google.com ([2607:f8b0:400d:c01::22e]:50506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VE3u5-00057k-D2 for qemu-devel@nongnu.org; Mon, 26 Aug 2013 17:00:49 -0400 Received: by mail-qc0-f174.google.com with SMTP id e10so1406574qcy.33 for ; Mon, 26 Aug 2013 14:00:49 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Mon, 26 Aug 2013 14:00:06 -0700 Message-Id: <1377550812-908-2-git-send-email-rth@twiddle.net> In-Reply-To: <1377550812-908-1-git-send-email-rth@twiddle.net> References: <1377550812-908-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PULL 1/7] tcg: Tidy generated code for tcg_outN List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: anthony@codemonkey.ws, aurelien@aurel32.net Aliasing was forcing s->code_ptr to be re-read after the store. Keep the pointer in a local variable to help the compiler. Signed-off-by: Richard Henderson --- tcg/tcg.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index dac8224..42c95af 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -121,14 +121,16 @@ static inline void tcg_out8(TCGContext *s, uint8_t v) static inline void tcg_out16(TCGContext *s, uint16_t v) { - *(uint16_t *)s->code_ptr = v; - s->code_ptr += 2; + uint8_t *p = s->code_ptr; + *(uint16_t *)p = v; + s->code_ptr = p + 2; } static inline void tcg_out32(TCGContext *s, uint32_t v) { - *(uint32_t *)s->code_ptr = v; - s->code_ptr += 4; + uint8_t *p = s->code_ptr; + *(uint32_t *)p = v; + s->code_ptr = p + 4; } /* label relocation processing */ -- 1.8.1.4