llvm-project/llvm
Max Kazantsev d9e93e8e57 [X86][CodeGenPrepare] Try to reuse IV's incremented value instead of adding the offset, part 1
While optimizing the memory instruction, we sometimes need to add
offset to the value of `IV`. We could avoid doing so if the `IV.next` is
already defined at the point of interest. In this case, we may get two
possible advantages from this:

- If the `IV` step happens to match with the offset, we don't need to add
  the offset at all;
- We reduce overlap of live ranges of `IV` and `IV.next`. They may stop overlapping
  and it will lead to better register allocation. Even if the overlap will preserve,
  we are not introducing a new overlap, so it should be a neutral transform (Disabled
  this patch, will come with follow-up).

Currently I've only added support for IVs that get decremented using `usub`
intrinsic. We could also support `AddInstr`, however there is some weird
interaction with some other transform that may lead to infinite compilation
in this case (seems like same transform is done and undone over and over).
I need to investigate why it happens, but generally we could do that too.

The first part only handles case where this reuse fully elimiates the offset.

Differential Revision: https://reviews.llvm.org/D96399
Reviewed By: reames
2021-03-04 15:22:55 +07:00
..
benchmarks
bindings
cmake [PR48898][CMake] Support MinGW Toolchain tool sin llvm_ExternalProject_Add 2021-03-02 22:45:05 +01:00
docs [LangRef] remove links to lifetime since use marker intro already has a link 2021-03-04 17:19:23 +09:00
examples [Draft] [examples] Move llvm/examples/OCaml-Kaleidoscope/ to llvm-archive 2021-02-11 06:52:24 +05:30
include [CSSPGO] Deduplicating dangling pseudo probes. 2021-03-03 22:44:42 -08:00
lib [X86][CodeGenPrepare] Try to reuse IV's incremented value instead of adding the offset, part 1 2021-03-04 15:22:55 +07:00
projects
resources
runtimes [PR48898][CMake] Support MinGW Toolchain tool sin llvm_ExternalProject_Add 2021-03-02 22:45:05 +01:00
test [X86][CodeGenPrepare] Try to reuse IV's incremented value instead of adding the offset, part 1 2021-03-04 15:22:55 +07:00
tools [lli] Add JITLink link component after 99a6d003ed 2021-03-03 23:14:26 +01:00
unittests [AMDGPU] Rename amdgcn_wwm to amdgcn_strict_wwm 2021-03-03 09:33:57 +01:00
utils Revert "hack to unbreak check-llvm on win after D97335" in attempt for actual fix 2021-03-03 22:35:36 +01:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt [cmake] Move check for libproc to config-ix.cmake 2021-02-18 10:54:27 +01: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.