diff options
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp index 511de96b5f7c..524a34be876f 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp @@ -218,10 +218,10 @@ bool AMDGPUPrintfRuntimeBinding::lowerPrintfForGpu( // if (ArgSize % DWORD_ALIGN != 0) { llvm::Type *ResType = llvm::Type::getInt32Ty(Ctx); - VectorType *LLVMVecType = llvm::dyn_cast<llvm::VectorType>(ArgType); + auto *LLVMVecType = llvm::dyn_cast<llvm::FixedVectorType>(ArgType); int NumElem = LLVMVecType ? LLVMVecType->getNumElements() : 1; if (LLVMVecType && NumElem > 1) - ResType = llvm::VectorType::get(ResType, NumElem); + ResType = llvm::FixedVectorType::get(ResType, NumElem); Builder.SetInsertPoint(CI); Builder.SetCurrentDebugLocation(CI->getDebugLoc()); if (OpConvSpecifiers[ArgCount - 1] == 'x' || @@ -387,9 +387,7 @@ bool AMDGPUPrintfRuntimeBinding::lowerPrintfForGpu( Value *id_gep_cast = new BitCastInst(BufferIdx, idPointer, "PrintBuffIdCast", Brnch); - StoreInst *stbuff = - new StoreInst(ConstantInt::get(I32Ty, UniqID), id_gep_cast); - stbuff->insertBefore(Brnch); // to Remove unused variable warning + new StoreInst(ConstantInt::get(I32Ty, UniqID), id_gep_cast, Brnch); SmallVector<Value *, 2> FourthIdxList; ConstantInt *fourInt = @@ -408,8 +406,7 @@ bool AMDGPUPrintfRuntimeBinding::lowerPrintfForGpu( Value *Arg = CI->getArgOperand(ArgCount); Type *ArgType = Arg->getType(); SmallVector<Value *, 32> WhatToStore; - if (ArgType->isFPOrFPVectorTy() && - (ArgType->getTypeID() != Type::VectorTyID)) { + if (ArgType->isFPOrFPVectorTy() && !isa<VectorType>(ArgType)) { Type *IType = (ArgType->isFloatTy()) ? Int32Ty : Int64Ty; if (OpConvSpecifiers[ArgCount - 1] == 'f') { ConstantFP *fpCons = dyn_cast<ConstantFP>(Arg); @@ -478,18 +475,14 @@ bool AMDGPUPrintfRuntimeBinding::lowerPrintfForGpu( Arg = new PtrToIntInst(Arg, DstType, "PrintArgPtr", Brnch); WhatToStore.push_back(Arg); } - } else if (ArgType->getTypeID() == Type::VectorTyID) { + } else if (isa<FixedVectorType>(ArgType)) { Type *IType = NULL; - uint32_t EleCount = cast<VectorType>(ArgType)->getNumElements(); + uint32_t EleCount = cast<FixedVectorType>(ArgType)->getNumElements(); uint32_t EleSize = ArgType->getScalarSizeInBits(); uint32_t TotalSize = EleCount * EleSize; if (EleCount == 3) { - IntegerType *Int32Ty = Type::getInt32Ty(ArgType->getContext()); - Constant *Indices[4] = { - ConstantInt::get(Int32Ty, 0), ConstantInt::get(Int32Ty, 1), - ConstantInt::get(Int32Ty, 2), ConstantInt::get(Int32Ty, 2)}; - Constant *Mask = ConstantVector::get(Indices); - ShuffleVectorInst *Shuffle = new ShuffleVectorInst(Arg, Arg, Mask); + ShuffleVectorInst *Shuffle = + new ShuffleVectorInst(Arg, Arg, ArrayRef<int>{0, 1, 2, 2}); Shuffle->insertBefore(Brnch); Arg = Shuffle; ArgType = Arg->getType(); @@ -523,7 +516,7 @@ bool AMDGPUPrintfRuntimeBinding::lowerPrintfForGpu( break; } if (EleCount > 1) { - IType = dyn_cast<Type>(VectorType::get(IType, EleCount)); + IType = FixedVectorType::get(IType, EleCount); } Arg = new BitCastInst(Arg, IType, "PrintArgVect", Brnch); WhatToStore.push_back(Arg); |