[LLVMdev] [cfe-dev] [RFC] add Function Attribute to disable optimization
Jeffrey Walton
noloader at gmail.com
Mon Jun 17 15:32:06 PDT 2013
On Mon, Jun 17, 2013 at 6:23 PM, Sean Silva <silvas at purdue.edu> wrote:
> On Mon, Jun 17, 2013 at 10:29 AM, Jeffrey Walton <noloader at gmail.com> wrote:
>> First is to ensure dead-writes are not removed. For example, a
>> function that zeroizes or wipes memory is subject to removal during
>> optimization. I often have to look at program's disassembly to ensure
>> the memset is not removed by the optimizer.
>
> Appropriate use of `volatile` is probably sufficient for this use case.
That brings up a good point. As I understand it, volatile is
essentially implementation defined. What is Clang/LLVM's
interpretation?
Here's what I know. Microsoft's interpretation allows me to use
volatile for the situation under MSVC++ [1]. GCC's interpretation of
volatile is for memory mapped hardware, so it does not allow me to use
the qualifier to tame the optimizer [2].
Jeff
[1] http://msdn.microsoft.com/en-us/library/vstudio/12a04hfd%28v=vs.90%29.aspx
[2] http://gcc.gnu.org/ml/gcc-help/2012-03/msg00242.html
More information about the llvm-dev
mailing list