Skip to content

Commit d9569f6

Browse files
mshelegoigcbot
authored andcommitted
IGCLLVM::getNonOpaquePtrEltTy elimination in load insts creation
This change is part of the effort to support opaque pointers in newer LLVM versions
1 parent bdea4ea commit d9569f6

File tree

6 files changed

+20
-24
lines changed

6 files changed

+20
-24
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXBaling.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,8 +2224,8 @@ static bool skipTransform(Instruction *DefI, Instruction *UseI) {
22242224
// gstore w, G
22252225
static void normalizeGStore(StoreInst &SI) {
22262226
Value *PointerOp = SI.getPointerOperand();
2227-
auto LI = new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(PointerOp->getType()),
2228-
PointerOp, ".gload", true /*volatile*/, &SI);
2227+
auto LI = new LoadInst(SI.getValueOperand()->getType(), PointerOp, ".gload",
2228+
true /*volatile*/, &SI);
22292229
Value *StoreOp = SI.getValueOperand();
22302230
Region R(StoreOp);
22312231
auto WrR =

IGC/VectorCompiler/lib/GenXCodeGen/GenXLegalization.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,10 +1851,9 @@ Value *GenXLegalization::joinWrRegion(Value *PrevSliceRes, BaleInst BInst,
18511851
if (CurSplitKind == SplitKind::SplitKind_GStore && StartIdx != 0) {
18521852
Instruction *ST = B.getHead()->Inst;
18531853
IGC_ASSERT(isa<StoreInst>(ST));
1854-
Value *GV = ST->getOperand(1);
1855-
auto *Load =
1856-
new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(GV->getType()), GV, ".gload",
1857-
/*volatile*/ true, InsertBefore);
1854+
auto *GV = cast<GlobalValue>(ST->getOperand(1));
1855+
auto *Load = new LoadInst(GV->getValueType(), GV, ".gload",
1856+
/*volatile*/ true, InsertBefore);
18581857
Load->setDebugLoc(BInst.Inst->getDebugLoc());
18591858
In = Load;
18601859
}

IGC/VectorCompiler/lib/GenXCodeGen/GenXLowering.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,9 +2040,8 @@ bool GenXLowering::processInst(Instruction *Inst) {
20402040
case GenXIntrinsic::genx_vload: {
20412041
if (!Inst->use_empty()) {
20422042
Value *Ptr = Inst->getOperand(0);
2043-
LoadInst *LI =
2044-
new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(Ptr->getType()), Ptr, "",
2045-
/*volatile*/ true, Inst);
2043+
LoadInst *LI = new LoadInst(Inst->getType(), Ptr, "",
2044+
/*volatile*/ true, Inst);
20462045
LI->takeName(Inst);
20472046
LI->setDebugLoc(Inst->getDebugLoc());
20482047
Inst->replaceAllUsesWith(LI);

IGC/VectorCompiler/lib/GenXCodeGen/GenXUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1733,7 +1733,7 @@ Instruction *genx::foldBitCastInst(Instruction *Inst) {
17331733
if (auto CI = dyn_cast<BitCastInst>(LI->user_back())) {
17341734
auto NewPtrTy = PointerType::get(CI->getType(), LI->getPointerAddressSpace());
17351735
auto NewPtr = ConstantExpr::getBitCast(GV, NewPtrTy);
1736-
auto NewLI = new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(NewPtrTy), NewPtr, "",
1736+
auto NewLI = new LoadInst(CI->getType(), NewPtr, "",
17371737
/*volatile*/ LI->isVolatile(), Inst);
17381738
NewLI->takeName(LI);
17391739
NewLI->setDebugLoc(LI->getDebugLoc());

IGC/VectorCompiler/lib/GenXOpts/CMTrans/CMImpParam.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*========================== begin_copyright_notice ============================
22
3-
Copyright (C) 2017-2023 Intel Corporation
3+
Copyright (C) 2017-2024 Intel Corporation
44
55
SPDX-License-Identifier: MIT
66
@@ -769,9 +769,9 @@ void CMImpParam::replaceWithGlobal(CallInst *CI) {
769769
"genx or vc internal intrinsic is expected");
770770
auto IID = vc::getAnyIntrinsicID(CI->getCalledFunction());
771771
GlobalVariable *GV = getOrCreateGlobalForIID(CI->getFunction(), IID);
772-
LoadInst *Load = new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(GV->getType()), GV, "",
773-
/* isVolatile */ false,
774-
IGCLLVM::getCorrectAlign(GV->getAlignment()), CI);
772+
LoadInst *Load = new LoadInst(
773+
GV->getValueType(), GV, "",
774+
/* isVolatile */ false, IGCLLVM::getCorrectAlign(GV->getAlignment()), CI);
775775
Load->takeName(CI);
776776
Load->setDebugLoc(CI->getDebugLoc());
777777
CI->replaceAllUsesWith(Load);

IGC/VectorCompiler/lib/Utils/General/InstRebuilder.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*========================== begin_copyright_notice ============================
22
3-
Copyright (C) 2021 Intel Corporation
3+
Copyright (C) 2021-2024 Intel Corporation
44
55
SPDX-License-Identifier: MIT
66
@@ -95,15 +95,13 @@ class cloneInstWithNewOpsImpl
9595

9696
Instruction *visitLoadInst(LoadInst &OrigLoad) {
9797
Value &Ptr = getSingleNewOperand();
98-
auto *NewLoad =
99-
new LoadInst{IGCLLVM::getNonOpaquePtrEltTy(Ptr.getType()),
100-
&Ptr,
101-
"",
102-
OrigLoad.isVolatile(),
103-
IGCLLVM::getAlign(OrigLoad),
104-
OrigLoad.getOrdering(),
105-
OrigLoad.getSyncScopeID()};
106-
return NewLoad;
98+
return new LoadInst{OrigLoad.getType(),
99+
&Ptr,
100+
"",
101+
OrigLoad.isVolatile(),
102+
IGCLLVM::getAlign(OrigLoad),
103+
OrigLoad.getOrdering(),
104+
OrigLoad.getSyncScopeID()};
107105
}
108106

109107
StoreInst *visitStoreInst(StoreInst &OrigStore) {

0 commit comments

Comments
 (0)