@@ -2246,11 +2246,10 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
2246
2246
static_cast <SPIRVExtInst *>(FrexpResult)->getArgValues ()[1 ];
2247
2247
SPIRVType *LoadTy = nullptr ;
2248
2248
2249
- if (IntFromFrexpResult->isUntypedVariable ()) {
2250
- auto *BV =
2251
- static_cast <SPIRVUntypedVariableKHR *>(IntFromFrexpResult);
2252
- LoadTy = BV->getDataType ();
2253
- }
2249
+ if (IntFromFrexpResult->isUntypedVariable ())
2250
+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(IntFromFrexpResult)
2251
+ ->getDataType ();
2252
+
2254
2253
IntFromFrexpResult =
2255
2254
BM->addLoadInst (IntFromFrexpResult, {}, BB, LoadTy);
2256
2255
@@ -2478,10 +2477,10 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
2478
2477
SPIRVValue *IntFromFrexpResult =
2479
2478
static_cast <SPIRVExtInst *>(Val)->getArgValues ()[1 ];
2480
2479
SPIRVType *LoadTy = nullptr ;
2481
- if (IntFromFrexpResult->isUntypedVariable ()) {
2482
- auto *BV = static_cast <SPIRVUntypedVariableKHR *>(IntFromFrexpResult);
2483
- LoadTy = BV ->getDataType ();
2484
- }
2480
+ if (IntFromFrexpResult->isUntypedVariable ())
2481
+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(IntFromFrexpResult)
2482
+ ->getDataType ();
2483
+
2485
2484
IntFromFrexpResult =
2486
2485
BM->addLoadInst (IntFromFrexpResult, {}, BB, LoadTy);
2487
2486
return mapValue (V, IntFromFrexpResult);
@@ -6492,8 +6491,11 @@ LLVMToSPIRVBase::transBuiltinToInstWithoutDecoration(Op OC, CallInst *CI,
6492
6491
6493
6492
// Input - integer input of any width or 'byval' pointer to this integer
6494
6493
SPIRVValue *Input = transValue (*OpItr, BB);
6494
+ SPIRVType *LoadTy = nullptr ;
6495
+ if (Input->isUntypedVariable ())
6496
+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(Input)->getDataType ();
6495
6497
if (OpItr->getType ()->isPointerTy ())
6496
- Input = BM->addLoadInst (Input, {}, BB);
6498
+ Input = BM->addLoadInst (Input, {}, BB, LoadTy );
6497
6499
OpItr++;
6498
6500
6499
6501
std::vector<SPIRVWord> Literals;
@@ -6583,8 +6585,11 @@ LLVMToSPIRVBase::transBuiltinToInstWithoutDecoration(Op OC, CallInst *CI,
6583
6585
6584
6586
// Input - integer input of any width or 'byval' pointer to this integer
6585
6587
SPIRVValue *Input = transValue (*OpItr, BB);
6588
+ SPIRVType *LoadTy = nullptr ;
6589
+ if (Input->isUntypedVariable ())
6590
+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(Input)->getDataType ();
6586
6591
if (OpItr->getType ()->isPointerTy ())
6587
- Input = BM->addLoadInst (Input, {}, BB);
6592
+ Input = BM->addLoadInst (Input, {}, BB, LoadTy );
6588
6593
OpItr++;
6589
6594
6590
6595
std::vector<SPIRVWord> Literals;
@@ -6660,18 +6665,24 @@ LLVMToSPIRVBase::transBuiltinToInstWithoutDecoration(Op OC, CallInst *CI,
6660
6665
6661
6666
// InA - integer input of any width or 'byval' pointer to this integer
6662
6667
SPIRVValue *InA = transValue (*OpItr, BB);
6668
+ SPIRVType *LoadTy = nullptr ;
6669
+ if (InA->isUntypedVariable ())
6670
+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(InA)->getDataType ();
6663
6671
if (OpItr->getType ()->isPointerTy ())
6664
- InA = BM->addLoadInst (InA, {}, BB);
6672
+ InA = BM->addLoadInst (InA, {}, BB, LoadTy );
6665
6673
OpItr++;
6666
6674
6667
6675
std::vector<SPIRVWord> Literals;
6668
6676
Literals.push_back (cast<llvm::ConstantInt>(*OpItr++)->getZExtValue ());
6669
6677
6670
6678
// InB - integer input of any width or 'byval' pointer to this integer
6671
6679
SPIRVValue *InB = transValue (*OpItr, BB);
6680
+ LoadTy = nullptr ;
6681
+ if (InB->isUntypedVariable ())
6682
+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(InB)->getDataType ();
6672
6683
if (OpItr->getType ()->isPointerTy ()) {
6673
6684
std::vector<SPIRVWord> Mem;
6674
- InB = BM->addLoadInst (InB, Mem, BB);
6685
+ InB = BM->addLoadInst (InB, Mem, BB, LoadTy );
6675
6686
}
6676
6687
OpItr++;
6677
6688
@@ -6751,7 +6762,10 @@ LLVMToSPIRVBase::transBuiltinToInstWithoutDecoration(Op OC, CallInst *CI,
6751
6762
transValue (CI->getArgOperand (0 )->stripPointerCasts (), BB);
6752
6763
SPIRVId ScopeId = transValue (CI->getArgOperand (1 ), BB)->getId ();
6753
6764
SPIRVValue *Delta = transValue (CI->getArgOperand (3 ), BB);
6754
- SPIRVValue *Composite0 = BM->addLoadInst (InValue, {}, BB);
6765
+ SPIRVType *LoadTy = nullptr ;
6766
+ if (InValue->isUntypedVariable ())
6767
+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(InValue)->getDataType ();
6768
+ SPIRVValue *Composite0 = BM->addLoadInst (InValue, {}, BB, LoadTy);
6755
6769
Type *MemberTy = St->getElementType (0 );
6756
6770
SPIRVType *ElementTy = transType (MemberTy);
6757
6771
SPIRVValue *Element0 =
0 commit comments