[LLVMdev] Build Failure

David Blaikie dblaikie at gmail.com
Thu Jan 3 09:20:01 PST 2013


On Thu, Jan 3, 2013 at 8:58 AM,  <dag at cray.com> wrote:
> Krzysztof Parzyszek <kparzysz at codeaurora.org> writes:
>
>> The logic of the program may be such that the actual store (not the
>> "pre-initialization") always happens before any uses, but the compiler
>> may be unable to prove it.  In such case, the added initialization
>> will extend the live range of the object and may result in a register
>> spill.
>
> I also want to note that this is exactly the kind of premature
> optimization that Knuth warns about.

I suspect it isn't. We're not going out of our way to obfuscate the
code or spend time on this - we're just simply not doing work we don't
need to. It's the attempt to suppress the warning that's leading us
astray.

>   Is it really worth generating a
> warning from the compiler to save 1-2 cycles in initialization code when
> we don't even know that the (extremely slight) performance loss matters?

No one's suggesting that.

(if the compiler can prove that the write is unnecessary, it'll simply
optimize it away anyway - so such a warning wouldn't make sense, at
best it would be a tiny compile-time improvement, but not a runtime
issue at all (that being said, we do have warnings like -Wweak-vtables
that are a compile time perf  issue only))



More information about the llvm-dev mailing list