<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 9/3/2018 11:20 AM, praveen via
      llvm-dev wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:04788bdd-58e6-26fc-1a9d-9889c69c8e42@gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <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>
    </blockquote>
    <br>
    Pay attention to the compiler warnings... in particular, this
    triggers "warning: control reaches end of non-void function", which
    substantially changes the generated code.<br>
    <br>
    Sometimes the compiler can eliminate a call to a function without
    actually "inlining" it; if a call has no side effects, and the
    result is unused, it will be erased because it's dead.  LLVM
    currently doesn't emit a remark when this happens.<br>
    <br>
    <blockquote type="cite"
      cite="mid:04788bdd-58e6-26fc-1a9d-9889c69c8e42@gmail.com">
      <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>
    </blockquote>
    <br>
    The "cost" is roughly how expensive it would be to inline the
    function in question, in terms of codesize.  The units don't really
    mean anything in particular, but a simple instruction is roughly 5
    units.  Always/never are overrides to say the function in question
    should always/never be inlined; for example, if a function is marked
    with __attribute__((always_inline)) or __attribute((noinline)).<br>
    <br>
    <blockquote type="cite"
      cite="mid:04788bdd-58e6-26fc-1a9d-9889c69c8e42@gmail.com">
      <p><u><i> </i></u></p>
      <p>Next, <br>
      </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>
    </blockquote>
    <br>
    I think the warning only triggers with -std=c++03, because the rules
    changed in C++11.  Maybe the documentation should be clarified.<br>
    <br>
    -Eli
    <pre class="moz-signature" cols="72">-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project</pre>
  </body>
</html>