<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 - LTO uses front-end PGO even when IR-level was requested"
   href="https://bugs.llvm.org/show_bug.cgi?id=45050">45050</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LTO uses front-end PGO even when IR-level was requested
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dmajor@mozilla.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>davidxl@google.com, htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, tejohnson@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Observed on Linux with both clang 9.0.0 and a 10.0.0 release candidate.

Normally, the choice of flag should determine the PGO type.
`-fprofile-generate` uses IR-level, and `-fprofile-instr-generate` uses 
frontend-level. But when LTO is enabled, the PGO is always frontend-level.

$ cat a.cpp 
int main(int argc, char**) { return argc; }

$ clang++ -fprofile-generate -O2 a.cpp -o NoLTO
$ LLVM_PROFILE_FILE=NoLTO.profraw ./NoLTO 
$ llvm-profdata show NoLTO.profraw | grep level
Instrumentation level: IR

$ clang++ -fprofile-generate -O2 a.cpp -o ThinLTO -flto=thin
$ LLVM_PROFILE_FILE=ThinLTO.profraw ./ThinLTO 
$ llvm-profdata show ThinLTO.profraw | grep level
Instrumentation level: Front-end

$ clang++ -fprofile-generate -O2 a.cpp -o FullLTO -flto
$ LLVM_PROFILE_FILE=FullLTO.profraw ./FullLTO 
$ llvm-profdata show FullLTO.profraw | grep level
Instrumentation level: Front-end</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>