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.

74 new defect(s) introduced to llvm found with Coverity Scan.
28 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 74 defect(s)

** CID 1506663: Uninitialized variables (UNINIT)
/llvm/lib/Passes/StandardInstrumentations.cpp: 1087 in GetFunctions(llvm::Any)()


*** CID 1506663: Uninitialized variables (UNINIT)
/llvm/lib/Passes/StandardInstrumentations.cpp: 1087 in GetFunctions(llvm::Any)()
1081 if (const auto **MaybeF = any_cast<const Function *>(&IR)) {
1082 Functions.push_back(*const_cast<Function **>(MaybeF));
1083 } else if (const auto **MaybeM = any_cast<const Module *>(&IR)) {
1084 for (Function &F : **const_cast<Module **>(MaybeM))
1085 Functions.push_back(&F);
1086 }

CID 1506663:  Uninitialized variables  (UNINIT)
Using uninitialized value "Functions". Field "Functions.InlineElts" is uninitialized.

1087 return Functions;
1088 }
1089
1090 void PreservedCFGCheckerInstrumentation::registerCallbacks(
1091 PassInstrumentationCallbacks &PIC, ModuleAnalysisManager &MAM) {
1092 if (!VerifyAnalysisInvalidation)

** CID 1506662: Performance inefficiencies (AUTO_CAUSES_COPY)
/clang/lib/Basic/ParsedAttrInfo.cpp: 28 in clang::getAttributePluginInstancesabi:cxx11()


*** CID 1506662: Performance inefficiencies (AUTO_CAUSES_COPY)
/clang/lib/Basic/ParsedAttrInfo.cpp: 28 in clang::getAttributePluginInstancesabi:cxx11()
22
23 const std::list<std::unique_ptr> &
24 clang::getAttributePluginInstances() {
25 static llvm::ManagedStatic<std::list<std::unique_ptr>>
26 PluginAttrInstances;
27 if (PluginAttrInstances->empty())

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

28 for (auto It : ParsedAttrInfoRegistry::entries())
29 PluginAttrInstances->emplace_back(It.instantiate());
30
31 return *PluginAttrInstances;

** CID 1506661: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc: 5424 in mlir::tosa::FFT2dOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc: 5418 in mlir::tosa::FFT2dOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc: 5409 in mlir::tosa::FFT2dOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc: 5403 in mlir::tosa::FFT2dOp::verifyInvariantsImpl()()


*** CID 1506661: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc: 5424 in mlir::tosa::FFT2dOp::verifyInvariantsImpl()()
5418 for (auto v : valueGroup0) {
5419 if (::mlir::failed(__mlir_ods_local_type_constraint_TosaOps11(*this, v.getType(), “result”, index++)))
5420 return ::mlir::failure();
5421 }
5422 auto valueGroup1 = getODSResults(1);
5423

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

5424 for (auto v : valueGroup1) {
5425 if (::mlir::failed(__mlir_ods_local_type_constraint_TosaOps11(*this, v.getType(), “result”, index++)))
5426 return ::mlir::failure();
5427 }
5428 }
5429 return ::mlir::success();
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc: 5418 in mlir::tosa::FFT2dOp::verifyInvariantsImpl()()
5412 }
5413 }
5414 {
5415 unsigned index = 0; (void)index;
5416 auto valueGroup0 = getODSResults(0);
5417

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

5418 for (auto v : valueGroup0) {
5419 if (::mlir::failed(__mlir_ods_local_type_constraint_TosaOps11(*this, v.getType(), “result”, index++)))
5420 return ::mlir::failure();
5421 }
5422 auto valueGroup1 = getODSResults(1);
5423
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc: 5409 in mlir::tosa::FFT2dOp::verifyInvariantsImpl()()
5403 for (auto v : valueGroup0) {
5404 if (::mlir::failed(__mlir_ods_local_type_constraint_TosaOps11(*this, v.getType(), “operand”, index++)))
5405 return ::mlir::failure();
5406 }
5407 auto valueGroup1 = getODSOperands(1);
5408

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

5409 for (auto v : valueGroup1) {
5410 if (::mlir::failed(__mlir_ods_local_type_constraint_TosaOps11(*this, v.getType(), “operand”, index++)))
5411 return ::mlir::failure();
5412 }
5413 }
5414 {
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.cpp.inc: 5403 in mlir::tosa::FFT2dOp::verifyInvariantsImpl()()
5397 if (::mlir::failed(__mlir_ods_local_attr_constraint_TosaOps0(*this, tblgen_inverse, “inverse”)))
5398 return ::mlir::failure();
5399 {
5400 unsigned index = 0; (void)index;
5401 auto valueGroup0 = getODSOperands(0);
5402

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

5403 for (auto v : valueGroup0) {
5404 if (::mlir::failed(__mlir_ods_local_type_constraint_TosaOps11(*this, v.getType(), “operand”, index++)))
5405 return ::mlir::failure();
5406 }
5407 auto valueGroup1 = getODSOperands(1);
5408

** CID 1506660: (AUTO_CAUSES_COPY)
/mlir/lib/Bytecode/Writer/IRNumbering.cpp: 101 in groupByDialectPerByte<llvm::MutableArrayRef<mlir::bytecode::detail::OpNameNumbering *>>(T1)()
/mlir/lib/Bytecode/Writer/IRNumbering.cpp: 101 in groupByDialectPerByte<llvm::MutableArrayRef<mlir::bytecode::detail::TypeNumbering *>>(T1)()
/mlir/lib/Bytecode/Writer/IRNumbering.cpp: 101 in groupByDialectPerByte<llvm::MutableArrayRef<mlir::bytecode::detail::AttributeNumbering *>>(T1)()


*** CID 1506660: (AUTO_CAUSES_COPY)
/mlir/lib/Bytecode/Writer/IRNumbering.cpp: 101 in groupByDialectPerByte<llvm::MutableArrayRef<mlir::bytecode::detail::OpNameNumbering *>>(T1)()
95 // If the data range is now empty, we are done.
96 if (iterRange.empty())
97 break;
98 }
99
100 // Assign the entry numbers based on the sort order.

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

101 for (auto [idx, value] : llvm::enumerate(range))
102 value->number = idx;
103 }
104
105 IRNumberingState::IRNumberingState(Operation *op) {
106 // Number the root operation.
/mlir/lib/Bytecode/Writer/IRNumbering.cpp: 101 in groupByDialectPerByte<llvm::MutableArrayRef<mlir::bytecode::detail::TypeNumbering *>>(T1)()
95 // If the data range is now empty, we are done.
96 if (iterRange.empty())
97 break;
98 }
99
100 // Assign the entry numbers based on the sort order.

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

