@@ -1665,7 +1665,7 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
1665
1665
// execution instance, so emit an alloca instead of a global.
1666
1666
assert (BB && " OpVariable with Function storage class requires BB" );
1667
1667
IRBuilder<> Builder (BB);
1668
- AllocaInst *AI = Builder.CreateAlloca (Ty, 0 , BV->getName ());
1668
+ AllocaInst *AI = Builder.CreateAlloca (Ty, nullptr , BV->getName ());
1669
1669
if (Init) {
1670
1670
auto *Src = transValue (Init, F, BB);
1671
1671
const bool IsVolatile = BVar->hasDecorate (DecorationVolatile);
@@ -1779,8 +1779,9 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
1779
1779
auto *VLA = static_cast <SPIRVVariableLengthArrayINTEL *>(BV);
1780
1780
llvm::Type *Ty = transType (BV->getType ()->getPointerElementType ());
1781
1781
llvm::Value *ArrSize = transValue (VLA->getOperand (0 ), F, BB);
1782
- return mapValue (
1783
- BV, new AllocaInst (Ty, SPIRAS_Private, ArrSize, BV->getName (), BB));
1782
+ return mapValue (BV,
1783
+ new AllocaInst (Ty, M->getDataLayout ().getAllocaAddrSpace (),
1784
+ ArrSize, BV->getName (), BB));
1784
1785
}
1785
1786
1786
1787
case OpRestoreMemoryINTEL: {
@@ -2248,9 +2249,9 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
2248
2249
2249
2250
case OpCopyObject: {
2250
2251
SPIRVCopyObject *CO = static_cast <SPIRVCopyObject *>(BV);
2251
- auto Ty = transType (CO->getOperand ()->getType ());
2252
+ auto * Ty = transType (CO->getOperand ()->getType ());
2252
2253
AllocaInst *AI =
2253
- new AllocaInst (Ty, 0 , " " , BB);
2254
+ new AllocaInst (Ty, M-> getDataLayout (). getAllocaAddrSpace () , " " , BB);
2254
2255
new StoreInst (transValue (CO->getOperand (), F, BB), AI, BB);
2255
2256
LoadInst *LI = new LoadInst (Ty, AI, " " , BB);
2256
2257
return mapValue (BV, LI);
@@ -2401,7 +2402,8 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
2401
2402
if (!HasRtValues)
2402
2403
return mapValue (BV, ConstantArray::get (AT, CV));
2403
2404
2404
- AllocaInst *Alloca = new AllocaInst (AT, SPIRAS_Private, " " , BB);
2405
+ AllocaInst *Alloca =
2406
+ new AllocaInst (AT, M->getDataLayout ().getAllocaAddrSpace (), " " , BB);
2405
2407
2406
2408
// get pointer to the element of the array
2407
2409
// store the result of argument
@@ -2420,7 +2422,8 @@ Value *SPIRVToLLVM::transValueWithoutDecoration(SPIRVValue *BV, Function *F,
2420
2422
if (!HasRtValues)
2421
2423
return mapValue (BV, ConstantStruct::get (ST, CV));
2422
2424
2423
- AllocaInst *Alloca = new AllocaInst (ST, SPIRAS_Private, " " , BB);
2425
+ AllocaInst *Alloca =
2426
+ new AllocaInst (ST, M->getDataLayout ().getAllocaAddrSpace (), " " , BB);
2424
2427
2425
2428
// get pointer to the element of structure
2426
2429
// store the result of argument
@@ -3020,7 +3023,8 @@ Value *SPIRVToLLVM::transFixedPointInst(SPIRVInstruction *BI, BasicBlock *BB) {
3020
3023
Args.reserve (8 );
3021
3024
if (RetTy->getIntegerBitWidth () > 64 ) {
3022
3025
llvm::PointerType *RetPtrTy = llvm::PointerType::get (RetTy, SPIRAS_Generic);
3023
- Value *Alloca = new AllocaInst (RetTy, SPIRAS_Private, " " , BB);
3026
+ Value *Alloca =
3027
+ new AllocaInst (RetTy, M->getDataLayout ().getAllocaAddrSpace (), " " , BB);
3024
3028
Value *RetValPtr = new AddrSpaceCastInst (Alloca, RetPtrTy, " " , BB);
3025
3029
ArgTys.emplace_back (RetPtrTy);
3026
3030
Args.emplace_back (RetValPtr);
@@ -3144,7 +3148,8 @@ Value *SPIRVToLLVM::transArbFloatInst(SPIRVInstruction *BI, BasicBlock *BB,
3144
3148
if (RetTy->getIntegerBitWidth () > 64 ) {
3145
3149
llvm::PointerType *RetPtrTy = llvm::PointerType::get (RetTy, SPIRAS_Generic);
3146
3150
ArgTys.push_back (RetPtrTy);
3147
- Value *Alloca = new AllocaInst (RetTy, SPIRAS_Private, " " , BB);
3151
+ Value *Alloca =
3152
+ new AllocaInst (RetTy, M->getDataLayout ().getAllocaAddrSpace (), " " , BB);
3148
3153
Value *RetValPtr = new AddrSpaceCastInst (Alloca, RetPtrTy, " " , BB);
3149
3154
Args.push_back (RetValPtr);
3150
3155
}
0 commit comments