1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
llvm-mirror/include/llvm
Chandler Carruth bf90c00391 [PM/LoopUnswitch] Teach the new unswitch to handle nontrivial
unswitching of switches.

This works much like trivial unswitching of switches in that it reliably
moves the switch out of the loop. Here we potentially clone the entire
loop into each successor of the switch and re-point the cases at these
clones.

Due to the complexity of actually doing nontrivial unswitching, this
patch doesn't create a dedicated routine for handling switches -- it
would duplicate far too much code. Instead, it generalizes the existing
routine to handle both branches and switches as it largely reduces to
looping in a few places instead of doing something once. This actually
improves the results in some cases with branches due to being much more
careful about how dead regions of code are managed. With branches,
because exactly one clone is created and there are exactly two edges
considered, somewhat sloppy handling of the dead regions of code was
sufficient in most cases. But with switches, there are much more
complicated patterns of dead code and so I've had to move to a more
robust model generally. We still do as much pruning of the dead code
early as possible because that allows us to avoid even cloning the code.

This also surfaced another problem with nontrivial unswitching before
which is that we weren't as precise in reconstructing loops as we could
have been. This seems to have been mostly harmless, but resulted in
pointless LCSSA PHI nodes and other unnecessary cruft. With switches, we
have to get this *right*, and everything benefits from it.

While the testing may seem a bit light here because we only have two
real cases with actual switches, they do a surprisingly good job of
exercising numerous edge cases. Also, because we share the logic with
branches, most of the changes in this patch are reasonably well covered
by existing tests.

The new unswitch now has all of the same fundamental power as the old
one with the exception of the single unsound case of *partial* switch
unswitching -- that really is just loop specialization and not
unswitching at all. It doesn't fit into the canonicalization model in
any way. We can add a loop specialization pass that runs late based on
profile data if important test cases ever come up here.

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

llvm-svn: 335553
2018-06-25 23:32:54 +00:00
..
ADT Add Triple::isMIPS()/isMIPS32()/isMIPS64(). NFC 2018-06-25 16:49:20 +00:00
Analysis [DA] Delinearise AddRecs if we can prove they don't wrap 2018-06-25 15:13:26 +00:00
AsmParser Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
BinaryFormat [PowerPC] Add support for high and higha symbol modifiers on tls modifers. 2018-06-15 19:47:16 +00:00
Bitcode Fix for llvm-dis/llvm-bcanalyzer overflows 2018-06-04 19:20:02 +00:00
CodeGen [SelectionDAG] Remove debug locations from ConstantSD(FP)Nodes 2018-06-25 17:06:18 +00:00
Config Don't redefine a bunch of defines from llvm-config.h in config.h. 2018-05-10 14:45:05 +00:00
DebugInfo [DWARF] Improved error reporting for range lists. 2018-06-20 22:56:37 +00:00
Demangle Move Compiler.h from Demangle back to Support 2018-06-04 22:53:38 +00:00
ExecutionEngine [ORC] Add an initial implementation of a replacement CompileOnDemandLayer. 2018-06-18 18:01:43 +00:00
FuzzMutate [llvm-opt-fuzzer] Avoid adding incorrect inputs to the fuzzer corpus 2018-02-05 11:05:47 +00:00
IR [IR] avoid -Wdocumentation spew about HTML tags 2018-06-25 13:40:54 +00:00
IRReader LLParser: add an argument for overriding data layout and do not check alloca addr space 2018-01-30 22:32:39 +00:00
LineEditor
Linker Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LTO IRGen: Write .dwo files when -split-dwarf-file is used together with -fthinlto-index. 2018-05-31 18:25:59 +00:00
MC [DWARFv5] Allow ".loc 0" to refer to the root file. 2018-06-22 14:16:11 +00:00
Object [ELF] Change isSectionData to exclude SHF_EXECINSTR 2018-06-23 00:15:33 +00:00
ObjectYAML Resubmit [pdb] Change /DEBUG:GHASH to emit 8 byte hashes." 2018-05-17 22:55:15 +00:00
Option [Option] Remove an unnecessary conversion function. 2018-05-05 06:05:31 +00:00
Passes Fix build warning compiling TestPlugin on Windows and disable Passes plugin stuff on Windows since it fundamentally can't work 2018-05-19 03:05:30 +00:00
ProfileData [NFC] Change sample profile format enum name SPF_Raw_Binary to SPF_Binary. 2018-06-12 05:53:49 +00:00
Support [GISel]: Update the end of GISel Opcode namespace. 2018-06-25 17:48:48 +00:00
TableGen TableGen/SearchableTables: Support more generic enums and tables 2018-06-21 13:36:22 +00:00
Target [GISel]: Add G_ADDRSPACE_CAST Opcode 2018-06-22 20:58:51 +00:00
Testing/Support [Testing/Support] Make Failed() matcher work with abstract error types 2018-04-10 14:11:53 +00:00
ToolDrivers
Transforms [PM/LoopUnswitch] Teach the new unswitch to handle nontrivial 2018-06-25 23:32:54 +00:00
WindowsManifest
WindowsResource
XRay XRayRecord.h: Add missing #include 2017-11-21 00:23:19 +00:00
CMakeLists.txt
InitializePasses.h Revert r335306 (and r335314) - the Call Graph Profile pass. 2018-06-22 05:33:57 +00:00
LinkAllIR.h
LinkAllPasses.h Revert r335306 (and r335314) - the Call Graph Profile pass. 2018-06-22 05:33:57 +00:00
module.modulemap Rename *CommandFlags.def to *CommandFlags.inc 2018-04-11 18:49:37 +00:00
module.modulemap.build [Modules] Add module for Config/llvm-config.h 2017-10-24 06:18:52 +00:00
Pass.h Remove @brief commands from doxygen comments, too. 2018-05-01 16:10:38 +00:00
PassAnalysisSupport.h [NFC] fix trivial typos in comments 2018-01-23 05:49:30 +00:00
PassInfo.h
PassRegistry.h
PassSupport.h