This is an archive of the discontinued LLVM Phabricator instance.

[Dominators] Take fast path when applying <=1 updates
ClosedPublic

Authored by kuhar on Oct 4 2017, 7:16 AM.

Details

Summary

This patch teaches DT.applyUpdates to take the fast when applying zero or just one update and makes it not run the internal batch updater machinery.

With this patch, it should no longer make sense to have a special check in user's code that checks the update sequence size before applying them, e.g.

if (!MyUpdates.empty())
  DT.applyUpdates(MyUpdates);

or

if (MyUpdates.size() == 1)
  if (...)
    DT.insertEdge(...)
  else
    DT.deleteEdge(...)

Diff Detail

Repository
rL LLVM

Event Timeline

kuhar created this revision.Oct 4 2017, 7:16 AM
davide edited edge metadata.Oct 4 2017, 9:59 AM

Does this make a difference?

kuhar added a comment.Oct 4 2017, 10:04 AM

@davide
I haven't measured, but it definitely makes it do less work. The purpose of this patch is to stop people from writing this micro-optimization all over different passes, which just generates a lot of noise in the code.

davide accepted this revision.Oct 4 2017, 10:04 AM

I'm fine with this, but please wait if Danny or Tobias have comments.

This revision is now accepted and ready to land.Oct 4 2017, 10:04 AM
dberlin edited edge metadata.Oct 4 2017, 10:09 AM

This looks right to me, since people were trying to do it anyway :)

dberlin accepted this revision.Oct 4 2017, 10:09 AM
grosser accepted this revision.Oct 4 2017, 10:26 AM

Looks fine to me as well.

This revision was automatically updated to reflect the committed changes.