<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Compiling with -O1 is slower than -O2"
   href="https://bugs.llvm.org/show_bug.cgi?id=43084">43084</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Compiling with -O1 is slower than -O2
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hehaochen13@nudt.edu.cn
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22412" name="attach_22412" title="from clangBug-14651">attachment 22412</a> <a href="attachment.cgi?id=22412&action=edit" title="from clangBug-14651">[details]</a></span>
from clangBug-14651

See the following results:

##### This is normal ##### 
-- clang version 3.4.2 --(CentOS Linux release 7.6.1810 Core) 
time clang++ -O0 -w tramp3d-v4.cpp  5.951s
time clang++ -O1 -w tramp3d-v4.cpp  9.890s
time clang++ -O2 -w tramp3d-v4.cpp  12.931s
time clang++ -O3 -w tramp3d-v4.cpp  14.078s
time clang++ -Os -w tramp3d-v4.cpp  11.100s
time clang++ -Ofast -w tramp3d-v4.cpp  14.107s

##### This is normal #####
-- Apple clang version 11.0.0 (clang-1100.0.20.17) --(MacOS Mojave 10.14.6)
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O0 -o files pan.c  1.176s
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O1 -o files pan.c  12.805s
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O2 -o files pan.c  20.955s
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O3 -o files pan.c  20.907s
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -Os -o files pan.c  17.487s
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -Ofast -o files pan.c  20.362s

##### This is NOT normal #####
-- clang version 3.4.2 --(CentOS Linux release 7.6.1810 Core)
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O0 -o files pan.c  1.440s
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O1 -o files pan.c  37.666s //
This is NOT normal
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O2 -o files pan.c  26.200s
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -O3 -o files pan.c  26.780s
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -Os -o files pan.c  18.114s
time clang -DHC4 -DSAFETY -DNOREDUCE -DNFAIR=3 -Ofast -o files pan.c  26.185s

pan.c is from clang-14651(<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED DUPLICATE - CLANG Compilation 4x Slower Than GCC"
   href="show_bug.cgi?id=14651">https://bugs.llvm.org/show_bug.cgi?id=14651</a>), while
tramp3d-v4 is an open source benchmark.

As described in the GCC documentation: "-O2 turns on all optimization flags
specified by -O1 and it also turns on the following optimization flags: xxx,
xxx..."(and I think it is similar in
clang(<a href="https://stackoverflow.com/questions/15548023/clang-optimization-levels">https://stackoverflow.com/questions/15548023/clang-optimization-levels</a>))
So I think compiling with -O1 are not expected to be slower than that with -O2.
So I think this may be a performance bug.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>