Skip to content

Commit 718a9f4

Browse files
ViacheslavRbigcbot
authored andcommitted
Reduce usage of pointer element types (18).
This change replaces calls to getNonOpaquePtrEltTy 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 636aafb commit 718a9f4

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,15 +1051,15 @@ void ConstantCoalescing::CombineTwoLoads(
10511051
eac, PointerType::get(vty, addrSpace), "twoScalar", load0);
10521052
m_TT->RegisterNewValueAndAssignID(ptrcast);
10531053
wiAns->incUpdateDepend(ptrcast, WIAnalysis::RANDOM);
1054-
cov_chunk->chunkIO = irBuilder->CreateLoad(ptrcast, false);
1054+
cov_chunk->chunkIO = irBuilder->CreateLoad(vty, ptrcast, false);
10551055
cast<LoadInst>(cov_chunk->chunkIO)->setAlignment(getAlign(4)); // \todo, more precise
10561056
wiAns->incUpdateDepend(cov_chunk->chunkIO, WIAnalysis::RANDOM);
10571057
}
10581058
else
10591059
{
10601060
IGC_ASSERT(isa<IntToPtrInst>(addr_ptr));
10611061
addr_ptr->mutateType(PointerType::get(vty, addrSpace));
1062-
cov_chunk->chunkIO = irBuilder->CreateLoad(addr_ptr, false);
1062+
cov_chunk->chunkIO = irBuilder->CreateLoad(cov_chunk->chunkIO->getType(), addr_ptr, false);
10631063
cast<LoadInst>(cov_chunk->chunkIO)->setAlignment(getAlign(4)); // \todo, more precise
10641064
wiAns->incUpdateDepend(cov_chunk->chunkIO, WIAnalysis::RANDOM);
10651065
// modify the address calculation if the chunk-start is changed
@@ -1764,7 +1764,7 @@ Instruction* ConstantCoalescing::CreateChunkLoad(
17641764
// Update debug location
17651765
ptr->setDebugLoc(irBuilder->getCurrentDebugLocation());
17661766
wiAns->incUpdateDepend(ptr, wiAns->whichDepend(seedi));
1767-
chunkLoad = irBuilder->CreateLoad(ptr);
1767+
chunkLoad = irBuilder->CreateLoad(vty, ptr);
17681768
chunkLoad->setAlignment(getAlign(alignment));
17691769
CopyMetadata(chunkLoad, seedi);
17701770
chunk->chunkIO = chunkLoad;

IGC/Compiler/CISACodeGen/ConstantCoalescing.hpp

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -144,40 +144,18 @@ namespace IGC
144144
m_TT->RegisterNewValueAndAssignID(val);
145145
return val;
146146
}
147-
// This wrapper function is deprecated because it uses typed pointer and
148-
// should no longer be used in LLVM 14+ compatible code.
149-
LoadInst* CreateLoad(Value* Ptr, const char* Name) {
150-
llvm::Type* ptrType = IGCLLVM::getNonOpaquePtrEltTy(Ptr->getType());
151-
LoadInst* val = IGCIRBuilder<>::CreateLoad(ptrType, Ptr, Name);
152-
m_TT->RegisterNewValueAndAssignID(val);
153-
return val;
154-
}
147+
155148
LoadInst* CreateLoad(Type* Ty, Value* Ptr, const Twine& Name = "") {
156149
LoadInst* val = IGCIRBuilder<>::CreateLoad(Ty, Ptr, Name);
157150
m_TT->RegisterNewValueAndAssignID(val);
158151
return val;
159152
}
160-
// This wrapper function is deprecated because it uses typed pointer and
161-
// should no longer be used in LLVM 14+ compatible code.
162-
LoadInst* CreateLoad(Value* Ptr, const Twine& Name = "") {
163-
llvm::Type* ptrType = IGCLLVM::getNonOpaquePtrEltTy(Ptr->getType());
164-
LoadInst* val = IGCIRBuilder<>::CreateLoad(ptrType, Ptr, Name);
165-
m_TT->RegisterNewValueAndAssignID(val);
166-
return val;
167-
}
153+
168154
LoadInst* CreateLoad(Type* Ty, Value* Ptr, bool isVolatile, const Twine& Name = "") {
169155
LoadInst* val = IGCIRBuilder<>::CreateLoad(Ty, Ptr, isVolatile, Name);
170156
m_TT->RegisterNewValueAndAssignID(val);
171157
return val;
172158
}
173-
// This wrapper function is deprecated because it uses typed pointer and
174-
// should no longer be used in LLVM 14+ compatible code.
175-
LoadInst* CreateLoad(Value* Ptr, bool isVolatile, const Twine& Name = "") {
176-
llvm::Type* ptrType = IGCLLVM::getNonOpaquePtrEltTy(Ptr->getType());
177-
LoadInst* val = IGCIRBuilder<>::CreateLoad(ptrType, Ptr, isVolatile, Name);
178-
m_TT->RegisterNewValueAndAssignID(val);
179-
return val;
180-
}
181159

182160
CallInst* CreateCall2(Value* Callee, Value* Arg1, Value* Arg2,
183161
const Twine& Name = "") {

0 commit comments

Comments
 (0)