Skip to content

Commit 03be821

Browse files
fda0igcbot
authored andcommitted
Remove deadcode, null checks, use llvm:cast
Addresses issues found by Coverity.
1 parent 5bb0f8e commit 03be821

File tree

4 files changed

+14
-16
lines changed

4 files changed

+14
-16
lines changed

IGC/Compiler/CISACodeGen/CodeSinking.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ namespace IGC {
157157
Candidate(const Candidate& Other)
158158
: Instructions(Other.Instructions), TgtBB(Other.TgtBB), Worthiness(Other.Worthiness), UndoPos(Other.UndoPos) {}
159159

160+
Candidate& operator=(const Candidate&) = delete;
161+
160162
InstrVec Instructions;
161163

162164
BasicBlock *TgtBB;

IGC/Compiler/CISACodeGen/IGCVectorizer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class IGCVectorizer : public llvm::FunctionPass {
7676
public:
7777
llvm::StringRef getPassName() const override { return "IGCVectorizer"; }
7878
virtual ~IGCVectorizer() { ScalarToVector.clear(); }
79+
IGCVectorizer(const IGCVectorizer&) = delete;
80+
IGCVectorizer& operator=(const IGCVectorizer&) = delete;
7981
virtual bool runOnFunction(llvm::Function &F) override;
8082
virtual void getAnalysisUsage(llvm::AnalysisUsage &AU) const override {
8183
AU.addRequired<CodeGenContextWrapper>();

IGC/Compiler/CISACodeGen/LoopCountAnalysis.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -499,21 +499,15 @@ void LoopCountAnalysis::processLoop(Loop* L) {
499499
}
500500

501501
if (IGC_IS_FLAG_ENABLED(EnableKernelCostDebug)) {
502-
if (I0) {
503-
dbgs() << " init value: ";
504-
I0->print(output);
505-
dbgs() << "\n";
506-
}
507-
if (In) {
508-
dbgs() << " end value: ";
509-
In->print(output);
510-
dbgs() << "\n";
511-
}
512-
if (step) {
513-
dbgs() << " step value: ";
514-
step->print(output);
515-
dbgs() << "\n";
516-
}
502+
dbgs() << " init value: ";
503+
I0->print(output);
504+
dbgs() << "\n";
505+
dbgs() << " end value: ";
506+
In->print(output);
507+
dbgs() << "\n";
508+
dbgs() << " step value: ";
509+
step->print(output);
510+
dbgs() << "\n";
517511
}
518512

519513
ConstantInt* addValue = nullptr;

IGC/Compiler/Optimizer/OpenCLPasses/SubGroupReductionPattern/SubGroupReductionPattern.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ void SubGroupReductionPattern::matchVectorShufflePattern(GenIntrinsicInst &Shuff
394394

395395
for (auto *User : InputValue->users())
396396
{
397-
Instruction *Op = dyn_cast<Instruction>(User);
397+
Instruction *Op = cast<Instruction>(User);
398398

399399
if (match(Op, m_c_BinOp(m_Specific(InputValue), Pattern1)) || match(Op, m_c_BinOp(m_Specific(InputValue), Pattern2)))
400400
{

0 commit comments

Comments
 (0)