llvm/test
Serguei Katkov a1602eb3fd Revert Revert [MBP] do not rotate loop if it creates extra branch
This is a second attempt to land this patch.

The first one resulted in a crash of clang sanitizer buildbot.
The fix is here and regression test is added.

This is a last fix for the corner case of PR32214. Actually this is not really corner case in general.

We should not do a loop rotation if we create an additional branch due to it.
Consider the case where we have a loop chain H, M, B, C , where
H is header with viable fallthrough from pre-header and exit from the loop
M - some middle block
B - backedge to Header but with exit from the loop also.
C - some cold block of the loop.

Let's H is determined as a best exit. If we do a loop rotation M, B, C, H we can introduce the extra branch.
Let's compute the change in number of branches:
+1 branch from pre-header to header
-1 branch from header to exit
+1 branch from header to middle block if there is such
-1 branch from cold bock to header if there is one

So if C is not a predecessor of H then we introduce extra branch.

This change actually prohibits rotation of the loop if both true
  Best Exit has next element in chain as successor.
  Last element in chain is not a predecessor of first element of chain.

Reviewers: iteratee, xur, sammccall, chandlerc	
Reviewed By: iteratee
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34745


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307631 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-11 08:34:58 +00:00
..
Analysis Re-enable "[IndVars] Canonicalize comparisons between non-negative values and indvars" 2017-07-08 17:17:30 +00:00
Assembler
Bindings
Bitcode Increase the import-threshold for crtical functions. 2017-07-07 21:01:00 +00:00
BugPoint
CodeGen Revert Revert [MBP] do not rotate loop if it creates extra branch 2017-07-11 08:34:58 +00:00
DebugInfo [LLVM] Get rid of white spaces in file names in a DebugInfo test. NFC 2017-07-10 16:05:18 +00:00
Examples
ExecutionEngine
Feature Remove the BBVectorize pass. 2017-06-30 07:09:08 +00:00
FileCheck
Instrumentation Revert r307342, r307343. 2017-07-07 01:31:23 +00:00
Integer
JitListener
LibDriver
Linker
LTO [LTO] Fix the interaction between linker redefined symbols and ThinLTO 2017-07-06 19:58:26 +00:00
MC [WebAssembly] Use the correct size for MCFillFragment 2017-07-10 18:36:34 +00:00
Object [WebAssembly] Be consistent in generating trivial test input files 2017-07-10 20:43:26 +00:00
ObjectYAML [WebAssembly] Add data size and alignement to linking section 2017-06-27 20:27:59 +00:00
Other fix typos in comments; NFC 2017-07-11 06:04:59 +00:00
SafepointIRVerifier [SafepointIRVerifier] Avoid false positives in GC verifier for compare between pointers 2017-07-07 13:02:29 +00:00
SymbolRewriter
TableGen [TableGen] Add a proper namespace to an Instruction in an AsmMatcher test. This is required after r307358. 2017-07-07 05:50:45 +00:00
ThinLTO/X86 Bitcode: Write the irsymtab to disk. 2017-06-27 23:50:11 +00:00
tools [llvm-cov] Disable threading in a test. NFC. 2017-07-11 01:42:12 +00:00
Transforms [PM/ThinLTO] Fix PR33536, a bug where the ThinLTO bitcode writer was 2017-07-11 05:39:20 +00:00
Unit Change remaining references to lit.util.capture to use subprocess.check_output. 2017-07-06 21:46:47 +00:00
Verifier
YAMLParser
.clang-format
CMakeLists.txt
lit.cfg Change remaining references to lit.util.capture to use subprocess.check_output. 2017-07-06 21:46:47 +00:00
lit.site.cfg.in
TestRunner.sh