[llvm-bugs] [Bug 45050] New: LTO uses front-end PGO even when IR-level was requested

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 27 12:47:17 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=45050

            Bug ID: 45050
           Summary: LTO uses front-end PGO even when IR-level was
                    requested
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dmajor at mozilla.com
                CC: davidxl at google.com, htmldeveloper at gmail.com,
                    llvm-bugs at lists.llvm.org, tejohnson at google.com

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200227/254209cb/attachment.html>


More information about the llvm-bugs mailing list