@@ -42,7 +42,7 @@ PreprocessSPVIR::PreprocessSPVIR() : ModulePass(ID)
42
42
43
43
uint64_t PreprocessSPVIR::parseSampledImageTy (StructType* sampledImageTy)
44
44
{
45
- std::string Name = sampledImageTy->getName ();
45
+ std::string Name = sampledImageTy->getName (). str () ;
46
46
std::smatch match;
47
47
std::regex reg (" spirv.SampledImage._void_([0-6])_([0-2])_([0-1])_([0-1])_([0-2])_([0-9]+)_([0-2])" );
48
48
@@ -77,18 +77,18 @@ Value* PreprocessSPVIR::getWidenImageCoordsArg(Value* Coords)
77
77
{
78
78
Type* coordsType = Coords->getType ();
79
79
Value* newCoords = nullptr ;
80
- if (!isa<VectorType >(coordsType))
80
+ if (!isa<IGCLLVM::FixedVectorType >(coordsType))
81
81
{
82
- Value* undef = UndefValue::get (VectorType ::get (coordsType, 4 ));
82
+ Value* undef = UndefValue::get (IGCLLVM::FixedVectorType ::get (coordsType, 4 ));
83
83
newCoords = m_Builder->CreateInsertElement (undef, Coords, ConstantInt::get (m_Builder->getInt32Ty (), 0 ));
84
84
}
85
- else if (cast<VectorType >(coordsType)->getNumElements () < 4 )
85
+ else if (cast<IGCLLVM::FixedVectorType >(coordsType)->getNumElements () < 4 )
86
86
{
87
87
SmallVector<Constant*, 4 > shuffleIdx;
88
- for (uint64_t i = 0 ; i < cast<VectorType >(coordsType)->getNumElements (); i++)
88
+ for (uint64_t i = 0 ; i < cast<IGCLLVM::FixedVectorType >(coordsType)->getNumElements (); i++)
89
89
shuffleIdx.push_back (ConstantInt::get (m_Builder->getInt32Ty (), i));
90
90
91
- for (uint64_t i = cast<VectorType >(coordsType)->getNumElements (); i < 4 ; i++)
91
+ for (uint64_t i = cast<IGCLLVM::FixedVectorType >(coordsType)->getNumElements (); i < 4 ; i++)
92
92
shuffleIdx.push_back (ConstantInt::get (m_Builder->getInt32Ty (), 0 ));
93
93
94
94
newCoords = m_Builder->CreateShuffleVector (Coords, UndefValue::get (coordsType), ConstantVector::get (shuffleIdx));
@@ -156,7 +156,7 @@ void PreprocessSPVIR::visitImageSampleExplicitLod(CallInst& CI)
156
156
// -image,
157
157
// -image type which comes from parsing opaque type
158
158
// -sampler.
159
- Value* unifiedSampledImage = UndefValue::get (VectorType ::get (m_Builder->getInt64Ty (), 3 ));
159
+ Value* unifiedSampledImage = UndefValue::get (IGCLLVM::FixedVectorType ::get (m_Builder->getInt64Ty (), 3 ));
160
160
161
161
Value* imageAsInt = m_Builder->CreatePtrToInt (callSampledImage->getArgOperand (0 ), m_Builder->getInt64Ty ());
162
162
Value* samplerAsInt = m_Builder->CreatePtrToInt (callSampledImage->getArgOperand (1 ), m_Builder->getInt64Ty ());
@@ -205,9 +205,9 @@ void PreprocessSPVIR::visitImageSampleExplicitLod(CallInst& CI)
205
205
else
206
206
IGC_ASSERT_MESSAGE (0 , " Unsupported dx/dy types of ImageSampleExplicitLod builtin." );
207
207
208
- if (isa<VectorType >(dxType))
208
+ if (auto *VT = dyn_cast<IGCLLVM::FixedVectorType >(dxType))
209
209
{
210
- unifiedImageSampleName += std::to_string (dxType-> getVectorNumElements ());
210
+ unifiedImageSampleName += std::to_string (VT-> getNumElements ());
211
211
}
212
212
}
213
213
break ;
@@ -216,9 +216,10 @@ void PreprocessSPVIR::visitImageSampleExplicitLod(CallInst& CI)
216
216
break ;
217
217
}
218
218
219
- Type* retType = CI.getType ();
220
- if (retType->isVectorTy () && retType->getVectorNumElements () == 4 )
221
- {
219
+ Type* retType = CI.getType ();
220
+ auto *VT = dyn_cast<IGCLLVM::FixedVectorType>(retType);
221
+ if (VT && VT->getNumElements () == 4 )
222
+ {
222
223
Type* retScalarType = retType->getScalarType ();
223
224
if (retScalarType->isIntegerTy ())
224
225
unifiedImageSampleName += " _Ruint4" ;
0 commit comments