From d0dd7bef95a7d7f4251046d92c43af4568c7c8f7 Mon Sep 17 00:00:00 2001 From: "Milczek, Szymon" Date: Wed, 27 Sep 2023 13:24:38 +0000 Subject: [PATCH] Minor fixes and refactors. Replace dyn_cast + assert with cast, initialise some vars. --- IGC/Compiler/CISACodeGen/PatternMatchPass.cpp | 10 +++++----- IGC/Compiler/CustomSafeOptPass.cpp | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp index da05f3e621ca..08973401ccd6 100644 --- a/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp +++ b/IGC/Compiler/CISACodeGen/PatternMatchPass.cpp @@ -1805,7 +1805,7 @@ namespace IGC } }; bool match = false; - e_modifier mod; + e_modifier mod{}; Value* source = nullptr; if (GetModifier(I, mod, source)) { @@ -4504,8 +4504,8 @@ namespace IGC return false; } - llvm::Value* selSources[2]; - e_modifier selMod[2]; + llvm::Value* selSources[2] = {}; + e_modifier selMod[2] = {}; selSources[0] = I.getOperand(1); selSources[1] = I.getOperand(2); @@ -4940,8 +4940,8 @@ namespace IGC }; bool found = false; - llvm::Value* sources[2]; - e_modifier src_mod[2]; + llvm::Value* sources[2] = {}; + e_modifier src_mod[2] = {}; IGC_ASSERT(I.getOpcode() == Instruction::SDiv || I.getOpcode() == Instruction::UDiv || I.getOpcode() == Instruction::AShr); diff --git a/IGC/Compiler/CustomSafeOptPass.cpp b/IGC/Compiler/CustomSafeOptPass.cpp index 397f8ba9c69a..965a87f8e562 100644 --- a/IGC/Compiler/CustomSafeOptPass.cpp +++ b/IGC/Compiler/CustomSafeOptPass.cpp @@ -5625,8 +5625,7 @@ void SplitIndirectEEtoSel::visitExtractElementInst(llvm::ExtractElementInst& I) { using namespace llvm::PatternMatch; - IGCLLVM::FixedVectorType* vecTy = dyn_cast(I.getVectorOperandType()); - IGC_ASSERT( vecTy != nullptr ); + IGCLLVM::FixedVectorType* vecTy = cast(I.getVectorOperandType()); uint64_t num = vecTy->getNumElements(); Type* eleType = vecTy->getElementType();