Skip to content

Commit 0f22f1c

Browse files
MiloszSkobejkoigcbot
authored andcommitted
Multiple Coverity Fixes
Multiple fixes of various coverity issues, mostly connected with uninitialized variables in classes, copying and reference and rule of three.
1 parent 06a755f commit 0f22f1c

File tree

10 files changed

+19
-9
lines changed

10 files changed

+19
-9
lines changed

IGC/Compiler/HandleLoadStoreInstructions.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace IGC
5050
void HandleLoadStore();
5151

5252
/// @brief Indicates if the pass changed the processed function
53-
bool m_changed;
53+
bool m_changed = false;
5454
};
5555

5656
} // namespace IGC

IGC/Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace IGC
5858
llvm::Value* emitIEEEDivide(llvm::BinaryOperator* I, llvm::Value* Op0, llvm::Value* Op1);
5959

6060
/// @brief Indicates if the pass changed the processed function
61-
bool m_changed;
61+
bool m_changed = false;
6262

6363
/// @brief Indicates that correctly rounded sqrt/div should be used even
6464
/// when the option is not present in the module metadata.

IGC/Compiler/Optimizer/OpenCLPasses/ExtensionFuncs/ExtensionFuncResolution.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ namespace IGC
6161
ImplicitArgs m_implicitArgs;
6262

6363
/// @brief Indicates if the pass changed the processed function
64-
bool m_changed;
64+
bool m_changed = false;
6565
};
6666

6767
} // namespace IGC

IGC/Compiler/Optimizer/OpenCLPasses/ImageFuncs/ResolveSampledImageBuiltins.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace IGC
4444
llvm::Value* lowerGetImage(llvm::CallInst& CI);
4545
llvm::Value* lowerGetSampler(llvm::CallInst& CI);
4646

47-
bool m_changed;
47+
bool m_changed = false;
4848
std::unordered_set<llvm::CallInst*> m_builtinsToRemove;
4949
};
5050

IGC/Compiler/Optimizer/OpenCLPasses/JointMatrixFuncsResolutionPass/JointMatrixFuncsResolutionPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ Value *JointMatrixFuncsResolutionPass::ResolveWILength(CallInst *CI) {
13451345
Type *matTy = ResolveType(CI->getArgOperand(0)->getType(), &desc);
13461346

13471347
const int sliceSize = getSliceSize(&desc, matTy);
1348-
Value *lenght = ConstantInt::get(CI->getType(), sliceSize, "matrix.slice.size");
1348+
Value *lenght = ConstantInt::get(CI->getType(), sliceSize);
13491349

13501350
CI->replaceAllUsesWith(lenght);
13511351
InstsToErase.insert(CI);

visa/G4_Verifier.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ class G4Verifier {
4747

4848
public:
4949
G4Verifier(G4_Kernel &k, VerifyControl ctrl, Optimizer::PassIndex index);
50+
G4Verifier(const G4Verifier&) = delete;
51+
G4Verifier& operator=(const G4Verifier&) = delete;
52+
5053

5154
~G4Verifier() {
5255
if (dumpText.is_open())

visa/GraphColor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ class Augmentation {
561561
public:
562562
Augmentation(Interference &i, const LivenessAnalysis &l, GlobalRA &g);
563563
~Augmentation();
564+
Augmentation(const Augmentation&) = delete;
565+
Augmentation& operator=(const Augmentation&) = delete;
564566

565567
void augmentIntfGraph();
566568

@@ -896,6 +898,8 @@ class Interference {
896898

897899
public:
898900
Interference(const LivenessAnalysis *l, GlobalRA &g);
901+
Interference(const Interference&) = delete;
902+
Interference& operator=(const Interference&) = delete;
899903

900904
~Interference() {
901905
if (useDenseMatrix()) {

visa/Timer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ struct TimerScope {
5151
TimerScope(const TimerID _timerId) : timerId(_timerId) {
5252
startTimer(timerId);
5353
}
54+
55+
TimerScope(const TimerScope&) = delete;
56+
TimerScope& operator=(const TimerScope&) = delete;
5457
~TimerScope() { stopTimer(timerId); }
5558
};
5659

visa/VISAKernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ class VISAKernelImpl : public VISAFunction {
11251125
void setJitInfo(vISA::FINALIZER_INFO *jitInfo) { m_jitInfo = jitInfo; }
11261126

11271127
std::string getOutputAsmPath() const { return m_asmName; }
1128-
void setOutputAsmPath(std::string val) { m_asmName = val; }
1128+
void setOutputAsmPath(const std::string& val) { m_asmName = val; }
11291129

11301130
int compileFastPath();
11311131

visa/include/RelocationInfo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct ZESymEntry {
8787

8888
ZESymEntry() = default;
8989
ZESymEntry(GenSymType type, uint32_t offset, uint32_t size, std::string name)
90-
: s_type(type), s_offset(offset), s_size(size), s_name(name) {}
90+
: s_type(type), s_offset(offset), s_size(size), s_name(std::move(name)) {}
9191
};
9292

9393
/// ZERelocEntry - A relocation entry that will later be transformed to ZE
@@ -101,7 +101,7 @@ struct ZERelocEntry {
101101

102102
ZERelocEntry() = default;
103103
ZERelocEntry(GenRelocType type, uint32_t offset, std::string targetSymName)
104-
: r_type(type), r_offset(offset), r_symbol(targetSymName) {}
104+
: r_type(type), r_offset(offset), r_symbol(std::move(targetSymName)) {}
105105
};
106106

107107
/// ZEFuncAttribEntry - A function attribute entry that will later be
@@ -123,7 +123,7 @@ struct ZEFuncAttribEntry {
123123
: f_isKernel(isKernel), f_isExternal(isExternal),
124124
f_BarrierCount(barrierCount),
125125
f_privateMemPerThread(privateMemPerThread),
126-
f_spillMemPerThread(spillMemPerThread), f_name(funcName), f_hasRTCalls(hasRTCalls) {}
126+
f_spillMemPerThread(spillMemPerThread), f_name(std::move(funcName)), f_hasRTCalls(hasRTCalls) {}
127127
};
128128

129129
/// ZEHostAccessEntry - A host access entry that will later be transformed to ZE

0 commit comments

Comments
 (0)