@@ -50,8 +50,8 @@ LLVMValueRef (*CustomAllocator)(LLVMBuilderRef, LLVMTypeRef,
50
50
/* Count*/ LLVMValueRef,
51
51
/* Align*/ LLVMValueRef, uint8_t ,
52
52
LLVMValueRef *) = nullptr;
53
- LLVMValueRef (*CustomZero)(LLVMBuilderRef, LLVMTypeRef,
54
- /* Ptr*/ LLVMValueRef, uint8_t ) = nullptr;
53
+ void (*CustomZero)(LLVMBuilderRef, LLVMTypeRef,
54
+ /* Ptr*/ LLVMValueRef, uint8_t ) = nullptr ;
55
55
LLVMValueRef (*CustomDeallocator)(LLVMBuilderRef, LLVMValueRef) = nullptr;
56
56
void (*CustomRuntimeInactiveError)(LLVMBuilderRef, LLVMValueRef,
57
57
LLVMValueRef) = nullptr ;
@@ -183,10 +183,10 @@ Function *getOrInsertExponentialAllocator(Module &M, Function *newFunc,
183
183
Instruction *SubZero = nullptr ;
184
184
gVal = CreateAllocation (B, RT, elSize, " " , nullptr , &SubZero);
185
185
186
- gVal = B. CreatePointerCast (
187
- gVal , PointerType::get (
188
- Type::getInt8Ty (gVal ->getContext ()),
189
- cast<PointerType> (gVal -> getType ())-> getAddressSpace ()) );
186
+ Type *bTy =
187
+ PointerType::get (Type::getInt8Ty ( gVal -> getContext ()),
188
+ cast<PointerType> (gVal ->getType ())-> getAddressSpace ());
189
+ gVal = B. CreatePointerCast (gVal , bTy );
190
190
auto pVal = B.CreatePointerCast (ptr, gVal ->getType ());
191
191
192
192
Value *margs[] = {gVal , pVal, prevSize,
@@ -200,13 +200,16 @@ Function *getOrInsertExponentialAllocator(Module &M, Function *newFunc,
200
200
IRBuilder<> BB (SubZero);
201
201
Value *zeroSize = BB.CreateSub (next, prevSize);
202
202
Value *tmp = SubZero->getOperand (0 );
203
+ Type *tmpT = tmp->getType ();
204
+ tmp = BB.CreatePointerCast (tmp, bTy);
203
205
204
206
#if LLVM_VERSION_MAJOR > 7
205
207
tmp = BB.CreateInBoundsGEP (tmp->getType ()->getPointerElementType (), tmp,
206
208
prevSize);
207
209
#else
208
210
tmp = BB.CreateInBoundsGEP (tmp, prevSize);
209
211
#endif
212
+ tmp = BB.CreatePointerCast (tmp, tmpT);
210
213
SubZero->setOperand (0 , tmp);
211
214
SubZero->setOperand (2 , zeroSize);
212
215
}
0 commit comments