101 for (auto [idx, value] : llvm::enumerate(range))
102 value->number = idx;
103 }
104
105 IRNumberingState::IRNumberingState(Operation *op) {
106 // Number the root operation.
/mlir/lib/Bytecode/Writer/IRNumbering.cpp: 101 in groupByDialectPerByte<llvm::MutableArrayRef<mlir::bytecode::detail::AttributeNumbering *>>(T1)()
95 // If the data range is now empty, we are done.
96 if (iterRange.empty())
97 break;
98 }
99
100 // Assign the entry numbers based on the sort order.

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

101 for (auto [idx, value] : llvm::enumerate(range))
102 value->number = idx;
103 }
104
105 IRNumberingState::IRNumberingState(Operation *op) {
106 // Number the root operation.

** CID 1506659: Uninitialized members (UNINIT_CTOR)
/llvm/utils/TableGen/X86FoldTablesEmitter.cpp: 68 in ::X86FoldTablesEmitter::X86FoldTableEntry::X86FoldTableEntry()()


*** CID 1506659: Uninitialized members (UNINIT_CTOR)
/llvm/utils/TableGen/X86FoldTablesEmitter.cpp: 68 in ::X86FoldTablesEmitter::X86FoldTableEntry::X86FoldTableEntry()()
62 RecordKeeper &Records;
63 CodeGenTarget Target;
64
65 // Represents an entry in the folding table
66 class X86FoldTableEntry {
67 const CodeGenInstruction *RegInst;

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

68 const CodeGenInstruction *MemInst;
69
70 public:
71 bool CannotUnfold = false;
72 bool CannotFold = false;
73 bool IsLoad = false;

** CID 1506658: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp: 194 in mlir::dataflow::AbstractSparseDataFlowAnalysis::visitBlock(mlir::Block *)()


*** CID 1506658: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp: 194 in mlir::dataflow::AbstractSparseDataFlowAnalysis::visitBlock(mlir::Block *)()
188
189 // Check if we can reason about the data-flow from the predecessor.
190 if (auto branch =
191 dyn_cast(predecessor->getTerminator())) {
192 SuccessorOperands operands =
193 branch.getSuccessorOperands(it.getSuccessorIndex());

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

194 for (auto [idx, lattice] : llvm::enumerate(argLattices)) {
195 if (Value operand = operands[idx]) {
196 join(lattice, *getLatticeElementFor(block, operand));
197 } else {
198 // Conservatively consider internally produced arguments as entry
199 // points.

** CID 1506657: (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Affine/Analysis/Utils.cpp: 138 in mlir::ComputationSliceState::dump() const()
/mlir/lib/Dialect/Affine/Analysis/Utils.cpp: 130 in mlir::ComputationSliceState::dump() const()


*** CID 1506657: (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Affine/Analysis/Utils.cpp: 138 in mlir::ComputationSliceState::dump() const()
132 llvm::errs() << “\t\tOperands:\n”;
133 for (Value lbOp : lbOperands[en.index()])
134 llvm::errs() << “\t\t\t” << lbOp << “\n”;
135 }
136
137 llvm::errs() << “\tUBs:\n”;

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

138 for (auto en : llvm::enumerate(ubs)) {
139 llvm::errs() << “\t\t” << en.value() << “\n”;
140 llvm::errs() << “\t\tOperands:\n”;
141 for (Value ubOp : ubOperands[en.index()])
142 llvm::errs() << “\t\t\t” << ubOp << “\n”;
143 }
/mlir/lib/Dialect/Affine/Analysis/Utils.cpp: 130 in mlir::ComputationSliceState::dump() const()
124 void ComputationSliceState::dump() const {
125 llvm::errs() << “\tIVs:\n”;
126 for (Value iv : ivs)
127 llvm::errs() << “\t\t” << iv << “\n”;
128
129 llvm::errs() << “\tLBs:\n”;

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

130 for (auto en : llvm::enumerate(lbs)) {
131 llvm::errs() << “\t\t” << en.value() << “\n”;
132 llvm::errs() << “\t\tOperands:\n”;
133 for (Value lbOp : lbOperands[en.index()])
134 llvm::errs() << “\t\t\t” << lbOp << “\n”;
135 }

** CID 1506656: (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp: 1874 in mlir::memref::ReinterpretCastOp::verify()()
/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp: 1901 in mlir::memref::ReinterpretCastOp::verify()()


*** CID 1506656: (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp: 1874 in mlir::memref::ReinterpretCastOp::verify()()
1868 << srcType << " and result memref type " << resultType;
1869 if (srcType.getElementType() != resultType.getElementType())
1870 return emitError("different element types specified for source type ")
1871 << srcType << " and result memref type " << resultType;
1872
1873 // Match sizes in result memref type and in static_sizes attribute.

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

1874 for (auto [idx, resultSize, expectedSize] :
1875 llvm::enumerate(resultType.getShape(), getStaticSizes())) {
1876 if (!ShapedType::isDynamic(resultSize) &&
1877 !ShapedType::isDynamic(expectedSize) && resultSize != expectedSize)
1878 return emitError("expected result type with size = ")
1879 << expectedSize << " instead of " << resultSize
/mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp: 1901 in mlir::memref::ReinterpretCastOp::verify()()
1895 !ShapedType::isDynamic(expectedOffset) &&
1896 resultOffset != expectedOffset)
1897 return emitError("expected result type with offset = ")
1898 << resultOffset << " instead of " << expectedOffset;
1899
1900 // Match strides in result memref type and in static_strides attribute.

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

1901 for (auto [idx, resultStride, expectedStride] :
1902 llvm::enumerate(resultStrides, getStaticStrides())) {
1903 if (!ShapedType::isDynamic(resultStride) &&
1904 !ShapedType::isDynamic(expectedStride) &&
1905 resultStride != expectedStride)
1906 return emitError("expected result type with stride = ")

** CID 1506655: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp: 92 in mlir::linalg::transformIndexOps(mlir::RewriterBase &, mlir::linalg::LinalgOp, llvm::SmallVectorImplmlir::Value &, const llvm::DenseMap<int, int, llvm::DenseMapInfo<int, void>, llvm::detail::DenseMapPair<int, int>> &)()


*** CID 1506655: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp: 92 in mlir::linalg::transformIndexOps(mlir::RewriterBase &, mlir::linalg::LinalgOp, llvm::SmallVectorImplmlir::Value &, const llvm::DenseMap<int, int, llvm::DenseMapInfo<int, void>, llvm::detail::DenseMapPair<int, int>> &)()
86 }
87
88 void mlir::linalg::transformIndexOps(
89 RewriterBase &b, LinalgOp op, SmallVectorImpl &ivs,
90 const LoopIndexToRangeIndexMap &loopIndexToRangeIndex) {
91 SmallVector allIvs(op.getNumLoops(), nullptr);

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

92 for (auto en : enumerate(allIvs)) {
93 auto rangeIndex = loopIndexToRangeIndex.find(en.index());
94 if (rangeIndex == loopIndexToRangeIndex.end())
95 continue;
96 en.value() = ivs[rangeIndex->second];
97 }

** CID 1506654: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/IR/AsmPrinter.cpp: 3277 in ::OperationPrinter::printValueUsers(mlir::Value)()


*** CID 1506654: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/IR/AsmPrinter.cpp: 3277 in ::OperationPrinter::printValueUsers(mlir::Value)()
3271 if (value.use_empty())
3272 os << “unused”;
3273
3274 // One value might be used as the operand of an operation more than once.
3275 // Only print the operations results once in that case.
3276 SmallPtrSet<Operation *, 1> userSet;

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

3277 for (auto [index, user] : enumerate(value.getUsers())) {
3278 if (userSet.insert(user).second)
3279 printUserIDs(user, index);
3280 }
3281 }
3282

** CID 1506653: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp: 954 in ::DefFormatParser::verify(llvm::SMLoc, llvm::ArrayRef<mlir::tblgen::FormatElement *>)()


*** CID 1506653: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp: 954 in ::DefFormatParser::verify(llvm::SMLoc, llvm::ArrayRef<mlir::tblgen::FormatElement *>)()
948 };
949 } // namespace
950
951 LogicalResult DefFormatParser::verify(SMLoc loc,
952 ArrayRef<FormatElement *> elements) {
953 // Check that all parameters are referenced in the format.

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

954 for (auto [index, param] : llvm::enumerate(def.getParameters())) {
955 if (param.isOptional())
956 continue;
957 if (!seenParams.test(index)) {
958 if (isa(param))
959 continue;

** CID 1506652: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp: 125 in mlir::sparse_tensor::LoopEmitter::genSliceLegitPredicate(mlir::OpBuilder &, mlir::Location, mlir::Value, unsigned int, unsigned long)()


*** CID 1506652: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/SparseTensor/Transforms/LoopEmitter.cpp: 125 in mlir::sparse_tensor::LoopEmitter::genSliceLegitPredicate(mlir::OpBuilder &, mlir::Location, mlir::Value, unsigned int, unsigned long)()
119 loc, arith::CmpIPredicate::eq, crdRem, constantIndex(builder, loc, 0));
120 conds.push_back(fitStride);
121 }
122
123 // Must meet all condition to be a valid coordinate in slice.
124 auto pred = conds.front();

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

125 for (auto cond : ValueRange(conds).drop_front())
126 pred = builder.createarith::AndIOp(loc, pred, cond);
127
128 return {newCrd, pred};
129 }
130

** CID 1506651: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp: 257 in ::TestLastModifiedPass::runOnOperation()::[lambda(mlir::Operation *) (instance 1)]::operator ()(mlir::Operation *) const()


*** CID 1506651: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp: 257 in ::TestLastModifiedPass::runOnOperation()::[lambda(mlir::Operation *) (instance 1)]::operator ()(mlir::Operation *) const()
251 if (!tag)
252 return;
253 os << "test_tag: " << tag.getValue() << “:\n”;
254 const LastModification *lastMods =
255 solver.lookupState(op);
256 assert(lastMods && “expected a dense lattice”);

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

257 for (auto [index, operand] : llvm::enumerate(op->getOperands())) {
258 os << " operand #" << index << “\n”;
259 Value value = getMostUnderlyingValue(operand, [&](Value value) {
260 return solver.lookupState(value);
261 });
262 assert(value && “expected an underlying value”);

** CID 1506650: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/X86Vector/Transforms/AVXTranspose.cpp: 260 in TransposeOpLowering::matchAndRewrite(mlir::vector::TransposeOp, mlir::PatternRewriter &) const()


*** CID 1506650: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/X86Vector/Transforms/AVXTranspose.cpp: 260 in TransposeOpLowering::matchAndRewrite(mlir::vector::TransposeOp, mlir::PatternRewriter &) const()
254 // applied to f32 vector types with two dimensions greater than one.
255 VectorType srcType = op.getSourceVectorType();
256 if (!srcType.getElementType().isF32())
257 return rewriter.notifyMatchFailure(op, “Unsupported vector element type”);
258
259 SmallVector<int64_t> srcGtOneDims;

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

260 for (auto [index, size] : llvm::enumerate(srcType.getShape()))
261 if (size > 1)
262 srcGtOneDims.push_back(index);
263
264 if (srcGtOneDims.size() != 2)
265 return rewriter.notifyMatchFailure(op, “Unsupported vector type”);

** CID 1506649: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp: 2868 in mlir::transform::TileToScfForOp::apply(mlir::transform::TransformResults &, mlir::transform::TransformState &)()


*** CID 1506649: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp: 2868 in mlir::transform::TileToScfForOp::apply(mlir::transform::TransformResults &, mlir::transform::TransformState &)()
2862 }
2863 }
2864
2865 SmallVector<Operation *> tiled;
2866 SmallVector<SmallVector<Operation *, 4>, 4> loops;
2867 loops.resize(getLoops().size());

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

2868 for (auto en : llvm::enumerate(targets)) {
2869 auto tilingInterfaceOp = dyn_cast(en.value());
2870 if (!tilingInterfaceOp) {
2871 DiagnosedSilenceableFailure diag =
2872 emitSilenceableError() << “only TilingInterface ops are supported”;
2873 diag.attachNote(en.value()->getLoc()) << “target op”;

** CID 1506648: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp: 872 in generateNamedGenericOpDefns(::LinalgOpConfig &, ::GenerationContext &)()


*** CID 1506648: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp: 872 in generateNamedGenericOpDefns(::LinalgOpConfig &, ::GenerationContext &)()
866 )FMT";
867 // Update all symbol bindings mapped to an attribute.
868 for (LinalgOperandDef &arg : opConfig.structuredOp->args) {
869 if (arg.kind != LinalgOperandDefKind::IndexAttr)
870 continue;
871 assert(arg.indexAttrMap);

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

872 for (auto [idx, result] :
873 llvm::enumerate(arg.indexAttrMap->affineMap().getResults())) {
874 if (auto symbol = result.dyn_cast()) {
875 std::string argName = arg.name;
876 argName[0] = toupper(argName[0]);
877 symbolBindings[symbol.getPosition()] =

** CID 1506647: Uninitialized variables (UNINIT)
/llvm/lib/DWARFLinker/DWARFLinker.cpp: 1810 in llvm::DWARFLinker::generateUnitLocations(llvm::CompileUnit &, const llvm::DWARFFile &, llvm::function_ref<void (llvm::SmallVectorImpl &, llvm::SmallVectorImpl &)>) const()


*** CID 1506647: Uninitialized variables (UNINIT)
/llvm/lib/DWARFLinker/DWARFLinker.cpp: 1810 in llvm::DWARFLinker::generateUnitLocations(llvm::CompileUnit &, const llvm::DWARFFile &, llvm::function_ref<void (llvm::SmallVectorImpl &, llvm::SmallVectorImpl &)>) const()
1804 }
1805
1806 // Clone expression.
1807 LinkedExpression.Expr.reserve(CurExpression.Expr.size());
1808 ExprHandler(CurExpression.Expr, LinkedExpression.Expr);
1809

CID 1506647:  Uninitialized variables  (UNINIT)
Using uninitialized value "LinkedExpression". Field "LinkedExpression.Expr.InlineElts" is uninitialized when calling "push_back". [Note: The source code implementation of the function has been overridden by a builtin model.]

1810 LinkedLocationExpressions.push_back(LinkedExpression);
1811 }
1812
1813 // Emit locations list table fragment corresponding to the CurLocAttr.
1814 TheDwarfEmitter->emitDwarfDebugLocListFragment(
1815 Unit, LinkedLocationExpressions, CurLocAttr.first);

** CID 1506646: Performance inefficiencies (PASS_BY_VALUE)
/flang/lib/Lower/ConvertExpr.cpp: 7256 in Fortran::lower::updateBoxForParentComponent(Fortran::lower::AbstractConverter &, fir::ExtendedValue, const Fortran::evaluate::ExprFortran::evaluate::SomeType &)()


*** CID 1506646: Performance inefficiencies (PASS_BY_VALUE)
/flang/lib/Lower/ConvertExpr.cpp: 7256 in Fortran::lower::updateBoxForParentComponent(Fortran::lower::AbstractConverter &, fir::ExtendedValue, const Fortran::evaluate::ExprFortran::evaluate::SomeType &)()
7250 // TYPE(t2) :: y(2)
7251 // TYPE(t2) :: a
7252 // y(:)%t ! just need to update the box with a slice pointing to the first
7253 // ! component of t.
7254 // a%t ! simple conversion to TYPE(t).
7255 fir::ExtendedValue Fortran::lower::updateBoxForParentComponent(

CID 1506646:  Performance inefficiencies  (PASS_BY_VALUE)
Passing parameter box of type "fir::ExtendedValue" (size 248 bytes) by value, which exceeds the low threshold of 128 bytes.

7256 Fortran::lower::AbstractConverter &converter, fir::ExtendedValue box,
7257 const Fortran::lower::SomeExpr &expr) {
7258 mlir::Location loc = converter.getCurrentLocation();
7259 auto &builder = converter.getFirOpBuilder();
7260 mlir::Value boxBase = fir::getBase(box);
7261 mlir::Operation *op = boxBase.getDefiningOp();

** CID 1506645: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.cpp.inc: 297 in mlir::transform::MapForallToBlocks::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.cpp.inc: 306 in mlir::transform::MapForallToBlocks::verifyInvariantsImpl()()


*** CID 1506645: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.cpp.inc: 297 in mlir::transform::MapForallToBlocks::verifyInvariantsImpl()()
291 if (::mlir::failed(__mlir_ods_local_attr_constraint_GPUTransformOps1(*this, tblgen_generate_gpu_launch, “generate_gpu_launch”)))
292 return ::mlir::failure();
293 {
294 unsigned index = 0; (void)index;
295 auto valueGroup0 = getODSOperands(0);
296

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

297 for (auto v : valueGroup0) {
298 if (::mlir::failed(__mlir_ods_local_type_constraint_GPUTransformOps0(*this, v.getType(), “operand”, index++)))
299 return ::mlir::failure();
300 }
301 }
302 {
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/GPU/TransformOps/GPUTransformOps.cpp.inc: 306 in mlir::transform::MapForallToBlocks::verifyInvariantsImpl()()
300 }
301 }
302 {
303 unsigned index = 0; (void)index;
304 auto valueGroup0 = getODSResults(0);
305

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

306 for (auto v : valueGroup0) {
307 if (::mlir::failed(__mlir_ods_local_type_constraint_GPUTransformOps0(*this, v.getType(), “result”, index++)))
308 return ::mlir::failure();
309 }
310 }
311 return ::mlir::success();

** CID 1506644: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Bytecode/Writer/IRNumbering.cpp: 135 in mlir::bytecode::detail::IRNumberingState::IRNumberingState(mlir::Operation *)()


*** CID 1506644: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Bytecode/Writer/IRNumbering.cpp: 135 in mlir::bytecode::detail::IRNumberingState::IRNumberingState(mlir::Operation *)()
129 }
130
131 // Number each of the dialects. For now this is just in the order they were
132 // found, given that the number of dialects on average is small enough to fit
133 // within a singly byte (128). If we ever have real world use cases that have
134 // a huge number of dialects, this could be made more intelligent.

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

135 for (auto [idx, dialect] : llvm::enumerate(dialects))
136 dialect.second->number = idx;
137
138 // Number each of the recorded components within each dialect.
139
140 // First sort by ref count so that the most referenced elements are first. We


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