This is an archive of the discontinued LLVM Phabricator instance.

Simplify CFG before assigning discriminator.
ClosedPublic

Authored by danielcdh on May 4 2016, 10:27 AM.

Details

Summary

We need to clean up CFG before assigning discriminator to minimize the impact of optimization on debug info.

Diff Detail

Event Timeline

danielcdh updated this revision to Diff 56167.May 4 2016, 10:27 AM
danielcdh retitled this revision from to Simplify CFG before assigning discriminator..
danielcdh updated this object.
danielcdh added reviewers: dblaikie, dnovillo, davidxl.
danielcdh added a subscriber: llvm-commits.
dblaikie edited edge metadata.May 4 2016, 10:43 AM

"minimize the impact of optimization on debug info." - what sort of impact are you referring to?

"minimize the impact of optimization on debug info." - what sort of impact are you referring to?

SampleProfile profile is collected on optimized binary. So at profile annotation step, it's better to have an IR resemble the optimized binary structure. Discriminator is the key to represent the profile, and SimplefyCFG is one major optimization that would change CFG. So if we move discriminator assignment after simplycfg, then at profile used at annotation would be more likely to resemble the optimized binary that is used for profiling.

dnovillo edited edge metadata.May 5 2016, 5:16 AM

Would it be possible to get a test case where we miss discriminator placement if simplifycfg doesn't run beforehand?

This patch works the other way: it reduces # of discriminators
assigned because CFGs are simplified. I don't think we can build such
a testcase unless simplifycfg complicates the CFG.

Thanks,
Dehao

OK, sure. What I meant is a testcase that motivates this change.

dnovillo accepted this revision.May 5 2016, 9:26 AM
dnovillo edited edge metadata.
This revision is now accepted and ready to land.May 5 2016, 9:26 AM
danielcdh closed this revision.May 5 2016, 1:24 PM

The patch has been reverted because it breaks 96 clang tests (I only
do "make check" before committing).

The problem is that this will add a simplify-cfg pass to each clang
invocation as soon as add-discriminator pass is needed (even at -O0).
This will change the output of many clang tests.

Any suggestions what I should do here?

Thanks,
Dehao