<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Dear LLVM community <span class="moz-smiley-s1"><span>:-)</span></span></p>
<p>I'm a novice in compiler principles and optimization, I'm
currently working with some example code to see what &&
how LLVM optimization is doing to generate good machine code.
While working I find some functions are being inlined by llvm and
some are not, but I don't know the internals of optimization so I
can't able to figure the reasons and rationale behind them. <br>
</p>
<p>For example:</p>
<p>struct value{</p>
<p>int set(){} // Function does nothing!<br>
</p>
<p>};<br>
</p>
<p>void foo () {} // Function does nothing!</p>
<p>void func( ) {</p>
<p>value obj;</p>
<p>obj.set();</p>
<p>foo();<br>
</p>
<p>}</p>
<p>Compiling with command "clang++ -O2 -std=c++11 -stdlib=libc++<i><u>
</u></i><i><u><b>-Rpass=inline</b></u></i> name.cpp prints <br>
</p>
<p>only obj.set() was inlined but not foo(). I don't understand the
rationale behind this (both are empty functions right ?). Why LLVM
not inlining the function "foo" ? <br>
</p>
<p>Could you please share some pointers (videos or blogs) which
explains the design of llvm optimizations <span
class="moz-smiley-s1"><span>:-)</span></span>. And also what is
mean by <u><i>cost and threshold in inlining functions?</i></u><i>
like (cost=always and cost=never). </i><u><i> <br>
</i></u></p>
<p>Next, <br>
<u><i></i></u></p>
<p>Clang documentation (<a moz-do-not-send="true"
href="https://clang.llvm.org/docs/UsersManual.html#cmdoption-wambiguous-member-template">here</a>)
mentions that -<u><i>Wambiguous-member-template</i></u> warning <u>is
defaulted to on</u>. But when I actually compile the same code
as in documentation it doesn't throw up any warnings. Is the
documentation is out-dated for clang 8.0.0 ? <br>
</p>
<p>Software details : <br>
</p>
<p>Clang 8.0.0 , Linux mint.<br>
</p>
<p>Hardware details: <br>
</p>
<p>X86-64 bit.</p>
<p>Could you please share your knowledge for the above questions ?
it is a great help to me <span class="moz-smiley-s1"></span></p>
<p>Thank you very much for your time, <br>
</p>
<p>PreeJackie <br>
</p>
</body>
</html>