<div><br></div><div><div><br></div>On Monday, May 12, 2014, Ã¨Ñý <<a href="mailto:spcatman@qq.com">spcatman@qq.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hi, all</div>
<div><br></div><div>  Recently I'm trying to use LLVM PGO and autoFDO. However I have some problems in the process. </div><div>  LLVM source code is updated on April 9th. Operating system  is SUSE x86_64</div><div><br>
</div><div>  1. Problems in instrumentation based PGO:</div><div>  clang -O2 -fprofile-instr-generate test.c -o a.out</div><div>  ./a.out     (then default.profraw is generated)</div><div>  clang -O2 -fprofile-instr-use=default.profraw test.c -o a.out</div>
<div>  error: pgo data file has malformed function entry</div><div>  I found that the run-time function "writeFile" in InstrProfilingFile.cpp didn't write '\n'. </div><div>  But when parsing the profile data,  in CodeGenPGO.cpp line 56, it tried to find '\n' like below:</div>
<div>  CurPtr = strchr(CurPtr, '\n');</div><div>  if (!CurPtr) {</div><div>    ReportBadPGOData(CGM, "pgo data file has malformed function entry");</div><div>    return;</div><div>  }</div></div></blockquote>
<div><br></div><div><span style="line-height: 1.5;">>></span>Sorry that this isn't documented very well. I'm working on some documentation for the instrumentation </div><div><span style="line-height: 1.5;">>></span><span style="line-height: 1.5;">based profiling that should make this less of a guessing game.</span></div><div><br></div><div><span style="line-height: 1.5;">>></span>You need to run `llvm-profdata merge` on the raw profile data to generate the format that clang </div><div><span style="line-height: 1.5;">>></span><span style="line-height: 1.5;">understands. Something like:</span></div><div><br></div><div><span style="line-height: 1.5;">>></span>  llvm-profdata merge default.profraw -o default.profdata</div><div><br>
</div><div>>>Then use default.profdata as the input to -fprofile-instr-use.</div><div><br></div><div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;">     It has worked well after I do as you say. Thank you!</div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;">     And I want to confirm what passes benefits from profdata-guided feedback currently.</div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;">     Is the profiledata feeded back to all of basicblock replacement, function inline, register allocation</div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;">     and loop-unroll, or only basicblock replacement ?</div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;">     </div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;">     I'll test performance improvement of PGO on some benchmarks.</div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;">     I think you already <span style="line-height: 1.5;">have some test results.</span></div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;"><br></div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;">     Thanks,</div><div style="font-family: 'lucida Grande', Verdana; line-height: 23.799999237060547px;">     Kaidong Chen</div></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>  </div></div></blockquote></div>