Skip to content

Commit e7ec973

Browse files
amielczaigcbot
authored andcommitted
Coverity fixes
Coverity fixes
1 parent 5436b5b commit e7ec973

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3311,7 +3311,7 @@ void EmitPass::EmitSelectStruct(SelectInst* SI)
33113311
std::make_tuple(srcFalseV, srcFalseS, true)
33123312
};
33133313

3314-
for (auto [srcV, srcS, inv] : iterator)
3314+
for (auto& [srcV, srcS, inv] : iterator)
33153315
{
33163316
// For now, do not support uniform dst and non-uniform src
33173317
IGC_ASSERT_MESSAGE(!srcS->IsUniform() || srcS->IsUniform() == destS->IsUniform(),

IGC/Compiler/CISACodeGen/VectorShuffleAnalysis.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class DestVector {
4040
DestVector(llvm::Value *SourceVec, llvm::InsertElementInst *DestVec, std::vector<int> ShuffleMask,
4141
std::vector<llvm::InsertElementInst *> IEs, std::vector<llvm::ExtractElementInst *> EEs,
4242
std::vector<llvm::Value *> SourceScalars)
43-
: SourceVec(SourceVec), DestVec(DestVec), ShuffleMask(ShuffleMask), IEs(IEs), EEs(EEs),
44-
SourceScalars(SourceScalars){};
43+
: SourceVec(SourceVec), DestVec(DestVec), ShuffleMask(std::move(ShuffleMask)), IEs(std::move(IEs)), EEs(std::move(EEs)),
44+
SourceScalars(std::move(SourceScalars)){};
4545

4646
llvm::Value *SourceVec;
4747
llvm::InsertElementInst *DestVec; // first IE that creates a new vec (writes to Undef)
@@ -92,7 +92,7 @@ class DestVector {
9292
class VectorToScalarsPattern {
9393
public:
9494
VectorToScalarsPattern(llvm::Value *SourceVec, std::vector<llvm::ExtractElementInst *> EEs, bool AllUsesAreScalars)
95-
: SourceVec(SourceVec), EEs(EEs), AllUsesAreScalars(AllUsesAreScalars){};
95+
: SourceVec(SourceVec), EEs(std::move(EEs)), AllUsesAreScalars(AllUsesAreScalars){};
9696

9797
bool areAllUsesScalars() const { return AllUsesAreScalars; }
9898

IGC/Compiler/Optimizer/OCLBIUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ namespace IGC
278278
llvm::Value* CoordY;
279279
llvm::Value* CoordZ;
280280
bool m_IncorrectBti;
281-
ModuleMetaData* m_modMD;
281+
ModuleMetaData* m_modMD = nullptr;
282282
};
283283

284284
class CBuiltinsResolver

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -540,12 +540,12 @@ bool ManageableBarriersResolution::runOnModule(Module& M)
540540
}
541541

542542
// In first place, take care of the init functions
543-
for (auto pair : mManageBarrierInstructionsInit)
543+
for (auto& pair : mManageBarrierInstructionsInit)
544544
{
545545
emitInit(pair.first);
546546
}
547547
// Now, we can take the rest of the API calls
548-
for (auto pair : mManageBarrierInstructions)
548+
for (auto& pair : mManageBarrierInstructions)
549549
{
550550
emit(pair.first, pair.second);
551551
}
@@ -639,7 +639,7 @@ bool ManageableBarriersResolution::hasSimpleCallsOnly(CallInst* pFunc)
639639

640640
void ManageableBarriersResolution::lookForSimpleBarriers()
641641
{
642-
for (auto init : mManageBarrierInstructionsInit)
642+
for (auto& init : mManageBarrierInstructionsInit)
643643
{
644644
CallInst* pFunc = init.first;
645645
if (mCurrentMode == MBMode::SimpleOnly ||
@@ -693,12 +693,12 @@ ManageableBarriersResolution::SimpleBarrierStruct& ManageableBarriersResolution:
693693

694694
void ManageableBarriersResolution::clearData()
695695
{
696-
for (auto call : mManageBarrierInstructions)
696+
for (auto& call : mManageBarrierInstructions)
697697
{
698698
call.first->eraseFromParent();
699699
}
700700

701-
for (auto init : mManageBarrierInstructionsInit)
701+
for (auto& init : mManageBarrierInstructionsInit)
702702
{
703703
init.first->eraseFromParent();
704704
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ namespace IGC
7777
llvm::DenseMap<llvm::CallInst*, MBFuncType> mManageBarrierInstructions;
7878
llvm::DenseMap<llvm::CallInst*, MBFuncType> mManageBarrierInstructionsInit;
7979
llvm::DenseMap<llvm::CallInst*, SimpleBarrierStruct> mManageBarrierInstructionsInitSimple;
80-
int mSimpleBarrierIDCount;
80+
int mSimpleBarrierIDCount = 0;
8181

8282
llvm::DenseMap<llvm::Function*, llvm::Value*> mGlobalDataPoolPerFunc;
8383
llvm::DenseMap<llvm::Function*, llvm::Value*> mGlobalIDPoolPPerFunc;

IGC/Compiler/Optimizer/OpenCLPasses/SplitStructurePhisPass/SplitStructurePhisPass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ bool SplitStructurePhisPass::runOnFunction(Function &F) {
8383
// 2. create new phis for each scalar types
8484
// 3. save dead instructions for removal
8585
// 4. update incoming phis incoming values
86-
for (auto PhiPair : PhiNodes) {
86+
for (auto& PhiPair : PhiNodes) {
8787
PHINode *OldPhi = PhiPair.first;
8888
auto Indices = std::get<0>(PhiPair.second);
8989
ExtractValueMap ExtractValues = std::get<1>(PhiPair.second);

IGC/Compiler/Optimizer/PromoteToPredicatedMemoryAccess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ bool PromoteToPredicatedMemoryAccess::trySingleBlockIfConv(Value &Cond, BasicBlo
188188
<< " ConvBB: " << ConvBB << "\n"
189189
<< " SuccBB: " << SuccBB << "\n");
190190

191-
for (auto [Inst, MergeV] : Insts) {
191+
for (auto& [Inst, MergeV] : Insts) {
192192
LLVM_DEBUG(dbgs() << "Converting instruction: " << *Inst << "\n");
193193
convertMemoryAccesses(Inst, MergeV, &Cond, Inverse);
194194
}

0 commit comments

Comments
 (0)