llvm-mirror/test
Chandler Carruth a48e3ffca5 [PM/LoopUnswitch] Add partial non-trivial unswitching for invariant
conditions feeding a chain of `and`s or `or`s for a branch.

Much like with full non-trivial unswitching, we rely on the pass manager
to handle iterating until all of the profitable unswitches have been
done. This is to allow other more profitable unswitches to fire on any
of the cloned, simpler versions of the loop if viable.

Threading the partial unswiching through the non-trivial unswitching
logic motivated some minor refactorings. If those are too disruptive to
make it reasonable to review this patch, I can separate them out, but
it'll be somewhat timeconsuming so I wanted to send it for initial
review as-is. Feel free to tell me whether it warrants pulling apart.

I've tried to re-use (and factor out) logic form the partial trivial
unswitching, but not as much could be shared as I had haped. Still, this
wasn't as bad as I naively expected.

Some basic testing is added, but I probably need more. Suggestions for
things you'd like to see tested more than welcome. One thing I'd like to
do is add some testing that when we schedule this with loop-instsimplify
it effectively cleans up the cruft created.

Last but not least, this uncovered a bug that has been in loop cloning
the entire time for non-trivial unswitching. Specifically, we didn't
correctly add the outer-most cloned loop to the list of cloned loops.
This meant that LCSSA wouldn't be updated for it hypothetically, and
more significantly that we would never visit it in the loop pass
manager. I noticed this while checking loop-instsimplify by hand. I'll
try to separate this bugfix out into its own patch with a more focused
test. But it is just one line, so shouldn't significantly confuse the
review here.

After this patch, the only missing "feature" in this unswitch I'm aware
of us non-trivial unswitching of switches. I'll try implementing *full*
non-trivial unswitching of switches (which is at least a sound thing to
implement), but *partial* non-trivial unswitching of switches is
something I don't see any sound and principled way to implement. I also
have no interesting test cases for the latter, so I'm not really
worried. The rest of the things that need to be ported are bug-fixes and
more narrow / targeted support for specific issues.

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

llvm-svn: 335203
2018-06-21 06:14:03 +00:00
..
Analysis Revert "[SCEV] Improve zext(A /u B) and zext(A % B)" 2018-06-21 02:15:32 +00:00
Assembler
Bindings
Bitcode
BugPoint
CodeGen [RISC-V] Fix a test case to not include label names as those aren't 2018-06-21 05:42:05 +00:00
DebugInfo [DWARF] Improved error reporting for range lists. 2018-06-20 22:56:37 +00:00
Examples
ExecutionEngine
Feature
FileCheck
Instrumentation
Integer
JitListener
Linker
LTO IRMover: Account for matching types present across modules 2018-06-20 16:50:56 +00:00
MC [mips] Correct predicates for loads, bit manipulation instructions and some pseudos 2018-06-20 19:59:58 +00:00
Object
ObjectYAML
Other
SafepointIRVerifier
SymbolRewriter
TableGen
ThinLTO/X86
tools [LIT] Enable testing of LLVM gold plugin on Mac OS X 2018-06-20 15:32:47 +00:00
Transforms [PM/LoopUnswitch] Add partial non-trivial unswitching for invariant 2018-06-21 06:14:03 +00:00
Unit
Verifier
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg.py [LIT] Enable testing of LLVM gold plugin on Mac OS X 2018-06-20 15:32:47 +00:00
lit.site.cfg.py.in
TestRunner.sh