[PATCH] D53598: Add docs+a script for building clang/LLVM with PGO

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 26 02:23:46 PDT 2018


hans accepted this revision.
hans added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: docs/HowToBuildWithPGO.rst:43
+
+- solid coverage of building C++,
+- good coverage of building C,
----------------
george.burgess.iv wrote:
> hans wrote:
> > Including solid coverage for emitting all kinds of C++ diagnostics, whereas in many user builds none would be emitted. This is just a nit-pick, I'm not sure if there's a better way, but that might be one downside of using these kinds of tests for training.
> Not quite; I think I worded the above badly.
> 
> We basically do two things to "train" the instrumented clang/llvm:
> - In the instrumented clang/llvm's build directory, run all lit/unit tests
> - In a new build directory, build everything with the instrumented clang/llvm
> 
> The hope is that "build everything" will strongly bias hot paths toward the common-ish "your code is pretty OK" paths. The other tests may bias some colder branches the wrong way, but I'd imagine that:
> 
> - That's not really an issue in practice, hence "colder"
> - For cases that aren't e.g. building code for the host arch, we'll still get some coverage for what's hot/not, as long as we have the relevant backends enabled.
> 
> Tried to clarify above a bit. Please let me know if it's still unclear
Ah, that makes sense. The new text is very clear, thanks.


================
Comment at: utils/collect_and_build_with_pgo.py:166
+        cmd_str = ' '.join(shlex.quote(s) for s in cmd)
+        print('Running `%s` in %s' % (cmd_str, repr(cwd or os.getcwd())))
+
----------------
Since you're quoting the command, maybe quote the dir too for consistency, especially in case someone is brave enough to have spaces in it :-)


https://reviews.llvm.org/D53598





More information about the llvm-commits mailing list