<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 - Indirect call promotion does not work with clang-based instrumentation"
href="https://bugs.llvm.org/show_bug.cgi?id=33750">33750</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Indirect call promotion does not work with clang-based instrumentation
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>Miscellaneous Instrumentation passes
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>anemet@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>$ 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?</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>