Skip to content

Commit 1bb3f55

Browse files
krystian-andrzejewskiigcbot
authored andcommitted
Remove dead code from the sync coal obj pass
This change is just a clean-up work.
1 parent b61f15a commit 1bb3f55

File tree

1 file changed

+27
-68
lines changed

1 file changed

+27
-68
lines changed

IGC/Compiler/Optimizer/SynchronizationObjectCoalescing.cpp

Lines changed: 27 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*========================== begin_copyright_notice ============================
22
3-
Copyright (C) 2021-2023 Intel Corporation
3+
Copyright (C) 2021-2025 Intel Corporation
44
55
SPDX-License-Identifier: MIT
66
@@ -55,17 +55,16 @@ struct ExplanationEntry
5555
enum InstructionMask : uint32_t
5656
{
5757
None = 0x0,
58-
AtomicOperation = (1 << 0),
59-
TypedReadOperation = (1 << 1),
60-
TypedWriteOperation = (1 << 2),
61-
OutputUrbReadOperation = (1 << 3),
62-
UrbWriteOperation = (1 << 4),
63-
BufferReadOperation = (1 << 5),
64-
BufferWriteOperation = (1 << 6),
65-
SharedMemoryReadOperation = (1 << 7),
66-
SharedMemoryWriteOperation = (1 << 8),
67-
EndOfThreadOperation = (1 << 9),
68-
58+
AtomicOperation = (1 << 0),
59+
TypedReadOperation = (1 << 1),
60+
TypedWriteOperation = (1 << 2),
61+
OutputUrbReadOperation = (1 << 3),
62+
UrbWriteOperation = (1 << 4),
63+
BufferReadOperation = (1 << 5),
64+
BufferWriteOperation = (1 << 6),
65+
SharedMemoryReadOperation = (1 << 7),
66+
SharedMemoryWriteOperation = (1 << 8),
67+
EndOfThreadOperation = (1 << 9),
6968
LastMaskPlusOne,
7069
};
7170

@@ -284,7 +283,8 @@ class SynchronizationObjectCoalescing : public llvm::FunctionPass
284283
ReadSyncAtomic = 0x20,
285284
WriteSyncRead = 0x40,
286285
AtomicSyncAtomic = 0x80,
287-
WriteSyncRet = 0x100
286+
WriteSyncRet = 0x100,
287+
ExtendedCacheControlSyncRet = 0x200
288288
};
289289

290290
private:
@@ -401,19 +401,7 @@ class SynchronizationObjectCoalescing : public llvm::FunctionPass
401401
////////////////////////////////////////////////////////////////////////
402402
SynchronizationCaseMask GetSynchronizationMaskForAllResources(
403403
InstructionMask localForwardMemoryInstructionMask,
404-
InstructionMask localBackwardMemoryInstructionMask) const;;
405-
406-
////////////////////////////////////////////////////////////////////////
407-
static bool IsSyncInstruction(const llvm::Instruction* pInst);
408-
409-
////////////////////////////////////////////////////////////////////////
410-
static bool IsMemoryInstruction(const llvm::Instruction* pInst);
411-
412-
////////////////////////////////////////////////////////////////////////
413-
static bool IsReadMemoryInstruction(const llvm::Instruction* pInst);
414-
415-
////////////////////////////////////////////////////////////////////////
416-
static bool IsWriteMemoryInstruction(const llvm::Instruction* pInst);
404+
InstructionMask localBackwardMemoryInstructionMask) const;
417405

