llvm-project/llvm
Philip Reames 2d31b02517 Compute estimated trip counts for multiple exit loops
This change allows us to estimate trip count from profile metadata for all multiple exit loops. We still do the estimate only from the latch, but that's fine as it causes us to over estimate the trip count at worst.

Reviewing the uses of the API, all but one are cases where we restrict a loop transformation (unroll, and vectorize respectively) when we know the trip count is short enough. So, as a result, the change makes these passes strictly less aggressive. The test change illustrates a case where we'd previously have runtime unrolled a loop which ran fewer iterations than the unroll factor. This is definitely unprofitable.

The one case where an upper bound on estimate trip count could drive a more aggressive transform is peeling, and I duplicated the logic being removed from the generic estimation there to keep it the same. The resulting heuristic makes no sense and should probably be immediately removed, but we can do that in a separate change.

This was noticed when analyzing regressions on D113939.

I plan to come back and incorporate estimated trip counts from other exits, but that's a minor improvement which can follow separately.

Differential Revision: https://reviews.llvm.org/D115362
2021-12-09 09:53:49 -08:00
..
benchmarks
bindings
cmake [CMake] Installable find modules for terminfo and libffi 2021-12-05 14:46:23 -05:00
docs [C++20] [Coroutines] Mark coroutine done if unhandled_exception throws 2021-12-09 14:58:06 +08:00
examples [ORC] Add a MaterializationUnit::Interface struct. 2021-12-08 13:41:15 +11:00
include [NFC] Replace some deprecated getAlignment() calls with getAlign() 2021-12-09 08:43:19 -08:00
lib Compute estimated trip counts for multiple exit loops 2021-12-09 09:53:49 -08:00
projects
resources
runtimes
test Compute estimated trip counts for multiple exit loops 2021-12-09 09:53:49 -08:00
tools [llvm] Add null-termination capability to SmallVectorMemoryBuffer 2021-12-09 11:32:13 +01:00
unittests [llvm] Add null-termination capability to SmallVectorMemoryBuffer 2021-12-09 11:32:13 +01:00
utils [test-release.sh] Respect the given width in LIT runs by adding `-j` in LLVM_LIT_ARGS. 2021-12-09 08:37:15 -06:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt Re-Reland "[benchmarks] Move libcxx's fork of google/benchmark and llvm/utils'" 2021-12-07 17:10:41 -08:00
CODE_OWNERS.TXT
CREDITS.TXT
LICENSE.TXT
README.txt
RELEASE_TESTERS.TXT
configure
llvm.spec.in

README.txt

The LLVM Compiler Infrastructure
================================

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.