From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH for-1.7] target-i386: Fix build by providing stub kvm_arch_get_supported_cpuid() Date: Tue, 12 Nov 2013 15:23:37 +0200 Message-ID: <20131112132337.GB2008@redhat.com> References: <1384204922-8250-1-git-send-email-peter.maydell@linaro.org> <5281580D.7060305@redhat.com> <52816422.8060002@redhat.com> <52821A62.2050001@redhat.com> <52822958.8060508@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Peter Maydell , Anthony Liguori , QEMU Developers , kvm-devel , Patch Tracking , Andreas Tobler , Anthony Liguori To: Paolo Bonzini Return-path: Received: from mx1.redhat.com ([209.132.183.28]:25974 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754656Ab3KLNXu (ORCPT ); Tue, 12 Nov 2013 08:23:50 -0500 Content-Disposition: inline In-Reply-To: <52822958.8060508@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Nov 12, 2013 at 02:12:56PM +0100, Paolo Bonzini wrote: > Il 12/11/2013 13:16, Peter Maydell ha scritto: > > On 12 November 2013 12:09, Paolo Bonzini wrote: > >> Il 12/11/2013 12:07, Peter Maydell ha scritto: > >>> For the compiler to eliminate this we are relying on: > >>> * dead-code elimination of code following a 'break' > >>> statement in a case block > >>> * constant-folding of "something || 1" to 1 > >>> * the compiler having done enough reasoning to be > >>> sure that env is not NULL > >> > >> Yes, it's not trivial, but there are simpler ways to do it. > >> > >> For example there is no need to make sure that env is non-NULL, only to > >> see that "something || 1" is never zero and thus "if (x) y;" is just > >> "(void)x; y;". This seems easier to me than DCE after "break" which > >> clang is able to do. > > > > You seem to be trying to reason about what the compiler > > might choose to do or how it might be implemented internally. > > I'm not reasoning about that in general (I was in the context of the > message you quoted). > > I'm saying it's *reasonable* to expect that "-O0" means "reduce compile > time, make debugging produce expected results, and try (not too hard) to > not break what works at -O2". It's a simple QoI argument based on the > fact that people *will* switch back and forth between -O2 and -O0. Of > course not everything can be kept to work, since the compilers do pretty > surprising optimizations (not counting the ones that break your code of > course...). But I think a limited amount of dead code elimination > *should* be expected because most people are now preferring "if" to > "#ifdef" for compiling out code. > > If -O0 does not do that, let's move debug builds to -O1. > Why not enable dce with -fdce? -- Gleb.