diff --git a/IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp b/IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp index fb5b592ad4b4..3db333f26071 100644 --- a/IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp +++ b/IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp @@ -2612,8 +2612,8 @@ static unsigned getResultedTypeSize(Type *Ty, const DataLayout &DL) { TySz += getResultedTypeSize(Ty, DL); } else if (Ty->isPointerTy()) // FIXME: fix data layout description. - TySz = IGCLLVM::getNonOpaquePtrEltTy(Ty)->isFunctionTy() ? genx::DWordBytes - : DL.getPointerSize(); + TySz = + vc::isFunctionPointerType(Ty) ? genx::DWordBytes : DL.getPointerSize(); else { TySz = Ty->getPrimitiveSizeInBits() / CHAR_BIT; IGC_ASSERT_MESSAGE(TySz, "Ty is not primitive?"); @@ -4824,8 +4824,10 @@ void GenXKernelBuilder::buildConvertAddr(CallInst *CI, genx::BaleInfo BI, // we need a different type. Type *OverrideTy = nullptr; Type *BaseTy = Base->getType(); - if (BaseTy->isPointerTy()) - BaseTy = IGCLLVM::getNonOpaquePtrEltTy(BaseTy); + if (BaseTy->isPointerTy()) { + auto *GV = cast(Base); + BaseTy = GV->getValueType(); + } unsigned ElementBytes = BaseTy->getScalarType()->getPrimitiveSizeInBits() >> 3; int Offset = cast(CI->getArgOperand(1))->getSExtValue(); diff --git a/IGC/VectorCompiler/lib/GenXCodeGen/GenXGASDynamicResolution.cpp b/IGC/VectorCompiler/lib/GenXCodeGen/GenXGASDynamicResolution.cpp index fb1cf015bf8e..ec8cc56ba896 100644 --- a/IGC/VectorCompiler/lib/GenXCodeGen/GenXGASDynamicResolution.cpp +++ b/IGC/VectorCompiler/lib/GenXCodeGen/GenXGASDynamicResolution.cpp @@ -1,6 +1,6 @@ /*========================== begin_copyright_notice ============================ -Copyright (C) 2022-2023 Intel Corporation +Copyright (C) 2022-2024 Intel Corporation SPDX-License-Identifier: MIT @@ -400,8 +400,9 @@ void GenXGASDynamicResolution::resolveOnLoadStore(Instruction &I, Builder.SetInsertPoint(BB); auto NewPtrOp = createASCast(Builder, PtrOp, AS); if (LoadInst *LI = dyn_cast(&I)) - Load = Builder.CreateAlignedLoad(IGCLLVM::getNonOpaquePtrEltTy(NewPtrOp->getType()), - NewPtrOp, IGCLLVM::getAlign(*LI), LI->isVolatile(), LoadName); + Load = Builder.CreateAlignedLoad(LI->getType(), NewPtrOp, + IGCLLVM::getAlign(*LI), LI->isVolatile(), + LoadName); else if (StoreInst *SI = dyn_cast(&I)) Builder.CreateAlignedStore(I.getOperand(0), NewPtrOp, IGCLLVM::getAlign(*SI), SI->isVolatile()); diff --git a/IGC/VectorCompiler/lib/GenXCodeGen/GenXVisaRegAlloc.cpp b/IGC/VectorCompiler/lib/GenXCodeGen/GenXVisaRegAlloc.cpp index 218461598f60..36673ddb0009 100644 --- a/IGC/VectorCompiler/lib/GenXCodeGen/GenXVisaRegAlloc.cpp +++ b/IGC/VectorCompiler/lib/GenXCodeGen/GenXVisaRegAlloc.cpp @@ -670,7 +670,7 @@ void GenXVisaRegAlloc::allocReg(LiveRange *LR) { return; if (GV->hasAttribute(genx::FunctionMD::GenXVolatile)) - Ty = IGCLLVM::getNonOpaquePtrEltTy(Ty); + Ty = GV->getValueType(); } IGC_ASSERT(!Ty->isVoidTy()); if (LR->Category == vc::RegCategory::Predicate) { @@ -707,7 +707,7 @@ static Type *calcOverrideType(Type *OverrideType, const SimpleValue &V, if (OverrideType->isPointerTy()) { auto GV = dyn_cast(V.getValue()); if (GV && GV->hasAttribute(genx::FunctionMD::GenXVolatile)) - OverrideType = IGCLLVM::getNonOpaquePtrEltTy(OverrideType); + OverrideType = GV->getValueType(); } OverrideType = &vc::fixDegenerateVectorType(*OverrideType); if (R->Num < VISA_NUM_RESERVED_REGS) @@ -917,8 +917,7 @@ TypeDetails::TypeDetails(const DataLayout &DL, Type *Ty, Signedness Signed, VisaType = ISA_TYPE_DF; } else if (auto *PtrTy = dyn_cast(ElementTy)) { BytesPerElement = DL.getPointerTypeSize(PtrTy); - if (BytesPerElement == DWordBytes || - IGCLLVM::getNonOpaquePtrEltTy(PtrTy)->isFunctionTy()) + if (BytesPerElement == DWordBytes || vc::isFunctionPointerType(PtrTy)) VisaType = ISA_TYPE_UD; else if (BytesPerElement == QWordBytes) VisaType = ISA_TYPE_UQ;