[LLVMdev] LLVM 2.4 problem? (resend)
Eli Friedman
eli.friedman at gmail.com
Wed Oct 15 21:52:59 PDT 2008
On Wed, Oct 15, 2008 at 8:26 AM, Nick Lewycky <nicholas at mxc.ca> wrote:
> Duncan Sands wrote:
>>> True, but note that it is the address of a variable that is used, not
>>> the value.
>>
>> Yes, but why do you think they should get a different address? I can
>> understand that it is surprising that they do, but determining whether
>> this is legal or not requires reading the language standard. Hopefully
>> a language lawyer can chime in and say whether this transform is valid
>> or not.
>
> Change the return statement to:
>
> return test1 == test2;
>
> LLVM will constant-fold that to false, which is inconsistent with the
> other optimization.
Ouch, this could be seriously dangerous: following impossible
codepaths can cause very subtle bugs.
-Eli
More information about the llvm-dev
mailing list