Skip to content

Commit b41d422

Browse files
igorban-inteligcbot
authored andcommitted
Fixed warning from statical code analizer
.
1 parent 94ec9d3 commit b41d422

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3164,8 +3164,9 @@ void GenXKernelBuilder::buildGoto(CallInst *Goto, BranchInst *Branch) {
31643164
IGC_ASSERT(PredReg->Category == vc::RegCategory::Predicate);
31653165
}
31663166

3167-
uint8_t execSize = genx::log2(
3167+
auto execSize = genx::log2(
31683168
cast<IGCLLVM::FixedVectorType>(Pred->getType())->getNumElements());
3169+
IGC_ASSERT_EXIT(execSize > 0);
31693170

31703171
// Visa decoder part
31713172
VISA_EMask_Ctrl emask = VISA_EMask_Ctrl((execSize >> 0x4) & 0xF);
@@ -5221,15 +5222,15 @@ GenXKernelBuilder::createGeneralOperand(Region *R, VISA_GenVar *Decl,
52215222
// Write the vISA general operand, canonicalizing the
52225223
// region parameters where applicable.
52235224
IGC_ASSERT_MESSAGE(Decl, "no register allocated for this value");
5225+
IGC_ASSERT_EXIT(GrfByteSize > 0);
5226+
auto Off = R->Offset >> genx::log2(GrfByteSize);
5227+
auto NumOff = (R->Offset & (GrfByteSize - 1)) / R->ElementBytes;
52245228
if (!IsDest) {
5225-
ResultOperand = createCisaSrcOperand(
5226-
Decl, static_cast<VISA_Modifier>(Mod), R->VStride, R->Width, R->Stride,
5227-
R->Offset >> genx::log2(GrfByteSize),
5228-
(R->Offset & (GrfByteSize - 1)) / R->ElementBytes);
5229+
ResultOperand =
5230+
createCisaSrcOperand(Decl, static_cast<VISA_Modifier>(Mod), R->VStride,
5231+
R->Width, R->Stride, Off, NumOff);
52295232
} else {
5230-
ResultOperand = createCisaDstOperand(
5231-
Decl, R->getDstStride(), R->Offset >> genx::log2(GrfByteSize),
5232-
(R->Offset & (GrfByteSize - 1)) / R->ElementBytes);
5233+
ResultOperand = createCisaDstOperand(Decl, R->getDstStride(), Off, NumOff);
52335234
}
52345235
return ResultOperand;
52355236
}

IGC/VectorCompiler/lib/GenXCodeGen/GenXLiveElements.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LiveElements {
5656
LiveElements(Type *Ty, bool IsLive = false);
5757
LiveElements(const ArrayRef<SmallBitVector> LE)
5858
: LiveElems(LE.begin(), LE.end()) {}
59-
LiveElements(SmallBitVector &&LE) : LiveElems({LE}) {}
59+
LiveElements(SmallBitVector &&LE) : LiveElems({std::move(LE)}) {}
6060
LiveElements(const SmallBitVector &LE) = delete;
6161
LiveElements &operator=(const SmallBitVector &) = delete;
6262

IGC/VectorCompiler/lib/GenXCodeGen/GenXLowering.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,17 +1886,16 @@ bool GenXLowering::processInst(Instruction *Inst) {
18861886
IntrinsicID = vc::getAnyIntrinsicID(Callee);
18871887
IGC_ASSERT(IGCLLVM::getNumArgOperands(CI) < GenXIntrinsicInfo::OPNDMASK);
18881888
}
1889-
if (ST) {
1890-
// use gather/scatter to implement SLM oword load/store on
1891-
// legacy platforms
1892-
if (!ST->hasSLMOWord()) {
1893-
if (translateSLMOWord(CI, IntrinsicID))
1894-
return true;
1895-
}
1896-
if (ST->getGRFByteSize() > 32) {
1897-
if (widenSIMD8GatherScatter(CI, IntrinsicID))
1898-
return true;
1899-
}
1889+
IGC_ASSERT_EXIT(ST);
1890+
// use gather/scatter to implement SLM oword load/store on
1891+
// legacy platforms
1892+
if (!ST->hasSLMOWord()) {
1893+
if (translateSLMOWord(CI, IntrinsicID))
1894+
return true;
1895+
}
1896+
if (ST->getGRFByteSize() > 32) {
1897+
if (widenSIMD8GatherScatter(CI, IntrinsicID))
1898+
return true;
19001899
}
19011900
// split gather/scatter/atomic into the width legal to the target
19021901
if (splitGatherScatter(CI, IntrinsicID))

IGC/VectorCompiler/lib/GenXCodeGen/GenXRegionUtils.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ Region genx::makeRegionFromBaleInfo(const Instruction *Inst, const BaleInfo &BI,
189189
Result.Mask = 0;
190190
break;
191191
default:
192-
IGC_ASSERT(0);
192+
IGC_ASSERT_EXIT(0);
193193
}
194194
// Get the region parameters.
195-
IGC_ASSERT(Subregion);
195+
IGC_ASSERT_EXIT(Subregion);
196196
Result.ElementTy = Subregion->getType();
197197
if (auto *VT = dyn_cast<IGCLLVM::FixedVectorType>(Result.ElementTy)) {
198198
Result.ElementTy = VT->getElementType();
@@ -365,12 +365,13 @@ unsigned genx::getLegalRegionSizeForTarget(const GenXSubtarget &ST,
365365
// 4. no more than 8 elements in multi indirect (because there
366366
// are only 8 elements in an address register).
367367
IGC_ASSERT_EXIT(Width > 0 && R.ElementBytes > 0);
368-
unsigned LogWidth = genx::log2(Width);
368+
auto LogWidth = genx::log2(Width);
369369
if (1U << LogWidth == Width)
370370
LogWidth = genx::log2(R.NumElements); // legal width
371371
unsigned LogElementBytes = genx::log2(R.ElementBytes);
372372
if (LogWidth + LogElementBytes > (LogGRFWidth + 1))
373373
LogWidth = LogGRFWidth + 1 - LogElementBytes;
374+
IGC_ASSERT_EXIT(LogWidth >= 0);
374375
ValidWidth = 1 << LogWidth;
375376
if (ValidWidth > 8)
376377
ValidWidth = 8;
@@ -496,6 +497,7 @@ unsigned genx::getLegalRegionSizeForTarget(const GenXSubtarget &ST,
496497
NumRows = (R.NumElements - Idx) / R.Width;
497498
}
498499
}
500+
IGC_ASSERT_EXIT(NumRows > 0);
499501
ValidWidth = (1 << genx::log2(NumRows)) * R.Width;
500502
}
501503
if (ValidWidth == 1 && Idx % R.Width) {

IGC/VectorCompiler/lib/GenXOpts/CMTrans/CMImpParam.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,13 +721,15 @@ static Value &loadArgFromIABuffer(unsigned IID, Value &ImplArgsBufferPtr,
721721
IGC_ASSERT_EXIT_MESSAGE(
722722
0, "IA buffer is supported only for OCL/L0 so local.id "
723723
"must have been already transformed into local.id16");
724+
return ImplArgsBufferPtr;
724725
case GenXIntrinsic::genx_get_scoreboard_deltas:
725726
case GenXIntrinsic::genx_get_scoreboard_bti:
726727
case GenXIntrinsic::genx_get_scoreboard_depcnt:
727728
// It is an assertion since the diagnostic must have been happen before.
728729
IGC_ASSERT_EXIT_MESSAGE(
729730
0, "IA buffer is supported only for OCL/L0, scoreboard "
730731
"builtins should not appear for those runtimes");
732+
return ImplArgsBufferPtr;
731733
case GenXIntrinsic::genx_local_size:
732734
return loadVec3ArgFromIABuffer<GenXIntrinsic::genx_local_size>(
733735
ImplArgsBufferPtr, IRB);

0 commit comments

Comments
 (0)