This is an archive of the discontinued LLVM Phabricator instance.

Reimplement discriminator assignment algorithm.
ClosedPublic

Authored by danielcdh on Nov 16 2015, 5:23 PM.

Details

Summary

The new algorithm is more efficient (O(n), n is number of basic blocks). And it is guaranteed to cover all cases of multiple BB mapped to same line.

Diff Detail

Event Timeline

danielcdh updated this revision to Diff 40366.Nov 16 2015, 5:23 PM
danielcdh retitled this revision from to Reimplement discriminator assignment algorithm..
danielcdh updated this object.
danielcdh added reviewers: dnovillo, dblaikie, davidxl.
danielcdh added a subscriber: llvm-commits.
dnovillo edited edge metadata.Nov 17 2015, 9:41 AM

Thanks for this. The new algorithm seems much more straightforward than what I wrote initially.

lib/Transforms/Utils/AddDiscriminators.cpp
179

Please describe at a high level how the algorithm finds location that need a discriminator.

188

Prefer if this is expressed as L = std::make_pair(DIL->getFilename(), DIL->getLine());

189

s/NULL/nullptr/

190

Could you cache the access to LBM[L] into a reference to avoid the double lookup?

192

Here, it would be useful to add a comment along the lines of: "If we could insert a different block in the same location, a discriminator is needed to distinguish both instructions."

196

Could you create a reference to R.first->second and R.second? It's easier to have a symbolic name associated to track what the code is doing.

danielcdh marked 6 inline comments as done.Nov 17 2015, 10:21 AM

All resolved.

danielcdh updated this revision to Diff 40408.Nov 17 2015, 10:21 AM
danielcdh edited edge metadata.

Integrate comments.

dnovillo accepted this revision.Nov 17 2015, 10:23 AM
dnovillo edited edge metadata.

LGTM. Thanks!

This revision is now accepted and ready to land.Nov 17 2015, 10:23 AM
danielcdh closed this revision.Nov 19 2015, 11:55 AM