08.09.2023 22:21, Paolo Bonzini wrote:
On Fri, Sep 8, 2023 at 7:28 PM Kevin Wolf <kw...@redhat.com> wrote:
Maybe the calls aren't eliminated because --enable-debug implies -O0?

My experience is that it will still fold simple dead code like "0 &&
foo()" or even "if (0) { ... }", but maybe it's a GCC vs. clang
difference. [..]

In my view it's too fragile to rely on this.  And yes, it's the clang
builds which triggers this issue.

We've a bugreport, https://gitlab.com/qemu-project/qemu/-/issues/1848 ,
where obviously-unreachable code hasn't been detected by gcc when
optimizing for certain CPU type.  This smells like a GCC bug but still
it's something which we shouldn't rely on.

What can be done though is, instead of making kvm_arch_get_supported_cpuid
et all a stubs, to replace them in .h file with an empty macro when some
condition(s) are met.  In other words, fold kvm_enabled() "inside" of
kvm_arch_get_supported_cpuid() and use some assert_not_reached() there.

/mjt

Reply via email to