Skip to content

Commit 3bd1d5e

Browse files
mshelegoigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: d9569f6
IGCLLVM::getNonOpaquePtrEltTy elimination in load insts creation This change is part of the effort to support opaque pointers in newer LLVM versions
1 parent 87377b5 commit 3bd1d5e

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
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(SI.getValueOperand()->getType(), PointerOp, ".gload",
2234-
true /*volatile*/, &SI);
2233+
auto LI = new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(PointerOp->getType()),
2234+
PointerOp, ".gload", 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 & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,9 +1851,10 @@ 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-
auto *GV = cast<GlobalValue>(ST->getOperand(1));
1855-
auto *Load = new LoadInst(GV->getValueType(), GV, ".gload",
1856-
/*volatile*/ true, InsertBefore);
1854+
Value *GV = ST->getOperand(1);
1855+
auto *Load =
1856+
new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(GV->getType()), GV, ".gload",
1857+
/*volatile*/ true, InsertBefore);
18571858
Load->setDebugLoc(BInst.Inst->getDebugLoc());
18581859
In = Load;
18591860
}

IGC/VectorCompiler/lib/GenXCodeGen/GenXLowering.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,8 +2041,9 @@ bool GenXLowering::processInst(Instruction *Inst) {
20412041
case GenXIntrinsic::genx_vload: {
20422042
if (!Inst->use_empty()) {
20432043
Value *Ptr = Inst->getOperand(0);
2044-
LoadInst *LI = new LoadInst(Inst->getType(), Ptr, "",
2045-
/*volatile*/ true, Inst);
2044+
LoadInst *LI =
2045+
new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(Ptr->getType()), Ptr, "",
2046+
/*volatile*/ true, Inst);
20462047
LI->takeName(Inst);
20472048
LI->setDebugLoc(Inst->getDebugLoc());
20482049
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(CI->getType(), NewPtr, "",
1736+
auto NewLI = new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(NewPtrTy), 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-2024 Intel Corporation
3+
Copyright (C) 2017-2023 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(
773-
GV->getValueType(), GV, "",
774-
/* isVolatile */ false, IGCLLVM::getCorrectAlign(GV->getAlignment()), CI);
772+
LoadInst *Load = new LoadInst(IGCLLVM::getNonOpaquePtrEltTy(GV->getType()), GV, "",
773+
/* isVolatile */ false,
774+
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: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*========================== begin_copyright_notice ============================
22
3-
Copyright (C) 2021-2024 Intel Corporation
3+
Copyright (C) 2021 Intel Corporation
44
55
SPDX-License-Identifier: MIT
66
@@ -95,13 +95,15 @@ class cloneInstWithNewOpsImpl
9595

9696
Instruction *visitLoadInst(LoadInst &OrigLoad) {
9797
Value &Ptr = getSingleNewOperand();
98-
return new LoadInst{OrigLoad.getType(),
99-
&Ptr,
100-
"",
101-
OrigLoad.isVolatile(),
102-
IGCLLVM::getAlign(OrigLoad),
103-
OrigLoad.getOrdering(),
104-
OrigLoad.getSyncScopeID()};
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;
105107
}
106108

107109
StoreInst *visitStoreInst(StoreInst &OrigStore) {

0 commit comments

Comments
 (0)