Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Commit 703b033

Browse files
committed
When switched to llvm7.0 a test based an OCL benchmark cannot be compiled. IGC crashes with
such output: Assertion failed: isAllocaPromotable(AI) && "Cannot promote non-promotable alloca!", file llvm\src\lib\transforms\utils\promotememorytoregister.cpp, line 563 It's asserted in SROA optimization pass due to inappropriate bitcast creation for a new slice allocated. Later when doing memory-to-reg checking it detects that inserted bitcast is invalid. Change-Id: I4e0d596a76e58fc9a7e811d355094ac3249db922
1 parent 5fc26d8 commit 703b033

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
diff -Naur a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp
2+
--- a/lib/Transforms/Scalar/SROA.cpp 2018-08-31 17:53:05.000000000 +0200
3+
+++ b/lib/Transforms/Scalar/SROA.cpp 2018-12-20 18:48:12.788662000 +0100
4+
@@ -3033,7 +3033,18 @@
5+
ConstantInt *Size =
6+
ConstantInt::get(cast<IntegerType>(II.getArgOperand(0)->getType()),
7+
NewEndOffset - NewBeginOffset);
8+
- Value *Ptr = getNewAllocaSlicePtr(IRB, OldPtr->getType());
9+
+ // For lifetime intrinsics it's ok to cast a pointer type of a new slice
10+
+ // to a generic i8* pointer. There is a case when using the pointer type
11+
+ // from whole alloca leads to an assertion in PromoteMemToReg.
12+
+ //
13+
+ // A patch is posted to fix this in LLVM:
14+
+ //
15+
+ // https://reviews.llvm.org/D55934
16+
+ // [PATCH] D55934: Assertion in isAllocaPromotable due to extra bitcast
17+
+ // goes into lifetime marker
18+
+ Type *PointerTy = IRB.getInt8PtrTy(OldPtr->getType()->getPointerAddressSpace());
19+
+ Value *Ptr = getNewAllocaSlicePtr(IRB, PointerTy);
20+
+
21+
Value *New;
22+
if (II.getIntrinsicID() == Intrinsic::lifetime_start)
23+
New = IRB.CreateLifetimeStart(Ptr, Size);

0 commit comments

Comments
 (0)