Skip to content

Commit 61fda4a

Browse files
michalkr52igcbot
authored andcommitted
Remove left-over patch token logic from ProgramScopeConstantAnalysis
Removed deprecated logic after fully deprecating the patch token format in OCL. The removed code patches offsets based on the m_PatchLaterDataVector, which is always empty, as it was used on the patch token code path.
1 parent 8f730d8 commit 61fda4a

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -196,23 +196,6 @@ bool ProgramScopeConstantAnalysis::runOnModule(Module& M)
196196
offset += (unsigned)(m_DL->getTypeAllocSize(globalVar->getValueType()));
197197
}
198198

199-
// Patch the offsets for usages of zero initialized globals after those offsets have been calculated in the previous step.
200-
// TODO: Remove this logic after enabling ZeBinary, since we will switch the patching to use relocation table instead.
201-
for (const ZeroInitPatchInfo &patchData : m_PatchLaterDataVector)
202-
{
203-
DataVector& toPatchDataVector = m_pModuleMd->inlineBuffers[patchData.toPatchDataVectorType].Buffer;
204-
char* whereToPatch = (char *)&toPatchDataVector[patchData.toPatchIndexOfPointer];
205-
unsigned patchSize = patchData.toPatchSizeOfPointer;
206-
GlobalVariable* globalVar = patchData.pointerBase;
207-
208-
auto iter = inlineProgramScopeOffsets.find(globalVar);
209-
IGC_ASSERT(iter != inlineProgramScopeOffsets.end());
210-
211-
const uint64_t patchOffset = iter->second + patchData.pointerOffset;
212-
IGC_ASSERT(patchSize <= sizeof(patchOffset));
213-
memcpy_s(whereToPatch, patchSize, (char*)&patchOffset, patchSize);
214-
}
215-
216199
if (inlineProgramScopeOffsets.size())
217200
{
218201
// Add globals tracked in metadata to the "llvm.used" list so they won't be deleted by optimizations

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,6 @@ namespace IGC
9191

9292
const llvm::DataLayout* m_DL = nullptr;
9393
ModuleMetaData* m_pModuleMd = nullptr;
94-
95-
// Used to patch offsets for zero initialized globals
96-
struct ZeroInitPatchInfo {
97-
InlineProgramScopeBufferType toPatchDataVectorType;
98-
size_t toPatchIndexOfPointer;
99-
unsigned toPatchSizeOfPointer;
100-
llvm::GlobalVariable* pointerBase;
101-
int64_t pointerOffset;
102-
};
103-
std::vector<ZeroInitPatchInfo> m_PatchLaterDataVector;
10494
};
10595

10696
} // namespace IGC

0 commit comments

Comments
 (0)