<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 5/19/2017 12:42 PM, Matthew O'Connor
      via llvm-dev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CA+XmMRWBd5DGKzhivesMqfEHaG0Cuj+sgseBS6UXLzVCQKi5jA@mail.gmail.com">
      <div dir="ltr">
        <div>
          <div>All,<br>
            <br>
            I'm in the process of upgrading an LLVM client from using
            3.8 to using 4.0 and am running into the following issue:<br>
            <br>
          </div>
          <span style="font-family:monospace,monospace">// compile with:<br>
            // clang++ -std=c++11 -Wno-c++14-extensions -S -emit-llvm<br>
            //   ~/chrono.cpp -o chrono.ll<br>
            #include <chrono><br>
            #include <ratio><br>
            #include <thread><br>
            using namespace std;<br>
            using namespace std::chrono;<br>
            <br>
            using tick = ratio<1, 300>;<br>
            using tick_duration = duration<long, tick>;<br>
            <br>
            class ticking_clock {<br>
            public:<br>
              using duration = tick_duration;<br>
              using rep = duration::rep;<br>
              using period = duration::period;<br>
              using time_point = time_point<ticking_clock,
            duration>;<br>
              static constexpr bool is_steady = true;<br>
            <br>
              static time_point now() noexcept;<br>
            };<br>
            <br>
            void f(long &elapsed_time) {<br>
                auto start = ticking_clock::now();<br>
                this_thread::sleep_for(tick_duration(71));<br>
                auto finish = ticking_clock::now();<br>
                auto dur = finish - start;<br>
                elapsed_time = dur.count();<br>
            }</span><br>
          <br>
        </div>
        <div>The functions defined in the resultant IR are marked
          `noinline` in 4.0 but do not have that same attribute in 3.8.
          Running the unoptimized IR through `opt -O2 <chrono.ll -S
          >chrono.opt.ll` produces the expected 6 line function in
          3.8 but does no inlining in 4.0 (respecting the attribute).<br>
        </div>
        <div><br>
        </div>
        <div>This appears to be a large change from where `clang++ -O2`
          was roughly equal to `clang++ -O0 | opt -O2` in 3.8 but is not
          in 4.0.<br>
          <br>
        </div>
        <div>Is there a way to obtain that previous functionality in
          4.0?</div>
      </div>
    </blockquote>
    <br>
    Try "-O2 -Xclang -disable-llvm-passes".<br>
    <p>-Eli<br>
    </p>
    <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>