From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLbXa-00024B-It for qemu-devel@nongnu.org; Mon, 16 Sep 2013 12:20:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLbXS-0003wn-2R for qemu-devel@nongnu.org; Mon, 16 Sep 2013 12:20:46 -0400 Received: from mail-ie0-x230.google.com ([2607:f8b0:4001:c03::230]:56938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLbXR-0003we-SR for qemu-devel@nongnu.org; Mon, 16 Sep 2013 12:20:37 -0400 Received: by mail-ie0-f176.google.com with SMTP id as1so7676357iec.21 for ; Mon, 16 Sep 2013 09:20:37 -0700 (PDT) Sender: Richard Henderson Message-ID: <52372FD0.7040700@twiddle.net> Date: Mon, 16 Sep 2013 09:20:32 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1379195690-6509-1-git-send-email-rth@twiddle.net> <1379195690-6509-5-git-send-email-rth@twiddle.net> <5236B659.5090608@huawei.com> In-Reply-To: <5236B659.5090608@huawei.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 04/33] tcg-aarch64: Hoist common argument loads in tcg_out_op List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Claudio Fontana Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org On 09/16/2013 12:42 AM, Claudio Fontana wrote: >> + /* Hoist the loads of the most common arguments. */ >> > + TCGArg a0 = args[0]; >> > + TCGArg a1 = args[1]; >> > + TCGArg a2 = args[2]; >> > + int c2 = const_args[2]; >> > + > Either all or none (add c0, c1), I would expect the compiler not to > generate code for the paths that don't use C[n]. I chose the most common. Those used in 90% of all of the cases. > > Btw, if the compiler generates bloated code without this, we should notify > the projects working on gcc for aarch64. It's not the compiler's fault. After parameter decomposition, the arrays become pointers, and the compiler can't tell that it's always safe to perform the loads. So in general it can't hoist the loads higher than the first explicit reference that proves the pointers must be non-null. Now that I think about it, we might actually do better, generically, to package all of these arguments up into a struct. The compiler can more easily reason about the collective safety of structure access... r~