llvm-project/llvm
Nikita Popov 1301a8b473 [BasicAA] Don't unnecessarily extend pointer size
BasicAA GEP decomposition currently performs all calculation on the
maximum pointer size, but at least 64-bit, with an option to double
the size. The code comment claims that this improves analysis power
when working with uint64_t indices on 32-bit systems. However, I don't
see how this can be, at least while maintaining correctness:

When working on canonical code, the GEP indices will have GEP index
size. If the original code worked on uint64_t with a 32-bit size_t,
then there will be truncs inserted before use as a GEP index. Linear
expression decomposition does not look through truncs, so this will
be an opaque value as far as GEP decomposition is concerned. Working
on a wider pointer size does not help here (or have any effect at all).

When working on non-canonical code (before first InstCombine), the
GEP indices are implicitly truncated to GEP index size. The BasicAA
code currently just ignores this fact completely, and pretends that
this truncation doesn't happen. This is incorrect and will be
addressed by D110977.

I believe that for correctness reasons, it is important to work on
the actual GEP index size to properly model potential overflow.
BasicAA tries to patch over the fact that it uses the wrong size
(see adjustToPointerSize), but it only does that in limited cases
(only for constant values, and not all of them either). I'd like to
move this code towards always working on the correct size, and
dropping these artificial pointer size adjustments is the first step
towards that.

Differential Revision: https://reviews.llvm.org/D110657
2021-10-06 18:40:21 +02:00
..
benchmarks
bindings [NFC][C API] Make LLVMSetInstrParamAlignment's index param type LLVMAttributeIndex 2021-09-07 15:13:45 -07:00
cmake Add .cmt and .cmti files for OCaml bindings 2021-10-05 19:36:12 +05:30
docs [docs] Fix typo and minor text changes in MyFirstTypoFix 2021-10-06 08:31:56 +00:00
examples [ORC][examples] Port LLJITWithRemoteDebugging to SimpleRemoteEPC 2021-09-29 10:20:41 +02:00
include Revert "[IR] Remove arg_operands and getNumArgOperands (NFC)" 2021-10-06 08:40:39 -07:00
lib [BasicAA] Don't unnecessarily extend pointer size 2021-10-06 18:40:21 +02:00
projects
resources
runtimes [runtimes] Ensure required deps for tests targets are actually built 2021-09-29 14:41:33 -07:00
test [BasicAA] Don't unnecessarily extend pointer size 2021-10-06 18:40:21 +02:00
tools [llvm] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine) 2021-10-06 12:04:30 +01:00
unittests [llvm] Update report_fatal_error calls from raw_string_ostream to use Twine(OS.str()) 2021-10-05 18:42:12 +01:00
utils [gn build] Port a30a36f66a 2021-10-06 11:59:40 +00:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt Revert "[CMake] Enable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR by default on Linux" 2021-09-28 18:23:43 +03: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.