Skip to content

Commit f1a3baa

Browse files
fda0igcbot
authored andcommitted
Remove dead code, unused variable, fix unsigned underflow
- KernelParser.cpp change removes store to `rgn` that was always overwritten in all codepaths without any load. - G4_Kernel.hpp change removes potential unsigned underflow condition `i >= 0` in the for loop always evaluates to true for unsigned values. - CISABuilder.cpp change removes `resource` null check because it must be non-null to reach this codepath.
1 parent d214783 commit f1a3baa

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8247,8 +8247,7 @@ namespace IGC
82478247
// Split d32-V8 -> 2xD32-V4 (or D64-V3/V4 -> D64-V2 & D64-V1/V2).
82488248
// Create operands for 2nd LSC and modify the first's elems
82498249
VISA_PredOpnd* predOpnd2 = GetFlagOperand(m_encoderState.m_flag);
8250-
VISA_VectorOpnd* globalOffsetOpnd2 =
8251-
resource ? GetVISALSCSurfaceOpnd(resource->m_surfaceType, resource->m_resource) : nullptr;
8250+
VISA_VectorOpnd* globalOffsetOpnd2 = GetVISALSCSurfaceOpnd(resource->m_surfaceType, resource->m_resource);
82528251
unsigned blockOffset2 = blockOffset + 128; /* dst offset of 2nd D32-V4(D64-V2/V1) is 4 GRF */
82538252
VISA_RawOpnd* dstOpnd2 = GetRawDestination(dst, blockOffset2);
82548253
VISA_RawOpnd* addressOpnd2 = offset ? GetRawSource(offset) : nullptr;
@@ -8389,8 +8388,7 @@ namespace IGC
83898388
// Split d32-V8 -> 2xD32-V4 (or D64-V3/V4 -> D64-V2 & D64-V1/V2).
83908389
// Create operands for 2nd LSC and modify the first's elems
83918390
VISA_PredOpnd* predOpnd2 = GetFlagOperand(m_encoderState.m_flag);
8392-
VISA_VectorOpnd* globalOffsetOpnd2 =
8393-
resource ? GetVISALSCSurfaceOpnd(resource->m_surfaceType, resource->m_resource) : nullptr;
8391+
VISA_VectorOpnd* globalOffsetOpnd2 = GetVISALSCSurfaceOpnd(resource->m_surfaceType, resource->m_resource);
83948392
unsigned blockOffset2 = blockOffset + 128; /* src1 offset of 2nd D32-V4 (D64-V2/V1) is 4 GRF */
83958393
VISA_RawOpnd* src1Opnd2 = GetRawSource(src, blockOffset2);
83968394
VISA_RawOpnd* addressOpnd2 = GetRawSource(offset);

visa/G4_Kernel.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class GRFMode {
192192
}
193193

194194
unsigned getVRTSmallerGRF() const {
195-
for (auto i = currentMode - 1; i >= 0 ; --i) {
195+
for (auto i = static_cast<int>(currentMode) - 1; i >= 0 ; --i) {
196196
if (configs[i].VRTEnable)
197197
return configs[i].numGRF;
198198
}

visa/iga/IGALibrary/Frontend/KernelParser.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,9 +2203,6 @@ class KernelParser : GenParser {
22032203
// r13.acc2:f
22042204
subregNum = 0;
22052205
mme = ParseMathMacroReg();
2206-
// region is implicitly <1;1,0>
2207-
rgn = Region::SRC110;
2208-
// below we can override it if we really really want to
22092206
} else {
22102207
// regular src with subregister
22112208
// r13.4....

0 commit comments

Comments
 (0)