1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/lib
James Molloy bfb4ed7a07 [SimplifyCFG] Handle tail-sinking of more than 2 incoming branches
This was a real restriction in the original version of SinkIfThenCodeToEnd. Now it's been rewritten, the restriction can be lifted.

As part of this, we handle a very common and useful case where one of the incoming branches is actually conditional. Consider:

   if (a)
     x(1);
   else if (b)
     x(2);

This produces the following CFG:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \    |  /
          [ end ]

[end] has two unconditional predecessor arcs and one conditional. The conditional refers to the implicit empty 'else' arc. This same pattern can also be caused by an empty default block in a switch.

We can't sink the call to x() down to end because no call to x() happens on the third incoming arc (assume that x() has sideeffects for the sake of argument; if something is safe to speculate we could indeed sink nevertheless but this cannot happen in the general case and causes many extra selects).

We are now able to detect this case and split off the unconditional arcs to a common successor:

         [if]
        /    \
      [x(1)] [if]
        |     | \
        |     |  \
        |  [x(2)] |
         \   /    |
     [sink.split] |
           \     /
           [ end ]

Now we can sink the call to x() into %sink.split. This can cause significant code simplification in many testcases.

llvm-svn: 280217
2016-08-31 10:46:33 +00:00
..
Analysis [Loads] Properly populate the visited set in isDereferenceableAndAlignedPointer 2016-08-31 03:22:32 +00:00
AsmParser [AsmParser] Placate a -Wmisleading-indentantion warning (GCC7). 2016-08-26 18:05:03 +00:00
Bitcode Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-08-25 00:45:04 +00:00
CodeGen [XRay] Support multiple return instructions in a single basic block 2016-08-31 05:20:08 +00:00
DebugInfo Remove unused translation unit. 2016-08-23 20:08:02 +00:00
ExecutionEngine ExecutionEngine: fix a bug in the movt/movw relocator 2016-08-29 20:42:03 +00:00
Fuzzer [libfuzzer] simplified unit truncation; do not write trunc items to disc 2016-08-30 20:49:07 +00:00
IR ADT: Guarantee transferNodesFromList is only called on transfers 2016-08-30 18:00:45 +00:00
IRReader
LibDriver Object: Replace NewArchiveIterator with a simpler NewArchiveMember class. NFCI. 2016-06-29 22:27:42 +00:00
LineEditor
Linker Linker: Avoid some ridiculous indentation by using a temporary. NFC 2016-08-15 22:41:42 +00:00
LTO [LTO] Remove extraneous output 2016-08-29 15:33:01 +00:00
MC ADT: Split ilist_node_traits into alloc and callback, NFC 2016-08-30 18:40:47 +00:00
Object Next set of additional error checks for invalid Mach-O files for bad LC_DYSYMTAB’s. 2016-08-30 21:28:30 +00:00
ObjectYAML [macho2yaml] Don't write empty linkedit data 2016-08-17 21:46:04 +00:00
Option Replace "fallthrough" comments with LLVM_FALLTHROUGH 2016-08-17 05:10:15 +00:00
Passes [PM] Introduce basic update capabilities to the new PM's CGSCC pass 2016-08-24 09:37:14 +00:00
ProfileData [Coverage] Make sorting criteria for CounterMappingRegions local. 2016-08-31 07:01:17 +00:00
Support ADT: Split ilist_node_traits into alloc and callback, NFC 2016-08-30 18:40:47 +00:00
TableGen Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-08-23 17:14:32 +00:00
Target [X86][SSE] Improve awareness of fptrunc implicit zeroing of upper 64-bits of xmm result 2016-08-31 10:35:13 +00:00
Transforms [SimplifyCFG] Handle tail-sinking of more than 2 incoming branches 2016-08-31 10:46:33 +00:00
CMakeLists.txt
LLVMBuild.txt