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