New Defects reported by Coverity Scan for llvm

Hi,

Please find the latest report on new defect(s) introduced to llvm found with Coverity Scan.

100 new defect(s) introduced to llvm found with Coverity Scan.
4257 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.

New defect(s) Reported-by: Coverity Scan
Showing 20 of 100 defect(s)

** CID 1517692: Performance inefficiencies (PASS_BY_VALUE)
/clang/lib/Format/Format.cpp: 3489 in clang::format::internal::reformat(const clang::format::FormatStyle &, llvm::StringRef, llvm::ArrayRefclang::tooling::Range, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus *)::[lambda(const clang::format::Environment &) (instance 2)]::operator ()(const clang::format::Environment &) const()


*** CID 1517692: Performance inefficiencies (PASS_BY_VALUE)
/clang/lib/Format/Format.cpp: 3489 in clang::format::internal::reformat(const clang::format::FormatStyle &, llvm::StringRef, llvm::ArrayRefclang::tooling::Range, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus *)::[lambda(const clang::format::Environment &) (instance 2)]::operator ()(const clang::format::Environment &) const()
3483 if (Style.QualifierAlignment != FormatStyle::QAS_Leave)
3484 addQualifierAlignmentFixerPasses(Expanded, Passes);
3485
3486 if (Style.InsertBraces) {
3487 FormatStyle S = Expanded;
3488 S.InsertBraces = true;

CID 1517692:  Performance inefficiencies  (PASS_BY_VALUE)
Capturing variable "S" of type "std::remove_reference<clang::format::FormatStyle &>::type" (size 808 bytes) by value, which exceeds the high threshold of 512 bytes.

3489 Passes.emplace_back([&, S = std::move(S)](const Environment &Env) {
3490 return BracesInserter(Env, S).process(/SkipAnnotation=/true);
3491 });
3492 }
3493
3494 if (Style.RemoveBracesLLVM) {

** CID 1517691: Performance inefficiencies (PASS_BY_VALUE)
/clang-tools-extra/clangd/ClangdLSPServer.cpp: 810 in clang::clangd::ClangdLSPServer::applyEdit(clang::clangd::WorkspaceEdit, llvm::json::Value, llvm::unique_function<void (llvm::Expectedllvm::json::Value)>)()


*** CID 1517691: Performance inefficiencies (PASS_BY_VALUE)
/clang-tools-extra/clangd/ClangdLSPServer.cpp: 810 in clang::clangd::ClangdLSPServer::applyEdit(clang::clangd::WorkspaceEdit, llvm::json::Value, llvm::unique_function<void (llvm::Expectedllvm::json::Value)>)()
804 return applyEdit(std::move(WE), “Tweak applied.”, std::move(Reply));
805 };
806 Server->applyTweak(Args.file.file(), Args.selection, Args.tweakID,
807 std::move(Action));
808 }
809

CID 1517691:  Performance inefficiencies  (PASS_BY_VALUE)
Passing parameter WE of type "clang::clangd::WorkspaceEdit" (size 136 bytes) by value, which exceeds the low threshold of 128 bytes.

810 void ClangdLSPServer::applyEdit(WorkspaceEdit WE, llvm::json::Value Success,
811 Callbackllvm::json::Value Reply) {
812 ApplyWorkspaceEditParams Edit;
813 Edit.edit = std::move(WE);
814 ApplyWorkspaceEdit(
815 Edit, [Reply = std::move(Reply), SuccessMessage = std::move(Success)](

** CID 1517690: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc: 11032 in mlir::LLVM::LlrintOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc: 11041 in mlir::LLVM::LlrintOp::verifyInvariantsImpl()()


*** CID 1517690: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc: 11032 in mlir::LLVM::LlrintOp::verifyInvariantsImpl()()
11026
11027 ::mlir::LogicalResult LlrintOp::verifyInvariantsImpl() {
11028 {
11029 unsigned index = 0; (void)index;
11030 auto valueGroup0 = getODSOperands(0);
11031

CID 1517690:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type Value.

11032 for (auto v : valueGroup0) {
11033 if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps9(*this, v.getType(), “operand”, index++)))
11034 return ::mlir::failure();
11035 }
11036 }
11037 {
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.cpp.inc: 11041 in mlir::LLVM::LlrintOp::verifyInvariantsImpl()()
11035 }
11036 }
11037 {
11038 unsigned index = 0; (void)index;
11039 auto valueGroup0 = getODSResults(0);
11040

CID 1517690:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type OpResult.

11041 for (auto v : valueGroup0) {
11042 if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMIntrinsicOps1(*this, v.getType(), “result”, index++)))
11043 return ::mlir::failure();
11044 }
11045 }
11046 return ::mlir::success();

