[llvm-bugs] [Bug 33750] New: Indirect call promotion does not work with clang-based instrumentation

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 11 14:28:32 PDT 2017


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

            Bug ID: 33750
           Summary: Indirect call promotion does not work with clang-based
                    instrumentation
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Miscellaneous Instrumentation passes
          Assignee: unassignedbugs at nondot.org
          Reporter: anemet at apple.com
                CC: llvm-bugs at lists.llvm.org

$ cat s.c
int f(){
  return 1;
}

int (*volatile p)() = f;

int main() {
  int a = 0;
  for (int i = 0; i < 10000; i++)
    a += p();
  return a;
}

*** IR-level instrumentation

$ clang -fprofile-generate s.c -mllvm -enable-value-profiling -O2
$ ./a.out
$ llvm-profdata merge  default_14740668018413324687_0.profraw -o profdat
$ clang -O2 -fprofile-use=profdat s.c -S  -mllvm
-debug-only=pgo-icall-prom-analysis

Work on callsite   %call = call i32 (...) %0() #2, !prof !36 Num_targets: 1
 Candidate 0 Count=10000  Target_func: 14740650423002898831
$

*** Front-end-based instrumentation

$ clang -fprofile-instr-generate s.c -mllvm -enable-value-profiling -O2
$ llvm-profdata merge  default.profraw -o profdat-clang
$ clang -O2 -fprofile-instr-use=profdat-clang s.c -S  -mllvm
-debug-only=pgo-icall-prom-analysis
$

Looks like the reason is that PGOIndirectCallPromotionLegacyPass is only added
to the pass pipeline if PGOInstrUse is set which is not the case for
clang-based instrumentation.  If I set PGOInstrUse for clang-based
instrumentation as well, I get a "Not an IR level instrumentation profile" from
PGOInstrumentationUseLegacyPass.  How is this supposed to work?

-- 
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/20170711/e9b9e919/attachment.html>


More information about the llvm-bugs mailing list