Skip to content

Commit 82ad58d

Browse files
amielczaigcbot
authored andcommitted
Coverity fixes
IGC Coverity fixes
1 parent 0beab85 commit 82ad58d

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

IGC/BiFModule/Languages/OpenCL/PreRelease/Matrix/IBiF_matrix_generator.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static string ToStringAbove1(int number) {
6262
}
6363

6464
// Replaces all occurrences of `toReplace` with `newText` in `source`
65-
static string Replace(string source, string toReplace, string newText) {
65+
static string Replace(string source, string toReplace, const string& newText) {
6666
size_t pos = 0;
6767
while((pos = source.find(toReplace, pos)) != std::string::npos) {
6868
source.replace(pos, toReplace.length(), newText);
@@ -914,8 +914,7 @@ static string ImplementLargeLoadBase(MatrixSpec spec, AddrSpace addr, int numLoa
914914
s = Replace(s, "WiRowsPerLoad", to_string(wiRowsPerLoad));
915915
s = Replace(s, "NumLoads", to_string(numLoads));
916916
s = Replace(s, "Rows", to_string(spec.Rows));
917-
if (isChecked) s = Replace(s, "LoadArgs", "");
918-
else s = Replace(s, "LoadArgs", "");
917+
s = Replace(s, "LoadArgs", "");
919918
return s;
920919
}
921920

IGC/Compiler/Optimizer/OpenCLPasses/ManageableBarriers/ManageableBarriersResolution.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace IGC
7171
llvm::Value* ConsumerCount;
7272
};
7373

74-
llvm::Module* mModule;
74+
llvm::Module* mModule = nullptr;
7575
MBMode mCurrentMode;
7676

7777
llvm::DenseMap<llvm::CallInst*, MBFuncType> mManageBarrierInstructions;

IGC/Compiler/Optimizer/WaveShuffleIndexSinking.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ namespace IGC
339339
{
340340
Instruction* lastAnchor = lastAnchorIdx == -1 ? cast<Instruction>(ShuffleOps[ i ]) : InstChains[ i ][ lastAnchorIdx ];
341341
// operand to be replaced
342-
Instruction* rewirePrev = ( rewireIdx == 0 ) ? cast<Instruction>(ShuffleOps[ i ]) : InstChains[ i ][ rewireIdx - 1 ];
342+
Instruction* rewirePrev = InstChains[ i ][ rewireIdx - 1 ];
343343
unsigned rewireOpIdx = InstChains[ i ][ rewireIdx ]->getOperand( 0 ) == rewirePrev ? 0 : 1;
344344
InstChains[ i ][ rewireIdx ]->setOperand( rewireOpIdx, lastAnchor );
345345
lastAnchorIdx = rewireIdx;

0 commit comments

Comments
 (0)