1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/unittests/IR
Jakub Kuderski e25b7db874 [Dominators] Include infinite loops in PostDominatorTree
Summary:
This patch teaches PostDominatorTree about infinite loops. It is built on top of D29705 by @dberlin which includes a very detailed motivation for this change.

What's new is that the patch also teaches the incremental updater how to deal with reverse-unreachable regions and how to properly maintain and verify tree roots. Before that, the incremental algorithm sometimes ended up preserving reverse-unreachable regions after updates that wouldn't appear in the tree if it was constructed from scratch on the same CFG.

This patch makes the following assumptions:
- A sequence of updates should produce the same tree as a recalculating it.
- Any sequence of the same updates should lead to the same tree.
- Siblings and roots are unordered.

The last two properties are essential to efficiently perform batch updates in the future.
When it comes to the first one, we can decide later that the consistency between freshly built tree and an updated one doesn't matter match, as there are many correct ways to pick roots in infinite loops, and to relax this assumption. That should enable us to recalculate postdominators less frequently.

This patch is pretty conservative when it comes to incremental updates on reverse-unreachable regions and ends up recalculating the whole tree in many cases. It should be possible to improve the performance in many cases, if we decide that it's important enough.
That being said, my experiments showed that reverse-unreachable are very rare in the IR emitted by clang when bootstrapping  clang. Here are the statistics I collected by analyzing IR between passes and after each removePredecessor call:

```
# functions:  52283
# samples:  337609
# reverse unreachable BBs:  216022
# BBs:  247840796
Percent reverse-unreachable:  0.08716159869015269 %
Max(PercRevUnreachable) in a function:  87.58620689655172 %
# > 25 % samples:  471 ( 0.1395104988314885 % samples )
... in 145 ( 0.27733680163724345 % functions )
```

Most of the reverse-unreachable regions come from invalid IR where it wouldn't be possible to construct a PostDomTree anyway.

I would like to commit this patch in the next week in order to be able to complete the work that depends on it before the end of my internship, so please don't wait long to voice your concerns :).

Reviewers: dberlin, sanjoy, grosser, brzycki, davide, chandlerc, hfinkel

Reviewed By: dberlin

Subscribers: nhaehnle, javed.absar, kparzysz, uabelho, jlebar, hiraditya, llvm-commits, dberlin, david2050

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

llvm-svn: 310940
2017-08-15 18:14:57 +00:00
..
AsmWriterTest.cpp Re-sort #include lines for unittests. This uses a slightly modified 2017-06-06 11:06:56 +00:00
AttributesTest.cpp Fix assertion when merging multiple empty AttributeLists 2017-05-31 14:24:06 +00:00
BasicBlockTest.cpp Remove unnecessary double-assignment triggering -Wsequence-point. 2017-05-26 12:07:12 +00:00
CFGBuilder.cpp [Dominators] Define Arc less-than operator inline. 2017-07-13 23:11:57 +00:00
CFGBuilder.h [Dominators] Define Arc less-than operator inline. 2017-07-13 23:11:57 +00:00
CMakeLists.txt [Dominators] Add CFGBuilder testing utility 2017-07-13 21:16:01 +00:00
ConstantRangeTest.cpp [ConstantRange] Add another truncate unittest for wrapped set staying a wrapped set. 2017-06-04 23:07:53 +00:00
ConstantsTest.cpp Re-sort #include lines for unittests. This uses a slightly modified 2017-06-06 11:06:56 +00:00
DebugInfoTest.cpp
DebugTypeODRUniquingTest.cpp Re-sort #include lines for unittests. This uses a slightly modified 2017-06-06 11:06:56 +00:00
DominatorTreeTest.cpp [Dominators] Include infinite loops in PostDominatorTree 2017-08-15 18:14:57 +00:00
FunctionTest.cpp
InstructionsTest.cpp [IR] De-virtualize ~Value to save a vptr 2017-05-18 17:24:10 +00:00
IntrinsicsTest.cpp
IRBuilderTest.cpp Debug Info: Add a file: field to DIImportedEntity. 2017-07-19 00:09:54 +00:00
LegacyPassManagerTest.cpp
MDBuilderTest.cpp
MetadataTest.cpp Disable some IR death tests when SEH is available 2017-08-10 21:14:07 +00:00
ModuleTest.cpp Have Module::createRNG return a unique_ptr 2017-07-12 08:03:44 +00:00
PassBuilderCallbacksTest.cpp [PM] Enable registration of out-of-tree passes with PassBuilder 2017-07-10 10:57:55 +00:00
PassManagerTest.cpp [PM] Teach PreservedAnalyses to have an allInSet static factory 2017-07-09 07:23:27 +00:00
PatternMatch.cpp Fix m_[Ord|Unord][FMin|FMax] matchers to correctly match ordering. 2017-06-13 17:18:45 +00:00
TypeBuilderTest.cpp
TypesTest.cpp
UserTest.cpp Re-sort #include lines for unittests. This uses a slightly modified 2017-06-06 11:06:56 +00:00
UseTest.cpp
ValueHandleTest.cpp
ValueMapTest.cpp
ValueTest.cpp Re-sort #include lines for unittests. This uses a slightly modified 2017-06-06 11:06:56 +00:00
VerifierTest.cpp Re-sort #include lines for unittests. This uses a slightly modified 2017-06-06 11:06:56 +00:00
WaymarkTest.cpp