<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 9, 2016 at 9:45 AM, Toshio Suganuma via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><p>Hi,<br><br>I have a question regarding PGO.<br><br>I collected profile data with the instrumentation build (-fprofile-instr-generate) and provided for PGO optimization in the second build (with -fprofile-instr-use=xxx.profdata). This works fine.<br><br>Then I tried to provide the profile data to opt using the option -pgo-instr-use, but this causes an error with the message: "Not an IR level instrumentation profile".<br>I thought this error occurred because the profile data was produced by the instrumentation build from the source level, not IR level. </p></div></blockquote><div><br></div><div>-fprofile-instr-generate by default still uses Clang frontend based instrumentation -- that is why you see the warning.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><p>However, if I try to make -pgo-instr-gen for the opt command, the resulting bitcode seems to cause a problem as follows (my environment is 3.9.0, mid Feb trunk).<br><br>$ clang -c -o main.bc -O2 -m64 -emit-llvm main.c<br>$ opt -pgo-instr-gen main.bc -o main_inst.bc<br></p></div></blockquote><div><br></div><div>you also need to use -instrprof to add the lowering pass.</div><div><br></div><div>The formal way to enable IR level instrumentation is to use the following command line:</div><div><br></div><div>clang -fprofile-instr-generate -Xclang -fprofile-instrument=llvm main.c</div><div><br></div><div>David</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><p>$ llc main_inst.bc -o main_inst.s<br>instrprof failed to lower an increment<br>UNREACHABLE executed at /home/suganuma/tools/llvm_new/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5245!<br>#0 0x00000000815ecc7a llvm::sys::PrintStackTrace(llvm::raw_ostream&) /home/suganuma/tools/llvm_new/llvm/lib/Support/Unix/Signals.inc:322:0<br>#1 0x00000000815ed02a PrintStackTraceSignalHandler(void*) /home/suganuma/tools/llvm_new/llvm/lib/Support/Unix/Signals.inc:380:0<br>#2 0x00000000815eb33e llvm::sys::RunSignalHandlers() /home/suganuma/tools/llvm_new/llvm/lib/Support/Signals.cpp:44:0<br>...<br>#7 0x0000000081577202 /home/suganuma/tools/llvm_new/llvm/lib/Support/ErrorHandling.cpp:117:0<br>#8 0x000000008139792a llvm::SelectionDAGBuilder::visitIntrinsicCall(llvm::CallInst const&, unsigned int) /home/suganuma/tools/llvm_new/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5247:0<br>#9 0x000000008139b11c llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&) /home/suganuma/tools/llvm_new/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:5811:0<br>#10 0x00000000813737e4 llvm::SelectionDAGBuilder::visit(unsigned int, llvm::User const&) /home/suganuma/tools/llvm_new/llvm/include/llvm/IR/Instruction.def:186:0<br>...<br><br>Am I doing something wrong? How can we provide profile data to opt? <br>What actually I want to do is to dump call graph (cross module) and cfg that reflect counter values from profile data.<br><br>Thank you,<br>--Toshio<br>
</p></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div></div>