[Dominators] Take fast path when applying <=1 updates
authorJakub Kuderski <kubakuderski@gmail.com>
Wed, 4 Oct 2017 17:32:55 +0000 (17:32 +0000)
committerJakub Kuderski <kubakuderski@gmail.com>
Wed, 4 Oct 2017 17:32:55 +0000 (17:32 +0000)
commit68fc036e1d255259adb167e55ad6e680f4b8539c
tree7456882ca53d84742cd747dcbe1a058dcbd4f805
parentb47b3f2564d6928446d2803aa550719588b90048
[Dominators] Take fast path when applying <=1 updates

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(...)
```

Reviewers: dberlin, brzycki, davide, grosser, sanjoy

Reviewed By: dberlin, davide

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D38541

llvm-svn: 314917
llvm/include/llvm/Support/GenericDomTree.h
llvm/include/llvm/Support/GenericDomTreeConstruction.h