llvm-project/llvm/lib
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
..
Analysis Only promote args when function attributes are compatible 2019-01-16 05:15:31 +00:00
AsmParser Give helper classes/functions local linkage. NFC. 2019-01-12 18:36:22 +00:00
BinaryFormat llvm-dwarfdump: Improve/fix pretty printing of array dimensions 2018-12-19 19:34:24 +00:00
Bitcode [LTO] Record whether LTOUnit splitting is enabled in index 2019-01-11 18:31:57 +00:00
CodeGen [SelectionDAG] Update check in createOperands to reflect max() is a valid value. 2019-01-16 10:06:04 +00:00
DebugInfo [CodeView] More appropriate name and type for a Microsoft precompiled headers parameter. NFC 2019-01-07 13:53:16 +00:00
Demangle [llvm-undname] Add support for demangling msvc's noexcept types. 2019-01-08 21:05:51 +00:00
ExecutionEngine Revert r351138 "[ORC] Move ORC Core symbol map and set types into their own 2019-01-15 15:21:13 +00:00
FuzzMutate [New PM] Introducing PassInstrumentation framework 2018-09-20 17:08:45 +00:00
Fuzzer
IR [EH] Rename llvm.x86.seh.recoverfp intrinsic to llvm.eh.recoverfp 2019-01-16 00:37:13 +00:00
IRReader
LTO [LTO] Record whether LTOUnit splitting is enabled in index 2019-01-11 18:31:57 +00:00
LineEditor
Linker ThinLTO: Do not import debug info for imported global constants 2018-12-05 21:42:17 +00:00
MC [WebAssembly] Store section alignment as a power of 2 2019-01-16 01:34:48 +00:00
MCA [MCA] Fix wrong definition of ResourceUnitMask in DefaultResourceStrategy. 2019-01-10 13:59:13 +00:00
Object [Object] Return a symbol_iterator, rather than a basic_symbol_iterator, from 2019-01-14 22:05:12 +00:00
ObjectYAML [WebAssembly] Massive instruction renaming 2019-01-08 06:25:55 +00:00
OptRemarks Reland: [OptRemarks] Add library for parsing optimization remarks 2018-10-10 18:43:42 +00:00
Option [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>" 2018-10-10 00:15:31 +00:00
Passes [NewPM][TSan] Reiterate the TSan port 2019-01-16 09:28:01 +00:00
ProfileData [PGO] Use SourceFileName rather module name in PGOFuncName 2019-01-08 22:39:47 +00:00
Support [Support] Remove error return value from one overload of fs::make_absolute 2019-01-16 09:55:32 +00:00
TableGen Let TableGen write output only if it changed, instead of doing so in cmake, attempt 2 2018-12-19 13:35:53 +00:00
Target [GISel]: Add support for CSEing continuously during GISel passes. 2019-01-16 00:40:37 +00:00
Testing Fix error with SmallString implicit conversion. 2018-09-06 22:47:32 +00:00
TextAPI [TextAPI][elfabi] Fix YAML support for weak symbols 2018-12-21 20:45:58 +00:00
ToolDrivers [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>" 2018-10-10 00:15:31 +00:00
Transforms Assertion in isAllocaPromotable due to extra bitcast goes into lifetime marker 2019-01-16 12:06:17 +00:00
WindowsManifest
XRay [Object] Rename getRelrRelocationType to getRelativeRelocationType 2018-12-14 07:46:58 +00:00
CMakeLists.txt [llvm-mca] Move llvm-mca library to llvm/lib/MCA. 2018-12-17 08:08:31 +00:00
LLVMBuild.txt [llvm-mca] Move llvm-mca library to llvm/lib/MCA. 2018-12-17 08:08:31 +00:00