Skip to content

Commit 0be8288

Browse files
mbelickiigcbot
authored andcommitted
Reduce usage of pointer element type in compute passes.
This change replaces calls to getNonOpaquePtrEltTy in compute-related passes with element type information got through other means. This change is part of the effort to support opaque pointers in newer LLVM versions.
1 parent f0cb23a commit 0be8288

File tree

15 files changed

+58
-35
lines changed

15 files changed

+58
-35
lines changed

IGC/Compiler/Optimizer/BuiltInFuncImport.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ SPDX-License-Identifier: MIT
2828
#include <llvm/Support/Error.h>
2929
#include <llvm/Support/MemoryBuffer.h>
3030
#include <llvm/Bitcode/BitcodeReader.h>
31+
#include "llvmWrapper/IR/DerivedTypes.h"
3132
#include "common/LLVMWarningsPop.hpp"
3233
#include <unordered_set>
3334
#include <unordered_map>
@@ -570,8 +571,7 @@ void BIImport::fixInvalidBitcasts(llvm::Module &M)
570571

571572
// New bitcast
572573
PointerType *FinalBitCastType =
573-
PointerType::get(IGCLLVM::getNonOpaquePtrEltTy(DstPtrType),
574-
SrcPtrType->getAddressSpace());
574+
IGCLLVM::getWithSamePointeeType(DstPtrType, SrcPtrType->getAddressSpace());
575575
BitCastInst *NewBitCastI = new BitCastInst(
576576
BitCastI->getOperand(0), FinalBitCastType, "bcast", BitCastI);
577577