** CID 1517689: Uninitialized variables (UNINIT)
/clang/lib/Frontend/TextDiagnostic.cpp: 1113 in prepareAndFilterRanges(const llvm::SmallVectorImplclang::CharSourceRange &, const clang::SourceManager &, const std::pair<unsigned int, unsigned int> &, clang::FileID, const clang::LangOptions &)()


*** CID 1517689: Uninitialized variables (UNINIT)
/clang/lib/Frontend/TextDiagnostic.cpp: 1113 in prepareAndFilterRanges(const llvm::SmallVectorImplclang::CharSourceRange &, const clang::SourceManager &, const std::pair<unsigned int, unsigned int> &, clang::FileID, const clang::LangOptions &)()
1107 LineRanges.push_back({S, 0, ~0u});
1108
1109 // End line.
1110 LineRanges.push_back({EndLineNo, 0, EndColumn - 1});
1111 }
1112

CID 1517689:  Uninitialized variables  (UNINIT)
Using uninitialized value "LineRanges". Field "LineRanges.InlineElts" is uninitialized.

1113 return LineRanges;
1114 }
1115
1116 /// Emit a code snippet and caret line.
1117 ///
1118 /// This routine emits a single line’s code snippet and caret line…

** CID 1517688: (AUTO_CAUSES_COPY)
/mlir/lib/IR/Dominance.cpp: 38 in mlir::detail::DominanceInfoBase<(bool)0>::invalidate()()
/mlir/lib/IR/Dominance.cpp: 38 in mlir::detail::DominanceInfoBase<(bool)1>::invalidate()()


*** CID 1517688: (AUTO_CAUSES_COPY)
/mlir/lib/IR/Dominance.cpp: 38 in mlir::detail::DominanceInfoBase<(bool)0>::invalidate()()
32 DominanceInfoBase::~DominanceInfoBase() {
33 for (auto entry : dominanceInfos)
34 delete entry.second.getPointer();
35 }
36
37 template void DominanceInfoBase::invalidate() {

CID 1517688:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type DenseMapPair.

38 for (auto entry : dominanceInfos)
39 delete entry.second.getPointer();
40 dominanceInfos.clear();
41 }
42
43 template
/mlir/lib/IR/Dominance.cpp: 38 in mlir::detail::DominanceInfoBase<(bool)1>::invalidate()()
32 DominanceInfoBase::~DominanceInfoBase() {
33 for (auto entry : dominanceInfos)
34 delete entry.second.getPointer();
35 }
36
37 template void DominanceInfoBase::invalidate() {

CID 1517688:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type DenseMapPair.

38 for (auto entry : dominanceInfos)
39 delete entry.second.getPointer();
40 dominanceInfos.clear();
41 }
42
43 template

** CID 1517687: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc: 1676 in mlir::LLVM::DILabelAttr::print(mlir::AsmPrinter &) const()


