search for: please_do_not_optimize_me_away

Displaying 2 results from an estimated 2 matches for "please_do_not_optimize_me_away".

2017 Jun 22
8
How to prevent optimizing away a call + its arguments
...Wed, Jun 21, 2017 at 05:25:04PM -0700, Mehdi AMINI via llvm-dev wrote: > Hi Kuba, > > Try: > > __attribute__(optnone) > > See > https://clang.llvm.org/docs/AttributeReference.html#optnone-clang-optnone Actually, it should be enough to use: __attribute__((noinline)) void please_do_not_optimize_me_away(int arg1, void *arg2) { asm volatile("":::"memory"); } Creating a real barrier is important. Joerg
2017 Jun 21
2
How to prevent optimizing away a call + its arguments
Hi llvm-dev, I have a C function: __attribute__((__visibility__("default"))) __attribute__((used)) __attribute__((noinline)) void please_do_not_optimize_me_away(int arg1, void *arg2) { asm volatile("" :::); } (the purpose is that this function will be used dynamically at runtime, perhaps by interposing the function, or via the debugger) I really thought this will not get optimized out, but I've realized (the hard way) that LLVM will happi...