@@ -888,7 +888,7 @@ bool BIImport::runOnModule(Module& M)
888888
// Load function address from the table index
889889
Value* FP = builder.CreateGEP(FPTablePtr, builder.getInt32(tableIndex));
890890
FP = builder.CreateLoad(FP);
891-
IGC_ASSERT(FP->getType()->isPointerTy() && IGCLLVM::getNonOpaquePtrEltTy(FP->getType())->isFunctionTy());
891+
IGC_ASSERT(FP->getType()->isPointerTy());
892892
// Call the loaded function address
893893
SmallVector<Value*, 8> Args;
894894
for (unsigned i = 1; i < IGCLLVM::getNumArgOperands(CI); i++)
@@ -1008,7 +1008,7 @@ void BIImport::removeFunctionBitcasts(Module& M)
10081008
castInsts.push_back(newASC);
10091009
destVal = newASC;
10101010
}
1011-
if (IGCLLVM::getNonOpaquePtrEltTy(srcType) != IGCLLVM::getNonOpaquePtrEltTy(destType))
1011+
if (!IGCLLVM::isOpaqueOrPointeeTypeEquals(srcType, destType))
10121012
{
10131013
BitCastInst *newBT = new BitCastInst(destVal, srcType, destVal->getName() + ".bcast");
10141014
castInsts.push_back(newBT);

IGC/Compiler/Optimizer/OpenCLPasses/AlignmentAnalysis/AlignmentAnalysis.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ auto AlignmentAnalysis::getAlignValue(Value* V) const
132132
// If the globalvariable uses the default alignment, pull it from the datalayout
133133
if (!align)
134134
{
135-
Type* gvType = GV->getType();
136-
return m_DL->getABITypeAlignment(IGCLLVM::getNonOpaquePtrEltTy(gvType));
135+
return m_DL->getABITypeAlignment(GV->getValueType());
137136
}
138137
else
139138
{
@@ -225,8 +224,7 @@ alignment_t AlignmentAnalysis::visitAllocaInst(AllocaInst& I)
225224
// If the alloca uses the default alignment, pull it from the datalayout
226225
if (!newAlign)
227226
{
228-
Type* allocaType = I.getType();
229-
newAlign = m_DL->getABITypeAlignment(IGCLLVM::getNonOpaquePtrEltTy(allocaType));
227+
newAlign = m_DL->getABITypeAlignment(I.getAllocatedType());
230228
}
231229

232230
return newAlign;

IGC/Compiler/Optimizer/OpenCLPasses/GenericAddressResolution/GASPropagator.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ SPDX-License-Identifier: MIT
77
============================= end_copyright_notice ===========================*/
88
#include "GASPropagator.h"
99

10+
#include "llvmWrapper/IR/DerivedTypes.h"
11+
1012
using namespace IGC;
1113

1214
bool GASPropagator::isAddrSpaceResolvable(PHINode* PN, const Loop* L,
@@ -104,7 +106,7 @@ bool GASPropagator::visitAddrSpaceCastInst(AddrSpaceCastInst& I) {
104106
return false;
105107

106108
Value* Src = TheVal;
107-
if (IGCLLVM::getNonOpaquePtrEltTy(SrcPtrTy) != IGCLLVM::getNonOpaquePtrEltTy(DstPtrTy)) {
109+
if (!IGCLLVM::isOpaqueOrPointeeTypeEquals(SrcPtrTy, DstPtrTy)) {
108110
BuilderType::InsertPointGuard Guard(IRB);
109111
IRB.SetInsertPoint(&I);
110112
Src = IRB.CreateBitCast(Src, DstPtrTy);
@@ -150,7 +152,7 @@ bool GASPropagator::visitGetElementPtrInst(GetElementPtrInst& I) {
150152
IRB.SetInsertPoint(I.getNextNode());
151153
// Push `getelementptr` forward by replacing this `bitcast` on GAS with the
152154
// one on non-GAS followed by a new `addrspacecast` to GAS.
153-
Type* DstTy = IGCLLVM::getNonOpaquePtrEltTy(DstPtrTy);
155+
Type* DstTy = I.getSourceElementType();
154156
PointerType* TransPtrTy =
155157
PointerType::get(DstTy, SrcPtrTy->getAddressSpace());
156158
TheUse->set(TheVal);
@@ -275,7 +277,7 @@ bool GASPropagator::visitSelect(SelectInst& I) {
275277

276278
// Push 'addrspacecast' forward by changing the select return type to non-GAS pointer
277279
// followed by a new 'addrspacecast' to GAS
278-
PointerType* TransPtrTy = PointerType::get(IGCLLVM::getNonOpaquePtrEltTy(DstPtrTy), NonGASPtrTy->getAddressSpace());
280+
PointerType* TransPtrTy = IGCLLVM::getWithSamePointeeType(DstPtrTy, NonGASPtrTy->getAddressSpace());
279281
I.mutateType(TransPtrTy);
280282
Value* NewPtr = IRB.CreateAddrSpaceCast(&I, DstPtrTy);
281283

IGC/Compiler/Optimizer/OpenCLPasses/GenericAddressResolution/GASResolving.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ SPDX-License-Identifier: MIT
1010

1111
#include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
1212
#include "Compiler/InitializePasses.h"
13+
#include "llvmWrapper/IR/DerivedTypes.h"
1314

1415
// Generic address space (GAS) pointer resolving is done in two steps:
1516
// 1) Find cast from non-GAS pointer to GAS pointer
@@ -259,7 +260,7 @@ void GASResolving::convertLoadToGlobal(LoadInst* LI) const {
259260

260261
PointerType* PtrTy = cast<PointerType>(LI->getType());
261262
IRB->SetInsertPoint(LI->getNextNode());
262-
PointerType* GlobalPtrTy = PointerType::get(IGCLLVM::getNonOpaquePtrEltTy(PtrTy), ADDRESS_SPACE_GLOBAL);
263+
PointerType* GlobalPtrTy = IGCLLVM::getWithSamePointeeType(PtrTy, ADDRESS_SPACE_GLOBAL);
263264
Value* GlobalAddr = IRB->CreateAddrSpaceCast(LI, GlobalPtrTy);
264265
Value* GenericCopyAddr = IRB->CreateAddrSpaceCast(GlobalAddr, PtrTy);
265266

IGC/Compiler/Optimizer/OpenCLPasses/GenericAddressResolution/GASRetValuePropagator.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ SPDX-License-Identifier: MIT
1717
#include "llvm/ADT/PostOrderIterator.h"
1818
#include "llvm/BinaryFormat/Dwarf.h"
1919
#include "common/LLVMWarningsPop.hpp"
20+
#include "llvmWrapper/IR/DerivedTypes.h"
2021
#include "DebugInfo/DwarfDebug.hpp"
2122

2223
#define PASS_FLAG "igc-gas-ret-value-propagator"
@@ -152,8 +153,10 @@ PointerType* GASRetValuePropagator::getRetValueNonGASType(Function* F)
152153
originAddrSpace.emplace(AS);
153154
}
154155

156+
PointerType *retTy = cast<PointerType>(F->getReturnType());
157+
155158
return originAddrSpace ?
156-
PointerType::get(IGCLLVM::getNonOpaquePtrEltTy(F->getReturnType()), originAddrSpace.value()) :
159+
IGCLLVM::getWithSamePointeeType(retTy, originAddrSpace.value()) :
157160
nullptr;
158161
}
159162

IGC/Compiler/Optimizer/OpenCLPasses/GenericAddressResolution/GenericAddressDynamicResolution.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ SPDX-License-Identifier: MIT
1616
#include "Compiler/MetaDataUtilsWrapper.h"
1717
#include "common/LLVMWarningsPush.hpp"
1818
#include "llvmWrapper/Support/Alignment.h"
19+
#include "llvmWrapper/IR/DerivedTypes.h"
1920
#include <llvm/IR/Module.h>
2021
#include <llvm/IR/Instructions.h>
2122
#include <llvm/IR/DataLayout.h>
@@ -272,7 +273,7 @@ void GenericAddressDynamicResolution::resolveGAS(Instruction& I, Value* pointerO
272273
{
273274
BasicBlock* BB = BasicBlock::Create(I.getContext(), BlockName, convergeBlock->getParent(), convergeBlock);
274275
builder.SetInsertPoint(BB);
275-
PointerType* ptrType = IGCLLVM::getNonOpaquePtrEltTy(pointerType)->getPointerTo(addressSpace);
276+
PointerType* ptrType = IGCLLVM::getWithSamePointeeType(pointerType, addressSpace);
276277
Value* ptr = builder.CreateAddrSpaceCast(pointerOperand, ptrType);
277278

278279
if (LoadInst* LI = dyn_cast<LoadInst>(&I))
@@ -349,7 +350,7 @@ void GenericAddressDynamicResolution::resolveGASWithoutBranches(Instruction& I,
349350

350351
Value* nonLocalLoad = nullptr;
351352

352-
PointerType* ptrType = IGCLLVM::getNonOpaquePtrEltTy(pointerType)->getPointerTo(ADDRESS_SPACE_GLOBAL);
353+
PointerType* ptrType = IGCLLVM::getWithSamePointeeType(pointerType, ADDRESS_SPACE_GLOBAL);
353354
Value* globalPtr = builder.CreateAddrSpaceCast(pointerOperand, ptrType);
354355

355356
if (LoadInst* LI = dyn_cast<LoadInst>(&I))
@@ -438,7 +439,7 @@ bool GenericAddressDynamicResolution::visitIntrinsicCall(CallInst& I)
438439
// If Block
439440
{
440441
IRBuilder<> ifBuilder(ifBlock);
441-
PointerType* ptrType = IGCLLVM::getNonOpaquePtrEltTy(pointerType)->getPointerTo(targetAS);
442+
PointerType *ptrType = IGCLLVM::getWithSamePointeeType(pointerType, targetAS);
442443
newPtr = ifBuilder.CreateAddrSpaceCast(arg, ptrType);
443444
ifBuilder.CreateBr(convergeBlock);
444445
}

IGC/Compiler/Optimizer/OpenCLPasses/GenericAddressResolution/StaticGASResolution.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ SPDX-License-Identifier: MIT
1010

1111
#include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
1212
#include "Compiler/InitializePasses.h"
13+
#include "llvmWrapper/IR/DerivedTypes.h"
1314

1415
FunctionPass* IGC::createStaticGASResolution() { return new StaticGASResolution(); }
1516

@@ -59,8 +60,7 @@ bool StaticGASResolution::runOnFunction(llvm::Function& F)
5960
if (!toSkip(Ptr))
6061
{
6162
PointerType* PtrTy = cast<PointerType>(Ptr->getType());
62-
Type* eltTy = IGCLLVM::getNonOpaquePtrEltTy(PtrTy);
63-
PointerType* glbPtrTy = PointerType::get(eltTy, ADDRESS_SPACE_GLOBAL);
63+
PointerType *glbPtrTy = IGCLLVM::getWithSamePointeeType(PtrTy, ADDRESS_SPACE_GLOBAL);
6464

6565
IRB.SetInsertPoint(I);
6666
Value* NewPtr = IRB.CreateAddrSpaceCast(Ptr, glbPtrTy);

IGC/Compiler/Optimizer/OpenCLPasses/LocalBuffers/InlineLocalsResolution.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,7 @@ void InlineLocalsResolution::computeOffsetList(Module& M, llvm::MapVector<Functi
519519
offsetMap[F][G] = (offset & 0xFFFF);
520520

521521
// And the total size after this local is added
522-
PointerType* ptrType = dyn_cast<PointerType>(G->getType());
523-
Type* varType = IGCLLVM::getNonOpaquePtrEltTy(ptrType);
522+
Type *varType = G->getValueType();
524523
if (G == m_pGV)
525524
{
526525
// it is GetMemPoolPtr usage

IGC/Compiler/Optimizer/OpenCLPasses/NamedBarriers/NamedBarriersResolution.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ void NamedBarriersResolution::HandleNamedBarrierInitSW(CallInst& NBarrierInitCal
332332
m_NamedBarrierType->getPointerTo(SPIRAS_Local),
333333
Type::getInt32PtrTy(context, SPIRAS_Local)
334334
};
335-
Type *BaseTy = IGCLLVM::getNonOpaquePtrEltTy(m_NamedBarrierArray->getType());
335+
Type *BaseTy = m_NamedBarrierArray->getValueType();
336336
auto pointerNBarrier = GetElementPtrInst::Create(BaseTy, m_NamedBarrierArray, { getInt64(module, 0), getInt32(module, 0) }, "", &(NBarrierInitCall));
337337
auto bitcastPointerNBarrier = BitCastInst::CreatePointerBitCastOrAddrSpaceCast(pointerNBarrier, m_NamedBarrierType->getPointerTo(SPIRAS_Local), "", &(NBarrierInitCall));
338338
SmallVector<Value*, 3> ArgsVal
@@ -420,4 +420,4 @@ bool NamedBarriersResolution::NamedBarrierHWSupport()
420420
{
421421
bool hwSupport = m_GFX_CORE == IGFX_XE_HPC_CORE;
422422
return hwSupport;
423-
}
423+
}

IGC/Compiler/Optimizer/OpenCLPasses/PoisonFP64KernelsPass/PoisonFP64KernelsPass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ bool PoisonFP64Kernels::runOnSCC(CallGraphSCC &SCC) {
9090
return modified;
9191
}
9292

93-
static Constant *createPoisonMessage(Module *M, Function *Kernel) {
93+
static GlobalVariable *createPoisonMessage(Module *M, Function *Kernel) {
9494
std::string message = "[CRITICAL ERROR] Kernel '" + Kernel->getName().str()
9595
+ "' removed due to usage of FP64 instructions unsupported by the targeted hardware. "
9696
+ "Running this kernel may result in unexpected results.\n";
@@ -162,8 +162,8 @@ static void poisonKernel(Function *Kernel) {
162162

163163
Function *Printf = getOrDeclareFunction(M, "printf", FunctionType::get(Int32Ty, { Type::getInt8PtrTy(Ctx, 2) }, true));
164164

165-
Constant *PoisonMessage = createPoisonMessage(M, Kernel);
166-
Type *MessageType = IGCLLVM::getNonOpaquePtrEltTy(PoisonMessage->getType());
165+
GlobalVariable *PoisonMessage = createPoisonMessage(M, Kernel);
166+
Type *MessageType = PoisonMessage->getValueType();
167167

168168
std::vector<Value *> Indices = {
169169
ConstantInt::getSigned(Type::getInt32Ty(Ctx), 0),

IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ class TransposeHelperPrivateMem : public TransposeHelper
571571
IRB.SetInsertPoint(pLoad);
572572
if (!vectorIO && pLoad->getType()->isVectorTy())
573573
{
574-
Type* scalarType = IGCLLVM::getNonOpaquePtrEltTy(pLoad->getPointerOperand()->getType())->getScalarType();
574+
Type *scalarType = pLoad->getType()->getScalarType();
575575
IGC_ASSERT(nullptr != scalarType);
576576
Type* scalarptrTy = PointerType::get(scalarType, pLoad->getPointerAddressSpace());
577577
IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
@@ -609,7 +609,7 @@ class TransposeHelperPrivateMem : public TransposeHelper
609609
IRB.SetInsertPoint(pStore);
610610
if (!vectorIO && pStore->getValueOperand()->getType()->isVectorTy())
611611
{
612-
Type* scalarType = IGCLLVM::getNonOpaquePtrEltTy(pStore->getPointerOperand()->getType())->getScalarType();
612+
Type *scalarType = pStore->getValueOperand()->getType()->getScalarType();
613613
IGC_ASSERT(nullptr != scalarType);
614614
Type* scalarptrTy = PointerType::get(scalarType, pStore->getPointerAddressSpace());
615615
IGC_ASSERT(scalarType->getPrimitiveSizeInBits() / 8 == elementSize);
@@ -997,7 +997,7 @@ bool PrivateMemoryResolution::resolveAllocaInstructions(bool privateOnStack)
997997
// possibility to use large loads/stores, so cancel the transformation.
998998
// Currently it is only enabled by option
999999
bool isSOABeneficial = pTypeOfAccessedObject->isVectorTy() || !allUsesAreVector;
1000-
Type* allocaType = GetBaseType(IGCLLVM::getNonOpaquePtrEltTy(pAI->getType()));
1000+
Type *allocaType = pAI->getAllocatedType();
10011001
if (VectorType* vectorType = dyn_cast<VectorType>(allocaType))
10021002
{
10031003
bool baseTypeIsSmall = (unsigned)(vectorType->getElementType()->getScalarSizeInBits()) < 32;
@@ -1011,7 +1011,7 @@ bool PrivateMemoryResolution::resolveAllocaInstructions(bool privateOnStack)
10111011
{
10121012
auto DL = &m_currFunction->getParent()->getDataLayout();
10131013
bufferSize = (unsigned)DL->getTypeAllocSize(pTypeOfAccessedObject);
1014-
IGC_ASSERT(testTransposedMemory(IGCLLVM::getNonOpaquePtrEltTy(pAI->getType()), pTypeOfAccessedObject, bufferSize, (m_ModAllocaInfo->getConstBufferSize(pAI))));
1014+
IGC_ASSERT(testTransposedMemory(pAI->getAllocatedType(), pTypeOfAccessedObject, bufferSize, (m_ModAllocaInfo->getConstBufferSize(pAI))));
10151015
}
10161016
else
10171017
{

IGC/Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryToSLM.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ namespace IGC
192192
unsigned int offset = 0;
193193
for (const auto &offsets : ModuleMD->FuncMD[F].localOffsets)
194194
{
195-
PointerType* ptrType = dyn_cast<PointerType>(offsets.m_Var->getType());
196-
Type* varType = IGCLLVM::getNonOpaquePtrEltTy(ptrType);
195+
Type* varType = offsets.m_Var->getValueType();
197196
offset = iSTD::Align(offset, IGCLLVM::getPreferredAlignValue(&DL, offsets.m_Var));
198197
offset += (unsigned int) DL.getTypeAllocSize(varType);
199198
}
@@ -229,7 +228,7 @@ namespace IGC
229228

230229
if (m_ForceAll || isForcedBuffer)
231230
{
232-
Type* origType = IGCLLVM::getNonOpaquePtrEltTy(pAI->getType());
231+
Type *origType = pAI->getAllocatedType();
233232
bool isArray = origType->isArrayTy();
234233
Type* eltType = isArray ? origType->getArrayElementType() : origType;
235234
uint64_t numEltsPerThread = isArray ? origType->getArrayNumElements() : 1;

IGC/Compiler/Optimizer/OpenCLPasses/ProgramScopeConstants/ProgramScopeConstantAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ bool ProgramScopeConstantAnalysis::runOnModule(Module& M)
196196
offset = iSTD::Align(offset, (unsigned)m_DL->getPreferredAlign(globalVar).value());
197197
#endif
198198
inlineProgramScopeOffsets[globalVar] = offset;
199-
offset += (unsigned)(m_DL->getTypeAllocSize(IGCLLVM::getNonOpaquePtrEltTy(globalVar->getType())));
199+
offset += (unsigned)(m_DL->getTypeAllocSize(globalVar->getValueType()));
200200
}
201201

202202
// Patch the offsets for usages of zero initialized globals after those offsets have been calculated in the previous step.

IGC/Compiler/Optimizer/PreCompiledFuncImport.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,8 +549,9 @@ bool PreCompiledFuncImport::preProcessDouble()
549549
else if (Inst->getOpcode() == Instruction::FNeg)
550550
{
551551
// check if Inst is double instruction or vector of double instructions
552-
if (Inst->getType()->isDoubleTy() ||
553-
(Inst->getType()->isVectorTy() && IGCLLVM::getNonOpaquePtrEltTy(Inst->getType())->isDoubleTy()))
552+
Type *instType = Inst->getType();
553+
IGCLLVM::FixedVectorType *instVecType = dyn_cast<IGCLLVM::FixedVectorType>(instType);
554+
if (instType->isDoubleTy() || (instVecType && instVecType->getElementType()->isDoubleTy()))
554555
{
555556
IGCLLVM::IRBuilder<> builder(Inst);
556557
Value* fsub = nullptr;

IGC/WrapperLLVM/include/llvmWrapper/IR/DerivedTypes.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ SPDX-License-Identifier: MIT
1515
#include "llvm/IR/Module.h"
1616
#include "common/CommonMacros.h"
1717

18+
#include "Type.h"
19+
1820
namespace IGCLLVM
1921
{
2022

@@ -70,6 +72,23 @@ namespace IGCLLVM
7072
return EltTy;
7173
#else
7274
return Ty->getWithNewBitWidth(NewBitWidth);
75+
#endif
76+
}
77+
78+
inline llvm::PointerType *getWithSamePointeeType(llvm::PointerType *PT, unsigned AddressSpace) {
79+
#if LLVM_VERSION_MAJOR < 14
80+
return llvm::PointerType::get(PT->getElementType(), AddressSpace);
81+
#else
82+
return llvm::PointerType::getWithSamePointeeType(PT, AddressSpace);
83+
#endif
84+
}
85+
86+
inline bool isOpaqueOrPointeeTypeEquals(llvm::Type *tyA, llvm::Type *tyB) {
87+
#if LLVM_VERSION_MAJOR < 14
88+
return IGCLLVM::getNonOpaquePtrEltTy(tyA) == IGCLLVM::getNonOpaquePtrEltTy(tyB);
89+
#else
90+
llvm::PointerType *pTyA = llvm::dyn_cast<llvm::PointerType>(tyA);
91+
return pTyA && pTyA->isOpaqueOrPointeeTypeMatches(tyB);
7392
#endif
7493
}
7594
}

0 commit comments

Comments
 (0)