qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-1.7] target-i386: Fix build by providing stu


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH for-1.7] target-i386: Fix build by providing stub kvm_arch_get_supported_cpuid()
Date: Tue, 12 Nov 2013 14:12:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9

Il 12/11/2013 13:16, Peter Maydell ha scritto:
> On 12 November 2013 12:09, Paolo Bonzini <address@hidden> 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.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]