From dfc06b270dfcee2ef6d3ec6810f0ea6280dd3c4d Mon Sep 17 00:00:00 2001 From: "Gorban, Igor" Date: Wed, 22 Nov 2023 10:50:13 +0000 Subject: [PATCH] Fixed warning from static code analyser . --- GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp | 6 ++++-- GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp | 4 ++-- .../lib/GenXIntrinsics/GenXSingleElementVectorUtil.cpp | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp b/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp index f53ddb1f..bd386383 100644 --- a/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp +++ b/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp @@ -1,6 +1,6 @@ /*========================== begin_copyright_notice ============================ -Copyright (C) 2019-2021 Intel Corporation +Copyright (C) 2019-2023 Intel Corporation SPDX-License-Identifier: MIT @@ -426,6 +426,8 @@ void GenXIntrinsic::getIntrinsicInfoTableEntries( /// parse ffXX as f(fXX) or f(fX)X. (X is a placeholder for any other type.) static std::string getMangledTypeStr(Type *Ty) { std::string Result; + if (!Ty) + return Result; if (PointerType *PTyp = dyn_cast(Ty)) { Result += "p" + llvm::utostr(PTyp->getAddressSpace()); #if VC_INTR_LLVM_VERSION_MAJOR >= 13 @@ -463,7 +465,7 @@ static std::string getMangledTypeStr(Type *Ty) { for (auto I : TargetTy->int_params()) Result += "_" + llvm::utostr(I); #endif // VC_INTR_LLVM_VERSION_MAJOR >= 16 - } else if (Ty) { + } else { Result += EVT::getEVT(Ty).getEVTString(); } diff --git a/GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp b/GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp index 25a10f6f..4aa5d5d4 100644 --- a/GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp +++ b/GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp @@ -1,6 +1,6 @@ /*========================== begin_copyright_notice ============================ -Copyright (C) 2015-2022 Intel Corporation +Copyright (C) 2015-2023 Intel Corporation SPDX-License-Identifier: MIT @@ -1840,7 +1840,7 @@ void CMSimdCFLower::lowerUnmaskOps() { for (auto bi = BB->begin(), be = BB->end(); bi != be; ++bi) { Instruction *Inst = &*bi; // doing the work - if (auto CIE = dyn_cast_or_null(Inst)) { + if (auto *CIE = dyn_cast(Inst)) { if (GenXIntrinsic::getGenXIntrinsicID(CIE) == GenXIntrinsic::genx_unmask_end) { auto LoadV = dyn_cast(CIE->getArgOperand(0)); diff --git a/GenXIntrinsics/lib/GenXIntrinsics/GenXSingleElementVectorUtil.cpp b/GenXIntrinsics/lib/GenXIntrinsics/GenXSingleElementVectorUtil.cpp index 6e1e6980..da49f744 100644 --- a/GenXIntrinsics/lib/GenXIntrinsics/GenXSingleElementVectorUtil.cpp +++ b/GenXIntrinsics/lib/GenXIntrinsics/GenXSingleElementVectorUtil.cpp @@ -204,7 +204,8 @@ static Type *getTypeWithSingleElementVector(Type *T, size_t InnerPointers = 0) { return T; } else if (auto *StructTy = dyn_cast(T)) { auto It = SEVRichStructMap.find(StructTy); - assert(It != SEVRichStructMap.end()); + if (It == SEVRichStructMap.end()) + llvm_unreachable("Unexpected SEV StructType"); return It->second; } auto NPtrs = getPointerNesting(T);