418406
////////////////////////////////////////////////////////////////////////
419407
static bool IsAtomicOperation(const llvm::Instruction* pInst);
@@ -983,7 +971,8 @@ InstructionMask SynchronizationObjectCoalescing::GetDefaultWriteMemoryInstructio
983971
{
984972
case LSC_UGM: // .ugm
985973
case LSC_UGML: // .ugml
986-
result |= BufferWriteOperation;
974+
result |=
975+
BufferWriteOperation;
987976
if (!m_HasIndependentSharedMemoryFenceFunctionality)
988977
{
989978
result |= SharedMemoryWriteOperation;
@@ -1088,7 +1077,10 @@ InstructionMask SynchronizationObjectCoalescing::GetDefaultMemoryInstructionMask
10881077
{
10891078
case LSC_UGM: // .ugm
10901079
case LSC_UGML: // .ugml
1091-
result |= AtomicOperation | BufferWriteOperation | BufferReadOperation;
1080+
result |=
1081+
AtomicOperation |
1082+
BufferWriteOperation |
1083+
BufferReadOperation;
10921084
if (!m_HasIndependentSharedMemoryFenceFunctionality)
10931085
{
10941086
result |= SharedMemoryWriteOperation | SharedMemoryReadOperation;
@@ -1134,7 +1126,11 @@ InstructionMask SynchronizationObjectCoalescing::GetDefaultMemoryInstructionMask
11341126
IGC_ASSERT(0);
11351127
}
11361128

1137-
if (static_cast<uint32_t>(result & (SharedMemoryWriteOperation | BufferWriteOperation | TypedWriteOperation)) != 0)
1129+
constexpr InstructionMask maskToIncludeEOT =
1130+
SharedMemoryWriteOperation |
1131+
BufferWriteOperation |
1132+
TypedWriteOperation;
1133+
if (static_cast<uint32_t>(result & maskToIncludeEOT) != 0)
11381134
{
11391135

11401136
result = static_cast<InstructionMask>(
@@ -1911,8 +1907,8 @@ SynchronizationObjectCoalescing::SynchronizationCaseMask SynchronizationObjectCo
19111907
}
19121908

19131909
// write -> fence -> ret
1914-
bool requiresFlush = static_cast<uint32_t>(writeBit & (SharedMemoryWriteOperation | BufferWriteOperation | TypedWriteOperation)) != 0;
1915-
bool isWriteSyncRetCase = requiresFlush && ((localBackwardMemoryInstructionMask & writeBit) != 0 &&
1910+
bool requiresFlushWrites = static_cast<uint32_t>(writeBit & (SharedMemoryWriteOperation | BufferWriteOperation | TypedWriteOperation)) != 0;
1911+
bool isWriteSyncRetCase = requiresFlushWrites && ((localBackwardMemoryInstructionMask & writeBit) != 0 &&
19161912
(localForwardMemoryInstructionMask & EndOfThreadOperation) != 0);
19171913
if (isWriteSyncRetCase)
19181914
{
@@ -2380,43 +2376,6 @@ void SynchronizationObjectCoalescing::InvalidateMembers()
23802376
m_GlobalMemoryInstructionMask = InstructionMask::None;
23812377
}
23822378

2383-
////////////////////////////////////////////////////////////////////////
2384-
bool SynchronizationObjectCoalescing::IsSyncInstruction(const llvm::Instruction* pInst)
2385-
{
2386-
return IsThreadBarrierOperation(pInst) ||
2387-
IsTypedMemoryFenceOperation(pInst) ||
2388-
IsUrbFenceOperation(pInst) ||
2389-
IsLscFenceOperation(pInst) ||
2390-
IsUntypedMemoryFenceOperation(pInst);
2391-
}
2392-
2393-
////////////////////////////////////////////////////////////////////////
2394-
bool SynchronizationObjectCoalescing::IsMemoryInstruction(const llvm::Instruction* pInst)
2395-
{
2396-
return IsReadMemoryInstruction(pInst) ||
2397-
IsWriteMemoryInstruction(pInst);
2398-
}
2399-
2400-
////////////////////////////////////////////////////////////////////////
2401-
bool SynchronizationObjectCoalescing::IsReadMemoryInstruction(const llvm::Instruction* pInst)
2402-
{
2403-
return IsAtomicOperation(pInst) ||
2404-
IsBufferReadOperation(pInst) ||
2405-
IsSharedMemoryReadOperation(pInst) ||
2406-
IsTypedReadOperation(pInst) ||
2407-
IsOutputUrbReadOperation(pInst);
2408-
}
2409-
2410-
////////////////////////////////////////////////////////////////////////
2411-
bool SynchronizationObjectCoalescing::IsWriteMemoryInstruction(const llvm::Instruction* pInst)
2412-
{
2413-
return IsAtomicOperation(pInst) ||
2414-
IsBufferWriteOperation(pInst) ||
2415-
IsSharedMemoryWriteOperation(pInst) ||
2416-
IsTypedWriteOperation(pInst) ||
2417-
IsUrbWriteOperation(pInst);
2418-
}
2419-
24202379
////////////////////////////////////////////////////////////////////////
24212380
bool SynchronizationObjectCoalescing::IsAtomicOperation(const llvm::Instruction* pInst)
24222381
{

0 commit comments

Comments
 (0)