From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAZmC-0005vz-EE for qemu-devel@nongnu.org; Sat, 17 Aug 2013 02:14:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VAZm6-0005qx-KL for qemu-devel@nongnu.org; Sat, 17 Aug 2013 02:14:16 -0400 Received: from mail-qa0-x22d.google.com ([2607:f8b0:400d:c00::22d]:40190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAZm6-0005qq-Gb for qemu-devel@nongnu.org; Sat, 17 Aug 2013 02:14:10 -0400 Received: by mail-qa0-f45.google.com with SMTP id l18so900971qak.4 for ; Fri, 16 Aug 2013 23:14:10 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Fri, 16 Aug 2013 23:13:26 -0700 Message-Id: <1376720014-1894-2-git-send-email-rth@twiddle.net> In-Reply-To: <1376720014-1894-1-git-send-email-rth@twiddle.net> References: <1376720014-1894-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH v2 1/9] 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: 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