<div dir="ltr"><div>If they are not used, why do you want them to remain? `volatile` can be used to ensure that the compiler doesn't optimise something away, or "explicit use in a way that is never true - but compiler doesn't know it is so" (e.g. `if (sin(x) > 1.0) { do stuff that actually never happens }` ) - calling `sin` is probably not the best choice, but there may be other ways to achieve something similar that is less intrusive but still "unknown to the compiler".<br><br><br></div><div>Can you give an example piece of code?<br></div><div><br>--<br></div>Mats<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 22 November 2016 at 10:37, Compiler Dragon via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

    
<div><p>Hi *, </p><p>I am currently writing a clang plugin, which add to specific functions for e.g. additional arguments. </p><p>How can I instruct the optimizer not to throw out these arguments, because they are not used in the function body?<br></p><p>With (optnone) we can instruct the optimizer to not optimize the whole function. But this ist not what I want. The function body should be optimized like before.</p><p>Any idea or hints where to look?</p><p>Thanks</p><p>Marcel</p></div>
 <br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>