hanchenye-llvm-project/llvm
Wei Mi 7ccf7651c0 [LSR] Allow formula containing Reg for SCEVAddRecExpr related with outerloop.
In RateRegister of existing LSR, if a formula contains a Reg which is a SCEVAddRecExpr,
and this SCEVAddRecExpr's loop is an outerloop, the formula will be marked as Loser
and dropped.

Suppose we have an IR that %for.body is outerloop and %for.body2 is innerloop. LSR only
handle inner loop now so only %for.body2 will be handled.

Using the logic above, formula like
reg(%array) + reg({1,+, %size}<%for.body>) + 1*reg({0,+,1}<%for.body2>) will be dropped
no matter what because reg({1,+, %size}<%for.body>) is a SCEVAddRecExpr type reg related
with outerloop. Only formula like
reg(%array) + 1*reg({{1,+, %size}<%for.body>,+,1}<nuw><nsw><%for.body2>) will be kept
because the SCEVAddRecExpr related with outerloop is folded into the initial value of the
SCEVAddRecExpr related with current loop.

But in some cases, we do need to share the basic induction variable
reg{0 ,+, 1}<%for.body2> among LSR Uses to reduce the final total number of induction
variables used by LSR, so we don't want to drop the formula like
reg(%array) + reg({1,+, %size}<%for.body>) + 1*reg({0,+,1}<%for.body2>) unconditionally.

From the existing comment, it tries to avoid considering multiple level loops at the same time.
However, existing LSR only handles innermost loop, so for any SCEVAddRecExpr with a loop other
than current loop, it is an invariant and will be simple to handle, and the formula doesn't have
to be dropped.

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

llvm-svn: 286999
2016-11-15 18:35:53 +00:00
..
bindings [OCaml] Adapt to the new attribute C API. 2016-11-12 03:38:30 +00:00
cmake Reverting r285406, which was a temporary workaround to get one of the documentation bots upgraded to something newer than GCC 4.7. This restores the check for GCC 4.8. 2016-11-14 13:33:51 +00:00
docs TableGen: Add operator !or 2016-11-15 06:49:28 +00:00
examples [Orc] Update the BuildingAJIT Chapter 5 server class for the recent RPC changes. 2016-11-11 21:55:25 +00:00
include vector load store with length (left justified) llvm portion 2016-11-15 17:54:19 +00:00
lib [LSR] Allow formula containing Reg for SCEVAddRecExpr related with outerloop. 2016-11-15 18:35:53 +00:00
projects [CMake] Correct configuration order of the sub-projects based on ther dependancies 2016-10-09 20:38:29 +00:00
resources
runtimes [CMake] Make the runtimes directory work with bootstrap builds 2016-10-19 21:50:25 +00:00
test [LSR] Allow formula containing Reg for SCEVAddRecExpr related with outerloop. 2016-11-15 18:35:53 +00:00
tools Improve DWARF parsing speed by improving DWARFAbbreviationDeclaration 2016-11-15 01:23:06 +00:00
unittests [ORC] Temporarily disable RPCUtils unit test. 2016-11-15 00:49:12 +00:00
utils Fix -Wunused introduced in r286945 for release builds. 2016-11-15 10:13:09 +00:00
.arcconfig project_id is from another era in phabricator land and does not provide any value. 2016-09-27 15:47:29 +00:00
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt [cmake] Fix handling compiler-rt in LLVM_ENABLE_PROJECTS by turning any "-" into "_" 2016-11-09 00:23:20 +00:00
CODE_OWNERS.TXT CODE_OWNERS: Take ownership of the X86 backend. 2016-11-12 05:16:06 +00:00
CREDITS.TXT Give SLP vectorizer credit where it's due. 2016-11-14 19:01:59 +00:00
LICENSE.TXT
LLVMBuild.txt
README.txt Test commit, deleted empty line at the end of README.txt 2016-11-07 18:31:21 +00:00
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.