*** CID 1517687: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.cpp.inc: 1676 in mlir::LLVM::DILabelAttr::print(mlir::AsmPrinter &) const()
1670
1671 void DILabelAttr::print(::mlir::AsmPrinter &odsPrinter) const {
1672 ::mlir::Builder odsBuilder(getContext());
1673 odsPrinter << “<”;
1674 {
1675 bool _firstPrinted = true;

CID 1517687:  Control flow issues  (DEADCODE)
Execution cannot reach this statement: "odsPrinter << ", ";".

1676 if (!_firstPrinted) odsPrinter << ", ";
1677 _firstPrinted = false;
1678 odsPrinter << "scope = ";
1679 odsPrinter.printStrippedAttrOrType(getScope());
1680 if (!(getName() == StringAttr())) {
1681 if (!_firstPrinted) odsPrinter << ", ";

** CID 1517686: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Semantics/tools.cpp: 764 in Fortran::semantics::IsFinalizable(const Fortran::semantics::DerivedTypeSpec &, std::set<const Fortran::semantics::DerivedTypeSpec *, std::less<const Fortran::semantics::DerivedTypeSpec *>, std::allocator<const Fortran::semantics::DerivedTypeSpec *>> *, bool, std::optional)()


*** CID 1517686: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Semantics/tools.cpp: 764 in Fortran::semantics::IsFinalizable(const Fortran::semantics::DerivedTypeSpec &, std::set<const Fortran::semantics::DerivedTypeSpec *, std::less<const Fortran::semantics::DerivedTypeSpec *>, std::allocator<const Fortran::semantics::DerivedTypeSpec *>> *, bool, std::optional)()
758 }
759
760 const Symbol *IsFinalizable(const DerivedTypeSpec &derived,
761 std::set<const DerivedTypeSpec *> *inProgress, bool withImpureFinalizer,
762 std::optional rank) {
763 const Symbol *elemental{nullptr};

CID 1517686:  Performance inefficiencies  (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type Reference.

764 for (auto ref : FinalsForDerivedTypeInstantiation(derived)) {
765 const Symbol *symbol{&ref->GetUltimate()};
766 if (const auto *binding{symbol->detailsIf()}) {
767 symbol = &binding->symbol();
768 }
769 if (const auto *proc{symbol->detailsIf()}) {

** CID 1517685: (AUTO_CAUSES_COPY)
/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp: 211 in ::Generator::emitParseHelper(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<llvm::Init *>, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits, std::allocator>>, llvm::StringRef, mlir::raw_indented_ostream &)()
/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp: 239 in ::Generator::emitParseHelper(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<llvm::Init *>, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits, std::allocator>>, llvm::StringRef, mlir::raw_indented_ostream &)()


*** CID 1517685: (AUTO_CAUSES_COPY)
/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp: 211 in ::Generator::emitParseHelper(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<llvm::Init *>, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits, std::allocator>>, llvm::StringRef, mlir::raw_indented_ostream &)()
205 ios << formatv(“return get<{0}>(context);\n”, returnType);
206 return;
207 }
208
209 // Print decls.
210 std::string lastCType = “”;

CID 1517685:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type tuple.

211 for (auto [arg, name] : zip(args, argNames)) {
212 DefInit *first = dyn_cast(arg);
213 if (!first)
214 PrintFatalError("Unexpected type for " + name);
215 Record *def = first->getDef();
216
/mlir/tools/mlir-tblgen/BytecodeDialectGen.cpp: 239 in ::Generator::emitParseHelper(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::ArrayRef<llvm::Init *>, llvm::ArrayRef<std::__cxx11::basic_string<char, std::char_traits, std::allocator>>, llvm::StringRef, mlir::raw_indented_ostream &)()
233 // lambda passed to array parsing.
234 auto listHelperName = (StringRef name) {
235 return formatv(“read{0}”, capitalize(name));
236 };
237
238 // Emit list helper functions.

CID 1517685:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type tuple.

239 for (auto [arg, name] : zip(args, argNames)) {
240 Record *attr = cast(arg)->getDef();
241 if (!attr->isSubClassOf(“Array”))
242 continue;
243
244 // TODO: Dedupe readers.

** CID 1517684: (AUTO_CAUSES_COPY)
/llvm/lib/Object/ArchiveWriter.cpp: 590 in writeSymbolMap(llvm::raw_ostream &, llvm::object::Archive::Kind, bool, llvm::ArrayRef<::MemberData>, SymMap &, unsigned long)()
/llvm/lib/Object/ArchiveWriter.cpp: 588 in writeSymbolMap(llvm::raw_ostream &, llvm::object::Archive::Kind, bool, llvm::ArrayRef<::MemberData>, SymMap &, unsigned long)()


*** CID 1517684: (AUTO_CAUSES_COPY)
/llvm/lib/Object/ArchiveWriter.cpp: 590 in writeSymbolMap(llvm::raw_ostream &, llvm::object::Archive::Kind, bool, llvm::ArrayRef<::MemberData>, SymMap &, unsigned long)()
584 }
585
586 printLE<uint32_t>(Out, SymMap.Map.size());
587
588 for (auto S : SymMap.Map)
589 printLE(Out, S.second);

CID 1517684:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type pair.

590 for (auto S : SymMap.Map)
591 Out << S.first << ‘\0’;
592
593 while (Pad–)
594 Out.write(uint8_t(0));
595 }
/llvm/lib/Object/ArchiveWriter.cpp: 588 in writeSymbolMap(llvm::raw_ostream &, llvm::object::Archive::Kind, bool, llvm::ArrayRef<::MemberData>, SymMap &, unsigned long)()
582 printLE(Out, Pos); // member offset
583 Pos += M.Header.size() + M.Data.size() + M.Padding.size();
584 }
585
586 printLE<uint32_t>(Out, SymMap.Map.size());
587

CID 1517684:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type pair.

588 for (auto S : SymMap.Map)
589 printLE(Out, S.second);
590 for (auto S : SymMap.Map)
591 Out << S.first << ‘\0’;
592
593 while (Pad–)

** CID 1517683: Uninitialized variables (UNINIT)
/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp: 295 in MmaSyncBuilder::buildMemrefLoads(mlir::OpBuilder &, mlir::Location, mlir::OpFoldResult, mlir::Value, std::function<llvm::SmallVector<RowColIndexing, (unsigned int)3> (mlir::MLIRContext *)>)()


*** CID 1517683: Uninitialized variables (UNINIT)
/mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp: 295 in MmaSyncBuilder::buildMemrefLoads(mlir::OpBuilder &, mlir::Location, mlir::OpFoldResult, mlir::Value, std::function<llvm::SmallVector<RowColIndexing, (unsigned int)3> (mlir::MLIRContext *)>)()
289 for (auto indexing : indexings) {
290 Value row = getValueOrCreateConstantIndexOp(b, loc, aff(indexing.row()));
291 Value col = getValueOrCreateConstantIndexOp(b, loc, aff(indexing.col()));
292 auto load = b.creatememref::LoadOp(loc, memref, ValueRange{row, col});
293 res.push_back(load);
294 }

CID 1517683:  Uninitialized variables  (UNINIT)
Using uninitialized value "res". Field "res.InlineElts" is uninitialized.

295 return res;
296 }
297
298 Value MmaSyncBuilder::buildMmaSyncMemrefLoadOperand(
299 OpBuilder &b, Location loc, OpFoldResult laneId, Value memref,
300 IndexCalculator indexFn, ArrayRef<int64_t> vectorShape) {

** CID 1517682: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp: 298 in modifyFuncOpToUseBarePtrCallingConv(mlir::ConversionPatternRewriter &, mlir::Location, mlir::LLVMTypeConverter &, mlir::LLVM::LLVMFuncOp, mlir::TypeRange)()


*** CID 1517682: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp: 298 in modifyFuncOpToUseBarePtrCallingConv(mlir::ConversionPatternRewriter &, mlir::Location, mlir::LLVMTypeConverter &, mlir::LLVM::LLVMFuncOp, mlir::TypeRange)()
292 auto blockArgs = entryBlock->getArguments();
293 assert(blockArgs.size() == oldArgTypes.size() &&
294 “The number of arguments and types doesn’t match”);
295
296 OpBuilder::InsertionGuard guard(rewriter);
297 rewriter.setInsertionPointToStart(entryBlock);

CID 1517682:  Performance inefficiencies  (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type tuple.

298 for (auto it : llvm::zip(blockArgs, oldArgTypes)) {
299 BlockArgument arg = std::get<0>(it);
300 Type argTy = std::get<1>(it);
301
302 // Unranked memrefs are not supported in the bare pointer calling
303 // convention. We should have bailed out before in the presence of

** CID 1517681: Uninitialized members (UNINIT_CTOR)
/llvm/include/llvm/MC/MCRegisterInfo.h: 584 in llvm::MCSuperRegIterator::MCSuperRegIterator()()


*** CID 1517681: Uninitialized members (UNINIT_CTOR)
/llvm/include/llvm/MC/MCRegisterInfo.h: 584 in llvm::MCSuperRegIterator::MCSuperRegIterator()()
578 /// If IncludeSelf is set, Reg itself is included in the list.
579 class MCSuperRegIterator
580 : public iterator_adaptor_base<MCSuperRegIterator,
581 MCRegisterInfo::DiffListIterator,
582 std::forward_iterator_tag, const MCPhysReg> {
583 // Cache the current value, so that we can return a reference to it.

CID 1517681:  Uninitialized members  (UNINIT_CTOR)
The compiler-generated constructor for this class does not initialize "Val".

584 MCPhysReg Val;
585
586 public:
587 /// Constructs an end iterator.
588 MCSuperRegIterator() = default;
589

** CID 1517680: Uninitialized members (UNINIT_CTOR)
/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp: 1076 in ::PGOUseFunc::PGOUseFunc(llvm::Function &, llvm::Module *, llvm::TargetLibraryInfo &, std::unordered_multimap<llvm::Comdat *, llvm::GlobalValue *, std::hash<llvm::Comdat *>, std::equal_to<llvm::Comdat *>, std::allocator<std::pair<llvm::Comdat *const , llvm::GlobalValue *>>> &, llvm::BranchProbabilityInfo *, llvm::BlockFrequencyInfo *, llvm::ProfileSummaryInfo *, bool, bool, bool)()


*** CID 1517680: Uninitialized members (UNINIT_CTOR)
/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp: 1076 in ::PGOUseFunc::PGOUseFunc(llvm::Function &, llvm::Module *, llvm::TargetLibraryInfo &, std::unordered_multimap<llvm::Comdat *, llvm::GlobalValue *, std::hash<llvm::Comdat *>, std::equal_to<llvm::Comdat *>, std::allocator<std::pair<llvm::Comdat *const , llvm::GlobalValue *>>> &, llvm::BranchProbabilityInfo *, llvm::BlockFrequencyInfo *, llvm::ProfileSummaryInfo *, bool, bool, bool)()
1070 BranchProbabilityInfo *BPI, BlockFrequencyInfo *BFIin,
1071 ProfileSummaryInfo *PSI, bool IsCS, bool InstrumentFuncEntry,
1072 bool HasSingleByteCoverage)
1073 : F(Func), M(Modu), BFI(BFIin), PSI(PSI),
1074 FuncInfo(Func, TLI, ComdatMembers, false, BPI, BFIin, IsCS,
1075 InstrumentFuncEntry, HasSingleByteCoverage),

CID 1517680:  Uninitialized members  (UNINIT_CTOR)
Non-static class member "ProgramMaxCount" is not initialized in this constructor nor in any functions that it calls.

1076 FreqAttr(FFA_Normal), IsCS(IsCS) {}
1077
1078 void handleInstrProfError(Error Err, uint64_t MismatchedFuncSum);
1079
1080 // Read counts for the instrumented BB from profile.
1081 bool readCounters(IndexedInstrProfReader *PGOReader, bool &AllZeros,

** CID 1517679: Control flow issues (UNREACHABLE)
/llvm/include/llvm/Transforms/IPO/Attributor.h: 1985 in llvm::Attributor::getAssumedInitializerFromCallBack(const llvm::GlobalVariable &, const llvm::AbstractAttribute *, bool &)()


*** CID 1517679: Control flow issues (UNREACHABLE)
/llvm/include/llvm/Transforms/IPO/Attributor.h: 1985 in llvm::Attributor::getAssumedInitializerFromCallBack(const llvm::GlobalVariable &, const llvm::AbstractAttribute *, bool &)()
1979 /// nullptr if \p GV can’t be simplified.
1980 std::optional<Constant *>
1981 getAssumedInitializerFromCallBack(const GlobalVariable &GV,
1982 const AbstractAttribute *AA,
1983 bool &UsedAssumedInformation) {
1984 assert(GlobalVariableSimplificationCallbacks.contains(&GV));

CID 1517679:  Control flow issues  (UNREACHABLE)
Since the loop increment "++__begin2;" is unreachable, the loop body will never execute more than once.

1985 for (auto &CB : GlobalVariableSimplificationCallbacks.lookup(&GV)) {
1986 auto SimplifiedGV = CB(GV, AA, UsedAssumedInformation);
1987 // For now we assume the call back will not return a std::nullopt.
1988 assert(SimplifiedGV.has_value() && “SimplifiedGV has not value”);
1989 return *SimplifiedGV;
1990 }

** CID 1517678: Performance inefficiencies (AUTO_CAUSES_COPY)
/lld/wasm/Driver.cpp: 888 in lld::wasm::processStubLibrariesPreLTO()()


*** CID 1517678: Performance inefficiencies (AUTO_CAUSES_COPY)
/lld/wasm/Driver.cpp: 888 in lld::wasm::processStubLibrariesPreLTO()()
882 for (auto [name, deps]: stub_file->symbolDependencies) {
883 auto* sym = symtab->find(name);
884 // If the symbol is not present at all (yet), or if it is present but
885 // undefined, then mark the dependent symbols as used by a regular
886 // object so they will be preserved and exported by the LTO process.
887 if (!sym || sym->isUndefined()) {

CID 1517678:  Performance inefficiencies  (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type StringRef.

888 for (const auto dep : deps) {
889 auto* needed = symtab->find(dep);
890 if (needed ) {
891 needed->isUsedInRegularObj = true;
892 }
893 }

** CID 1517677: (AUTO_CAUSES_COPY)
/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp: 2557 in CallsiteContextGraph<IndexCallsiteContextGraph, llvm::FunctionSummary, IndexCall>::assignFunctions()()
/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp: 2557 in CallsiteContextGraph<ModuleCallsiteContextGraph, llvm::Function, llvm::Instruction *>::assignFunctions()()


*** CID 1517677: (AUTO_CAUSES_COPY)
/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp: 2557 in CallsiteContextGraph<IndexCallsiteContextGraph, llvm::FunctionSummary, IndexCall>::assignFunctions()()
2551 // of the other callsites in that function that are reached by those
2552 // callers. Clone the other callees of the current callsite’s caller
2553 // that were already assigned to PreviousAssignedFuncClone
2554 // accordingly. This is important since we subsequently update the
2555 // calls from the nodes in the graph and their assignments to callee
2556 // functions recorded in CallsiteToCalleeFuncCloneMap.

CID 1517677:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type shared_ptr.

2557 for (auto CalleeEdge : CE->Caller->CalleeEdges) {
2558 // Skip any that have been removed on an earlier iteration when
2559 // cleaning up newly None type callee edges.
2560 if (!CalleeEdge)
2561 continue;
2562 ContextNode *Callee = CalleeEdge->Callee;
/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp: 2557 in CallsiteContextGraph<ModuleCallsiteContextGraph, llvm::Function, llvm::Instruction *>::assignFunctions()()
2551 // of the other callsites in that function that are reached by those
2552 // callers. Clone the other callees of the current callsite’s caller
2553 // that were already assigned to PreviousAssignedFuncClone
2554 // accordingly. This is important since we subsequently update the
2555 // calls from the nodes in the graph and their assignments to callee
2556 // functions recorded in CallsiteToCalleeFuncCloneMap.

CID 1517677:    (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type shared_ptr.

2557 for (auto CalleeEdge : CE->Caller->CalleeEdges) {
2558 // Skip any that have been removed on an earlier iteration when
2559 // cleaning up newly None type callee edges.
2560 if (!CalleeEdge)
2561 continue;
2562 ContextNode *Callee = CalleeEdge->Callee;

** CID 1517676: Performance inefficiencies (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 23937 in mlir::LLVM::PoisonOp::verifyInvariantsImpl()()


*** CID 1517676: Performance inefficiencies (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 23937 in mlir::LLVM::PoisonOp::verifyInvariantsImpl()()
23931
23932 ::mlir::LogicalResult PoisonOp::verifyInvariantsImpl() {
23933 {
23934 unsigned index = 0; (void)index;
23935 auto valueGroup0 = getODSResults(0);
23936

CID 1517676:  Performance inefficiencies  (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type OpResult.

23937 for (auto v : valueGroup0) {
23938 if (::mlir::failed(__mlir_ods_local_type_constraint_LLVMOps10(*this, v.getType(), “result”, index++)))
23939 return ::mlir::failure();
23940 }
23941 }
23942 return ::mlir::success();

** CID 1517675: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp: 28 in ::getNumTensorResults(mlir::Operation *)()


*** CID 1517675: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Interfaces/DestinationStyleOpInterface.cpp: 28 in ::getNumTensorResults(mlir::Operation *)()
22 return result;
23 }
24
25 namespace {
26 size_t getNumTensorResults(Operation *op) {
27 size_t numTensorResults = 0;

CID 1517675:  Performance inefficiencies  (AUTO_CAUSES_COPY)
Using the "auto" keyword without an "&" causes the copy of an object of type Type.

28 for (auto t : op->getResultTypes()) {
29 if (isa(t)) {
30 ++numTensorResults;
31 }
32 }
33 return numTensorResults;

** CID 1517674: Uninitialized variables (UNINIT)
/clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.cpp: 89 in clang::tidy::misc::skeleton(llvm::StringRef)()


*** CID 1517674: Uninitialized variables (UNINIT)
/clang-tools-extra/clang-tidy/misc/ConfusableIdentifierCheck.cpp: 89 in clang::tidy::misc::skeleton(llvm::StringRef)()
83 errs() << “Unicode conversion issue\n”;
84 break;
85 }
86 Skeleton.append((char *)BufferStart, (char *)IBuffer);
87 }
88 }

CID 1517674:  Uninitialized variables  (UNINIT)
Using uninitialized value "Skeleton". Field "Skeleton.InlineElts" is uninitialized.

89 return Skeleton;
90 }
91
92 static bool mayShadowImpl(const DeclContext *DC0, const DeclContext *DC1) {
93 return DC0 && DC0 == DC1;
94 }

** CID 1517673: (UNINIT_CTOR)
/clang/lib/Interpreter/DeviceOffload.cpp: 39 in clang::IncrementalCUDADeviceParser::IncrementalCUDADeviceParser(clang::Interpreter &, std::unique_ptr<clang::CompilerInstance, std::default_deleteclang::CompilerInstance>, clang::IncrementalParser &, llvm::LLVMContext &, llvm::IntrusiveRefCntPtrllvm::vfs::InMemoryFileSystem, llvm::Error &)()
/clang/lib/Interpreter/DeviceOffload.cpp: 33 in clang::IncrementalCUDADeviceParser::IncrementalCUDADeviceParser(clang::Interpreter &, std::unique_ptr<clang::CompilerInstance, std::default_deleteclang::CompilerInstance>, clang::IncrementalParser &, llvm::LLVMContext &, llvm::IntrusiveRefCntPtrllvm::vfs::InMemoryFileSystem, llvm::Error &)()


*** CID 1517673: (UNINIT_CTOR)
/clang/lib/Interpreter/DeviceOffload.cpp: 39 in clang::IncrementalCUDADeviceParser::IncrementalCUDADeviceParser(clang::Interpreter &, std::unique_ptr<clang::CompilerInstance, std::default_deleteclang::CompilerInstance>, clang::IncrementalParser &, llvm::LLVMContext &, llvm::IntrusiveRefCntPtrllvm::vfs::InMemoryFileSystem, llvm::Error &)()
33 return;
34 StringRef Arch = CI->getTargetOpts().CPU;
35 if (!Arch.starts_with(“sm_”) || Arch.substr(3).getAsInteger(10, SMVersion)) {
36 Err = llvm::joinErrors(std::move(Err), llvm::make_errorllvm::StringError(
37 “Invalid CUDA architecture”,
38 llvm::inconvertibleErrorCode()));

CID 1517673:    (UNINIT_CTOR)
Non-static class member "SMVersion" is not initialized in this constructor nor in any functions that it calls.

39 return;
40 }
41 }
42
43 llvm::Expected<PartialTranslationUnit &>
44 IncrementalCUDADeviceParser::Parse(llvm::StringRef Input) {
/clang/lib/Interpreter/DeviceOffload.cpp: 33 in clang::IncrementalCUDADeviceParser::IncrementalCUDADeviceParser(clang::Interpreter &, std::unique_ptr<clang::CompilerInstance, std::default_deleteclang::CompilerInstance>, clang::IncrementalParser &, llvm::LLVMContext &, llvm::IntrusiveRefCntPtrllvm::vfs::InMemoryFileSystem, llvm::Error &)()
27 IncrementalParser &HostParser, llvm::LLVMContext &LLVMCtx,
28 llvm::IntrusiveRefCntPtrllvm::vfs::InMemoryFileSystem FS,
29 llvm::Error &Err)
30 : IncrementalParser(Interp, std::move(Instance), LLVMCtx, Err),
31 HostParser(HostParser), VFS(FS) {
32 if (Err)

CID 1517673:    (UNINIT_CTOR)
Non-static class member "SMVersion" is not initialized in this constructor nor in any functions that it calls.

33 return;
34 StringRef Arch = CI->getTargetOpts().CPU;
35 if (!Arch.starts_with(“sm_”) || Arch.substr(3).getAsInteger(10, SMVersion)) {
36 Err = llvm::joinErrors(std::move(Err), llvm::make_errorllvm::StringError(
37 “Invalid CUDA architecture”,
38 llvm::inconvertibleErrorCode()));


To view the defects in Coverity Scan visit, Coverity Scan - Sign in