llvm-project/llvm
Philip Reames a21d5f1e18 [LICM] Ignore exits provably not taken on first iteration when computing must execute
It is common to have conditional exits within a loop which are known not to be taken on some iterations, but not necessarily all. This patches extends our reasoning around guaranteed to execute (used when establishing whether it's safe to dereference a location from the preheader) to handle the case where an exit is known not to be taken on the first iteration and the instruction of interest *is* known to be taken on the first iteration.

This case comes up in two major ways:
* If we have a range check which we've been unable to eliminate, we frequently know that it doesn't fail on the first iteration.
* Pass ordering. We may have a check which will be eliminated through some sequence of other passes, but depending on the exact pass sequence we might never actually do so or we might miss other optimizations from passes run before the check is finally eliminated.

The initial version (here) is implemented via InstSimplify. At the moment, it catches a few cases, but misses a lot too. I added test cases for missing cases in InstSimplify which I'll follow up on separately. Longer term, we should probably wire SCEV through to here to get much smarter loop aware simplification of the first iteration predicate.

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

llvm-svn: 327664
2018-03-15 21:04:28 +00:00
..
bindings [LLVM-C] [bindings/go] Add C and Golang bindings for COMDAT 2018-03-14 18:33:53 +00:00
cmake Export LLVM_DYLIB_COMPONENTS in LLVMConfig.cmake 2018-03-14 09:28:38 +00:00
docs TableGen: Add !ne, !le, !lt, !ge, and !gt comparisons 2018-03-14 11:00:57 +00:00
examples [ORC] Re-apply r327566 with a fix for test-global-ctors.ll. 2018-03-15 00:30:14 +00:00
include Move some function declarations higher so they can be found. 2018-03-15 17:56:44 +00:00
lib [LICM] Ignore exits provably not taken on first iteration when computing must execute 2018-03-15 21:04:28 +00:00
projects
resources
runtimes
test [LICM] Ignore exits provably not taken on first iteration when computing must execute 2018-03-15 21:04:28 +00:00
tools Refactor the PDB HashTable class. 2018-03-15 17:38:26 +00:00
unittests Refactor the PDB HashTable class. 2018-03-15 17:38:26 +00:00
utils [UpdateTestChecks] Handle IR variables with a '-' in the name 2018-03-14 20:28:53 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt build: add the ability to create a symlink for dsymutil 2018-02-28 23:00:50 +00:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
README.txt
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.