@@ -2246,11 +2246,10 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
22462246 static_cast <SPIRVExtInst *>(FrexpResult)->getArgValues ()[1 ];
22472247 SPIRVType *LoadTy = nullptr ;
22482248
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+
22542253 IntFromFrexpResult =
22552254 BM->addLoadInst (IntFromFrexpResult, {}, BB, LoadTy);
22562255
@@ -2478,10 +2477,10 @@ LLVMToSPIRVBase::transValueWithoutDecoration(Value *V, SPIRVBasicBlock *BB,
24782477 SPIRVValue *IntFromFrexpResult =
24792478 static_cast <SPIRVExtInst *>(Val)->getArgValues ()[1 ];
24802479 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+
24852484 IntFromFrexpResult =
24862485 BM->addLoadInst (IntFromFrexpResult, {}, BB, LoadTy);
24872486 return mapValue (V, IntFromFrexpResult);
@@ -6492,8 +6491,11 @@ LLVMToSPIRVBase::transBuiltinToInstWithoutDecoration(Op OC, CallInst *CI,
64926491
64936492 // Input - integer input of any width or 'byval' pointer to this integer
64946493 SPIRVValue *Input = transValue (*OpItr, BB);
6494+ SPIRVType *LoadTy = nullptr ;
6495+ if (Input->isUntypedVariable ())
6496+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(Input)->getDataType ();
64956497 if (OpItr->getType ()->isPointerTy ())
6496- Input = BM->addLoadInst (Input, {}, BB);
6498+ Input = BM->addLoadInst (Input, {}, BB, LoadTy );
64976499 OpItr++;
64986500
64996501 std::vector<SPIRVWord> Literals;
@@ -6583,8 +6585,11 @@ LLVMToSPIRVBase::transBuiltinToInstWithoutDecoration(Op OC, CallInst *CI,
65836585
65846586 // Input - integer input of any width or 'byval' pointer to this integer
65856587 SPIRVValue *Input = transValue (*OpItr, BB);
6588+ SPIRVType *LoadTy = nullptr ;
6589+ if (Input->isUntypedVariable ())
6590+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(Input)->getDataType ();
65866591 if (OpItr->getType ()->isPointerTy ())
6587- Input = BM->addLoadInst (Input, {}, BB);
6592+ Input = BM->addLoadInst (Input, {}, BB, LoadTy );
65886593 OpItr++;
65896594
65906595 std::vector<SPIRVWord> Literals;
@@ -6660,18 +6665,24 @@ LLVMToSPIRVBase::transBuiltinToInstWithoutDecoration(Op OC, CallInst *CI,
66606665
66616666 // InA - integer input of any width or 'byval' pointer to this integer
66626667 SPIRVValue *InA = transValue (*OpItr, BB);
6668+ SPIRVType *LoadTy = nullptr ;
6669+ if (InA->isUntypedVariable ())
6670+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(InA)->getDataType ();
66636671 if (OpItr->getType ()->isPointerTy ())
6664- InA = BM->addLoadInst (InA, {}, BB);
6672+ InA = BM->addLoadInst (InA, {}, BB, LoadTy );
66656673 OpItr++;
66666674
66676675 std::vector<SPIRVWord> Literals;
66686676 Literals.push_back (cast<llvm::ConstantInt>(*OpItr++)->getZExtValue ());
66696677
66706678 // InB - integer input of any width or 'byval' pointer to this integer
66716679 SPIRVValue *InB = transValue (*OpItr, BB);
6680+ LoadTy = nullptr ;
6681+ if (InB->isUntypedVariable ())
6682+ LoadTy = static_cast <SPIRVUntypedVariableKHR *>(InB)->getDataType ();
66726683 if (OpItr->getType ()->isPointerTy ()) {
66736684 std::vector<SPIRVWord> Mem;
6674- InB = BM->addLoadInst (InB, Mem, BB);
6685+ InB = BM->addLoadInst (InB, Mem, BB, LoadTy );
66756686 }
66766687 OpItr++;
66776688
@@ -6751,7 +6762,10 @@ LLVMToSPIRVBase::transBuiltinToInstWithoutDecoration(Op OC, CallInst *CI,
67516762 transValue (CI->getArgOperand (0 )->stripPointerCasts (), BB);
67526763 SPIRVId ScopeId = transValue (CI->getArgOperand (1 ), BB)->getId ();
67536764 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);
67556769 Type *MemberTy = St->getElementType (0 );
67566770 SPIRVType *ElementTy = transType (MemberTy);
67576771 SPIRVValue *Element0 =
0 commit comments