Skip to content

Commit

Permalink
Fixed warning from static code analyser
Browse files Browse the repository at this point in the history
.
  • Loading branch information
igorban-intel authored and sys-cmllvm committed Nov 27, 2023
1 parent a840335 commit dfc06b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2019-2021 Intel Corporation
Copyright (C) 2019-2023 Intel Corporation
SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -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<PointerType>(Ty)) {
Result += "p" + llvm::utostr(PTyp->getAddressSpace());
#if VC_INTR_LLVM_VERSION_MAJOR >= 13
Expand Down Expand Up @@ -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();
}

Expand Down
4 changes: 2 additions & 2 deletions GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*========================== begin_copyright_notice ============================
Copyright (C) 2015-2022 Intel Corporation
Copyright (C) 2015-2023 Intel Corporation
SPDX-License-Identifier: MIT
Expand Down Expand Up @@ -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<CallInst>(Inst)) {
if (auto *CIE = dyn_cast<CallInst>(Inst)) {
if (GenXIntrinsic::getGenXIntrinsicID(CIE) ==
GenXIntrinsic::genx_unmask_end) {
auto LoadV = dyn_cast<LoadInst>(CIE->getArgOperand(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ static Type *getTypeWithSingleElementVector(Type *T, size_t InnerPointers = 0) {
return T;
} else if (auto *StructTy = dyn_cast<StructType>(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);
Expand Down

0 comments on commit dfc06b2

Please sign in to comment.