Profile-guided optimization (PGO)

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Thu Dec 10 10:41:44 PST 2015


On Thursday, 10 December 2015 at 14:27:59 UTC, David Nadlinger 
wrote:
>
> Speaking of test cases: This might be an obvious and/or stupid 
> suggestion, but did you try building the Phobos unit tests (and 
> maybe also dmd-testsuite/runnable) with PGO? I'd suspect it 
> would give you quite a broad coverage of basic language 
> constructs.

Nope didn't do that yet :S :S   Looks like it is needed to iron 
out some remaining bugs.

I underestimated the complexity of D's AST (some objects are 
placed in multiple locations in the AST?), which gave rise to an 
assertion fail in your testcase; plus I forgot to add throw 
statements to the AST tree walker, leading to another assertion 
fail. Those issues have been fixed now, and now it breaks with 
the same error you found. It is confusing because I did not (mean 
to) change any of the codegen, other than adding counter 
increment instructions and branch instruction metadata (both 
trivial additions).  But I did have to add extra basicblocks for 
switch statements... perhaps I can search there first.
Hope to have a resolution for your test case quickly.

I also have not tested at all how this works with multiple object 
files linked together, or other possibly more complicated things. 
I thought a fun testcase would be to compile DDMD with PGO 
enabled, compile itself as a profiling run, rebuild with PGO and 
test if compiling, say, Phobos is quicker/slower.

I am very curious to see what constructs will see a significant 
performance boost, if any at all.


More information about the digitalmars-d-ldc mailing list