llvm-project/llvm
Gabor Buella 3ec170c85a Assertion in isAllocaPromotable due to extra bitcast goes into lifetime marker
For the given test SROA detects possible replacement and creates a correct alloca. After that SROA is adding lifetime markers for this new alloca. The function getNewAllocaSlicePtr is trying to deduce the pointer type based on the original alloca, which is split, to use it later in lifetime intrinsic.

For the test we ended up with such code (rA is initial alloca [10 x float], which is split, and rA.sroa.0.0 is a new split allocation)

```
%rA.sroa.0.0.rA.sroa_cast = bitcast i32* %rA.sroa.0 to [10 x float]*    <----- this one causing the assertion and is an extra bitcast
%5 = bitcast [10 x float]* %rA.sroa.0.0.rA.sroa_cast to i8*
call void @llvm.lifetime.start.p0i8(i64 4, i8* %5)
```

isAllocaPromotable code assumes that a user of alloca may go into lifetime marker through bitcast but it must be the only one bitcast to i8* type. In the test it's not a i8* type, return false and throw the assertion.

As we are creating a pointer, which will be used in lifetime markers only, the proposed fix is to create a bitcast to i8* immediately to avoid extra bitcast creation.

The test is a greatly simplified to just reproduce the assertion.

Author: Igor Tsimbalist <igor.v.tsimbalist@intel.com>

Reviewers: chandlerc, craig.topper

Reviewed By: chandlerc

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

llvm-svn: 351325
2019-01-16 12:06:17 +00:00
..
benchmarks
bindings [NewPM][TSan] Reiterate the TSan port 2019-01-16 09:28:01 +00:00
cmake [CMake] Export utility targets to the build/install tree depending on LLVM_BUILD/INSTALL_UTILS 2019-01-11 19:34:34 +00:00
docs Bump the trunk version to 9.0.0svn 2019-01-16 10:57:02 +00:00
examples Python compat - print statement 2019-01-03 14:11:33 +00:00
include [Support] Remove error return value from one overload of fs::make_absolute 2019-01-16 09:55:32 +00:00
lib Assertion in isAllocaPromotable due to extra bitcast goes into lifetime marker 2019-01-16 12:06:17 +00:00
projects [pstl] Initial integration with LLVM's CMake 2018-12-21 15:59:04 +00:00
resources
runtimes
test Assertion in isAllocaPromotable due to extra bitcast goes into lifetime marker 2019-01-16 12:06:17 +00:00
tools [Support] Remove error return value from one overload of fs::make_absolute 2019-01-16 09:55:32 +00:00
unittests [Support] Remove error return value from one overload of fs::make_absolute 2019-01-16 09:55:32 +00:00
utils Build LLVM-C.dll by default on windows and enable in release package 2019-01-16 11:47:56 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitattributes
.gitignore Git ignore CLion project configuration files. NFC 2019-01-02 19:58:07 +00:00
CMakeLists.txt Build LLVM-C.dll by default on windows and enable in release package 2019-01-16 11:47:56 +00:00
CODE_OWNERS.TXT [llvm-mca] Move llvm-mca library to llvm/lib/MCA. 2018-12-17 08:08:31 +00:00
CREDITS.TXT
LICENSE.TXT Update year in license files 2019-01-15 15:10:32 +00:00
LLVMBuild.txt
README.txt
RELEASE_TESTERS.TXT Update the list of platforms & archs 2018-12-16 14:47:16 +00:00
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.