Skip to content

Commit a57b60c

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 81a27a2 commit a57b60c

File tree

6 files changed

+21
-26
lines changed

6 files changed

+21
-26
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXBaling.cpp

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

IGC/VectorCompiler/lib/GenXCodeGen/GenXLegalization.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,12 +1849,10 @@ Value *GenXLegalization::joinWrRegion(Value *PrevSliceRes, BaleInst BInst,
18491849
// last time round.
18501850
Value *In = !StartIdx ? BInst.Inst->getOperand(0) : PrevSliceRes;
18511851
if (CurSplitKind == SplitKind::SplitKind_GStore && StartIdx != 0) {
1852-
Instruction *ST = B.getHead()->Inst;
1853-
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);
1852+
auto *SI = cast<StoreInst>(B.getHead()->Inst);
1853+
auto *Load = new LoadInst(SI->getValueOperand()->getType(),
1854+
SI->getPointerOperand(), ".gload",
1855+
/*volatile*/ true, InsertBefore);
18581856
Load->setDebugLoc(BInst.Inst->getDebugLoc());
18591857
In = Load;
18601858
}

IGC/VectorCompiler/lib/GenXCodeGen/GenXLowering.cpp

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

IGC/VectorCompiler/lib/GenXCodeGen/GenXUtil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ Instruction *genx::foldBitCastInst(Instruction *Inst) {
17251725
if (auto CI = dyn_cast<BitCastInst>(LI->user_back())) {
17261726
auto NewPtrTy = PointerType::get(CI->getType(), LI->getPointerAddressSpace());
17271727
auto NewPtr = ConstantExpr::getBitCast(GV, NewPtrTy);
1728-
auto NewLI = new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(NewPtrTy), NewPtr, "",
1728+
auto NewLI = new LoadInst(CI->getType(), NewPtr, "",
17291729
/*volatile*/ LI->isVolatile(), Inst);
17301730
NewLI->takeName(LI);
17311731
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)