[LLVMdev] LLVMdev Digest, Vol 76, Issue 43
Alasdair Grant
Alasdair.Grant at arm.com
Tue Oct 26 07:44:06 PDT 2010
John Criswell writes:
> In my opinion, I think you guys are really overthinking this: volatile
> should be volatile should be volatile. It makes the behavior of
> volatile easy to understand, it makes it easy to use, it allows LLVM to
> support the rules for the volatile keyword in C (AFAIK), and it doesn't
> require you to guess all the different, contorted ways in which
> volatile
> could be used.
Absolutely. Another place we see volatile being used on locals is
timing loops:
{ volatile int i;
for (i = 0; i < 10; ++i) {}
}
Optimizing away the loop on the basis that nothing observable is
happening so it's "as if" it never happened, is counter to programmers'
intuitions about what 'volatile' means. The savings from optimizing
volatile are negligible. The risk of breaking working code in
difficult-to-debug ways is huge.
Al
-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
More information about the llvm-dev
mailing list