<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Jonas,<div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class=""><div class="gmail_quote"><div class="">Does it have to be comments, or could you do something like this?</div></div></div></div></blockquote><div class=""><div dir="ltr" class=""><div class=""><div class="gmail_quote"><div class=""><br class=""></div><div class="">Not at all, it was just an example, it can pragma or builtin function or anything else.</div></div></div></div></div>
<div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class=""><div class="gmail_quote"><div class="">You could look at how __builtin_expect is handled inside the compiler. In lib/Transforms/Scalar/LowerExpectIntrinsic.cpp, branch weight metadata is generated based on that function. You could probably adapt this to generate the metadata that you need.</div></div></div></div></blockquote><br class=""></div><div class="">I will take a look at it thanks.</div><div class=""><br class=""></div><div class="">Greetings.</div><div class=""><br class=""></div><div class="">Johan</div><br class=""><div><blockquote type="cite" class=""><div class="">On 23 Sep 2016, at 11:52, Jonas Wagner <<a href="mailto:jonas.wagner@epfl.ch" class="">jonas.wagner@epfl.ch</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">I am looking at a way to mark part of a source code for an optimisation pass (or how to transfert information from source code to IR).</div></div></blockquote><div class=""><br class=""></div><div class="">Does it have to be comments, or could you do something like this?</div><div class=""><br class=""></div><div class="">if (optimize_me(i%2)) {</div><div class=""> ...</div><div class="">}</div><div class=""><br class=""></div><div class="">You could look at how __builtin_expect is handled inside the compiler. In lib/Transforms/Scalar/LowerExpectIntrinsic.cpp, branch weight metadata is generated based on that function. You could probably adapt this to generate the metadata that you need.</div><div class=""><br class=""></div><div class="">Best,</div><div class="">Jonas</div><div class=""><br class=""></div></div></div></div>
</div></blockquote></div><br class=""></div></body></html>