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.

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

** CID 1505878: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2557 in mlir::amdgpu::RawBufferAtomicSmaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2551 in mlir::amdgpu::RawBufferAtomicSmaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2563 in mlir::amdgpu::RawBufferAtomicSmaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2574 in mlir::amdgpu::RawBufferAtomicSmaxOp::verifyInvariantsImpl()()


*** CID 1505878: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2557 in mlir::amdgpu::RawBufferAtomicSmaxOp::verifyInvariantsImpl()()
2551 for (auto v : valueGroup0) {
2552 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
2553 return ::mlir::failure();
2554 }
2555 auto valueGroup1 = getODSOperands(1);
2556

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

2557 for (auto v : valueGroup1) {
2558 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), “operand”, index++)))
2559 return ::mlir::failure();
2560 }
2561 auto valueGroup2 = getODSOperands(2);
2562
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2551 in mlir::amdgpu::RawBufferAtomicSmaxOp::verifyInvariantsImpl()()
2545 if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU0(*this, tblgen_indexOffset, “indexOffset”)))
2546 return ::mlir::failure();
2547 {
2548 unsigned index = 0; (void)index;
2549 auto valueGroup0 = getODSOperands(0);
2550

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

2551 for (auto v : valueGroup0) {
2552 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
2553 return ::mlir::failure();
2554 }
2555 auto valueGroup1 = getODSOperands(1);
2556
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2563 in mlir::amdgpu::RawBufferAtomicSmaxOp::verifyInvariantsImpl()()
2557 for (auto v : valueGroup1) {
2558 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), “operand”, index++)))
2559 return ::mlir::failure();
2560 }
2561 auto valueGroup2 = getODSOperands(2);
2562

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

2563 for (auto v : valueGroup2) {
2564 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
2565 return ::mlir::failure();
2566 }
2567 auto valueGroup3 = getODSOperands(3);
2568
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2574 in mlir::amdgpu::RawBufferAtomicSmaxOp::verifyInvariantsImpl()()
2568
2569 if (valueGroup3.size() > 1) {
2570 return emitOpError(“operand group starting at #”) << index
2571 << " requires 0 or 1 element, but found " << valueGroup3.size();
2572 }
2573

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

2574 for (auto v : valueGroup3) {
2575 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
2576 return ::mlir::failure();
2577 }
2578 }
2579 return ::mlir::success();

** CID 1505877: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Lower/Bridge.cpp: 1085 in ::FirConverter::genMultiwayBranch(mlir::Value, llvm::SmallVector<long, (unsigned int)6>, llvm::SmallVector<unsigned long, (unsigned int)6>, const Fortran::lower::pft::Evaluation &, bool)()


*** CID 1505877: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Lower/Bridge.cpp: 1085 in ::FirConverter::genMultiwayBranch(mlir::Value, llvm::SmallVector<long, (unsigned int)6>, llvm::SmallVector<unsigned long, (unsigned int)6>, const Fortran::lower::pft::Evaluation &, bool)()
1079 if (inArithmeticIfContext)
1080 zero =
1081 realSelector
1082 ? builder->createmlir::arith::ConstantOp(
1083 loc, selectorType, builder->getFloatAttr(selectorType, 0.0))
1084 : builder->createIntegerConstant(loc, selectorType, 0);

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

1085 for (auto label : llvm::enumerate(labelList)) {
1086 mlir::Value cond;
1087 if (realSelector) // inArithmeticIfContext
1088 cond = builder->createmlir::arith::CmpFOp(
1089 loc,
1090 label.index() == 0 ? mlir::arith::CmpFPredicate::OLT

** CID 1505876: Uninitialized variables (UNINIT)


*** CID 1505876: Uninitialized variables (UNINIT)
/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h: 242 in llvm::omp::target::plugin::utils::::KernelInfoReader::generateKernelInfo(__gnu_cxx::__normal_iterator<llvm::msgpack::DocNode *, std::vector<llvm::msgpack::DocNode, std::allocatorllvm::msgpack::DocNode>>)()
236 std::string KernelName;
237 auto Entry = (*It).getMap();
238 for (auto MI = Entry.begin(), E = Entry.end(); MI != E; ++MI)
239 if (auto Err = extractKernelData(*MI, KernelName, KernelData))
240 return Err;
241

CID 1505876:  Uninitialized variables  (UNINIT)
Using uninitialized value "KernelData". Field "KernelData.KernelObject" is uninitialized when calling "pair".

242 KernelInfoMap.insert({KernelName, KernelData});
243 return Error::success();
244 }
245
246 /// Go over the list of AMD kernels in the “amdhsa.kernels” entry
247 Error iterateAMDKernels(msgpack::MapDocNode &MDN) {

** CID 1505875: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/IR/OperationSupport.cpp: 694 in mlir::OperationEquivalence::isRegionEquivalentTo(mlir::Region *, mlir::Region *, llvm::function_ref<mlir::LogicalResult (mlir::Value, mlir::Value)>, llvm::function_ref<void (mlir::Value, mlir::Value)>, mlir::OperationEquivalence::Flags)::[lambda(mlir::Block &, mlir::Block &) (instance 1)]::operator ()(mlir::Block &, mlir::Block &) const::[lambda(mlir::Operation &, mlir::Operation &) (instance 1)]::operator ()(mlir::Operation &, mlir::Operation &) const()


*** CID 1505875: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/IR/OperationSupport.cpp: 694 in mlir::OperationEquivalence::isRegionEquivalentTo(mlir::Region *, mlir::Region *, llvm::function_ref<mlir::LogicalResult (mlir::Value, mlir::Value)>, llvm::function_ref<void (mlir::Value, mlir::Value)>, mlir::OperationEquivalence::Flags)::[lambda(mlir::Block &, mlir::Block &) (instance 1)]::operator ()(mlir::Block &, mlir::Block &) const::[lambda(mlir::Operation &, mlir::Operation &) (instance 1)]::operator ()(mlir::Operation &, mlir::Operation &) const()
688 auto opsEquivalent = [&](Operation &lOp, Operation &rOp) {
689 // Check for op equality (recursively).
690 if (!OperationEquivalence::isEquivalentTo(&lOp, &rOp, checkEquivalent,
691 markEquivalent, flags))
692 return false;
693 // Check successor mapping.

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

694 for (auto successorsPair :
695 llvm::zip(lOp.getSuccessors(), rOp.getSuccessors())) {
696 Block *curSuccessor = std::get<0>(successorsPair);
697 Block *otherSuccessor = std::get<1>(successorsPair);
698 auto insertion = blocksMap.insert({curSuccessor, otherSuccessor});
699 if (insertion.first->getSecond() != otherSuccessor)

** CID 1505874: Uninitialized members (UNINIT_CTOR)
/flang/include/flang/Optimizer/Support/InternalNames.h: 54 in fir::NameUniquer::DeconstructedName::DeconstructedName(llvm::StringRef)()


*** CID 1505874: Uninitialized members (UNINIT_CTOR)
/flang/include/flang/Optimizer/Support/InternalNames.h: 54 in fir::NameUniquer::DeconstructedName::DeconstructedName(llvm::StringRef)()
48 TYPE_DESC,
49 VARIABLE
50 };
51
52 /// Components of an unparsed unique name
53 struct DeconstructedName {

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

54 DeconstructedName(llvm::StringRef name) : name{name} {}
55 DeconstructedName(llvm::ArrayRefstd::string modules,
56 llvm::ArrayRefstd::string procs, std::int64_t blockId,
57 llvm::StringRef name, llvm::ArrayRefstd::int64_t kinds)
58 : modules{modules.begin(), modules.end()}, procs{procs.begin(),
59 procs.end()},

** CID 1505873: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp: 363 in HoistingAnalysis::getPackedTensorSizes(mlir::RewriterBase &, mlir::Location)()


*** CID 1505873: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp: 363 in HoistingAnalysis::getPackedTensorSizes(mlir::RewriterBase &, mlir::Location)()
357
358 // Upper bound the packing loop lengths to size the packed tensor. Taking
359 // upper bounds can make the sizes of the packed tensor independent of the
360 // enclosing loops. This independence is a prerequisite for reusing the same
361 // buffer for all enclosing loop iterations and hoisting its allocation out
362 // of the enclosing loops.

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

363 for (auto forOp : packingLoops) {
364 // Compute an upper bound ubVal for the upper bound of forOp.
365 AffineMap boundMap;
366 SmallVector boundOperands;
367 getUpperBoundForIndex(forOp.getUpperBound(), boundMap, boundOperands);
368 Value ubVal =

** CID 1505872: Null pointer dereferences (FORWARD_NULL)


*** CID 1505872: Null pointer dereferences (FORWARD_NULL)
/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp: 294 in mlir::linalg::padAndHoistLinalgOp(mlir::RewriterBase &, mlir::linalg::LinalgOp, mlir::linalg::LinalgPaddingOptions)()
288 if (!padOp || en.value() == 0) {
289 (void)rewriter.notifyMatchFailure(linalgOp, “not a tensor.pad – skip”);
290 continue;
291 }
292
293 // Fail hoisting if the operand shape is not fully static.

CID 1505872:  Null pointer dereferences  (FORWARD_NULL)
"getShape" dereferences null "paddedOp->conceptImpl".

294 if (llvm::any_of(paddedOp.getShape(&opOperand), ShapedType::isDynamic)) {
295 (void)rewriter.notifyMatchFailure(linalgOp,
296 “non static padding shape – skip”);
297 continue;
298 }
299

** CID 1505871: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2079 in mlir::amdgpu::RawBufferAtomicFmaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2068 in mlir::amdgpu::RawBufferAtomicFmaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2056 in mlir::amdgpu::RawBufferAtomicFmaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2062 in mlir::amdgpu::RawBufferAtomicFmaxOp::verifyInvariantsImpl()()


*** CID 1505871: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2079 in mlir::amdgpu::RawBufferAtomicFmaxOp::verifyInvariantsImpl()()
2073
2074 if (valueGroup3.size() > 1) {
2075 return emitOpError(“operand group starting at #”) << index
2076 << " requires 0 or 1 element, but found " << valueGroup3.size();
2077 }
2078

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

2079 for (auto v : valueGroup3) {
2080 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
2081 return ::mlir::failure();
2082 }
2083 }
2084 if (!(((getElementTypeOrSelf((*this->getODSOperands(0).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) && (getElementTypeOrSelf((*this->getODSOperands(1).begin()))) == (getElementTypeOrSelf((*this->getODSOperands(0).begin()))))))
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2068 in mlir::amdgpu::RawBufferAtomicFmaxOp::verifyInvariantsImpl()()
2062 for (auto v : valueGroup1) {
2063 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), “operand”, index++)))
2064 return ::mlir::failure();
2065 }
2066 auto valueGroup2 = getODSOperands(2);
2067

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

2068 for (auto v : valueGroup2) {
2069 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
2070 return ::mlir::failure();
2071 }
2072 auto valueGroup3 = getODSOperands(3);
2073
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2056 in mlir::amdgpu::RawBufferAtomicFmaxOp::verifyInvariantsImpl()()
2050 if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU0(*this, tblgen_indexOffset, “indexOffset”)))
2051 return ::mlir::failure();
2052 {
2053 unsigned index = 0; (void)index;
2054 auto valueGroup0 = getODSOperands(0);
2055

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

2056 for (auto v : valueGroup0) {
2057 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), “operand”, index++)))
2058 return ::mlir::failure();
2059 }
2060 auto valueGroup1 = getODSOperands(1);
2061
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 2062 in mlir::amdgpu::RawBufferAtomicFmaxOp::verifyInvariantsImpl()()
2056 for (auto v : valueGroup0) {
2057 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU2(*this, v.getType(), “operand”, index++)))
2058 return ::mlir::failure();
2059 }
2060 auto valueGroup1 = getODSOperands(1);
2061

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

2062 for (auto v : valueGroup1) {
2063 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), “operand”, index++)))
2064 return ::mlir::failure();
2065 }
2066 auto valueGroup2 = getODSOperands(2);
2067

** CID 1505870: Uninitialized variables (UNINIT)
/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp: 384 in HoistingAnalysis::getPackedTensorSizes(mlir::RewriterBase &, mlir::Location)()


*** CID 1505870: Uninitialized variables (UNINIT)
/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp: 384 in HoistingAnalysis::getPackedTensorSizes(mlir::RewriterBase &, mlir::Location)()
378 loc, (ub - lb).ceilDiv(step),
379 ValueRange{forOp.getLowerBound(), ubVal,
380 castscf::ForOp(forOp).getStep()});
381 dynamicTensorSizes.push_back(res);
382 }
383

CID 1505870:  Uninitialized variables  (UNINIT)
Using uninitialized value "dynamicTensorSizes". Field "dynamicTensorSizes.InlineElts" is uninitialized.

384 return dynamicTensorSizes;
385 }
386
387 static bool isDefinedOutsideOrConstant(scf::ForOp outer, Value v) {
388 return outer.isDefinedOutsideOfLoop(v) || matchPattern(v, m_Constant());
389 }

** CID 1505869: Performance inefficiencies (PASS_BY_VALUE)
/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp: 268 in mlir::linalg::padAndHoistLinalgOp(mlir::RewriterBase &, mlir::linalg::LinalgOp, mlir::linalg::LinalgPaddingOptions)()


*** CID 1505869: Performance inefficiencies (PASS_BY_VALUE)
/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp: 268 in mlir::linalg::padAndHoistLinalgOp(mlir::RewriterBase &, mlir::linalg::LinalgOp, mlir::linalg::LinalgPaddingOptions)()
262 //===----------------------------------------------------------------------===//
263 // pad transformation.
264 //===----------------------------------------------------------------------===//
265
266 FailureOr
267 mlir::linalg::padAndHoistLinalgOp(RewriterBase &rewriter, LinalgOp linalgOp,

CID 1505869:  Performance inefficiencies  (PASS_BY_VALUE)
Passing parameter options of type "mlir::linalg::LinalgPaddingOptions" (size 336 bytes) by value, which exceeds the medium threshold of 256 bytes.

268 LinalgPaddingOptions options) {
269 if (!linalgOp.hasTensorSemantics())
270 return rewriter.notifyMatchFailure(
271 linalgOp, “only applies to Linalg ops with tensor semantics”);
272
273 // Pad the operation.

** CID 1505868: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 4231 in mlir::LLVM::AtomicRMWOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::LLVM::AtomicBinOp, mlir::Value, mlir::Value, mlir::LLVM::AtomicOrdering, mlir::StringAttr, mlir::IntegerAttr, bool, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr)()


*** CID 1505868: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 4231 in mlir::LLVM::AtomicRMWOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::LLVM::AtomicBinOp, mlir::Value, mlir::Value, mlir::LLVM::AtomicOrdering, mlir::StringAttr, mlir::IntegerAttr, bool, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr)()
4225 odsState.addAttribute(getSyncscopeAttrName(odsState.name), syncscope);
4226 }
4227 if (alignment) {
4228 odsState.addAttribute(getAlignmentAttrName(odsState.name), alignment);
4229 }
4230 if (volatile_) {

CID 1505868:  Control flow issues  (DEADCODE)
Execution cannot reach this statement: "<temporary>.UnitAttr(NULL);".

4231 odsState.addAttribute(getVolatile_AttrName(odsState.name), ((volatile_) ? odsBuilder.getUnitAttr() : nullptr));
4232 }
4233 if (access_groups) {
4234 odsState.addAttribute(getAccessGroupsAttrName(odsState.name), access_groups);
4235 }
4236 if (alias_scopes) {

** CID 1505867: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/flang/include/flang/Optimizer/HLFIR/HLFIROps.cpp.inc: 5215 in hlfir::TransposeOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/flang/include/flang/Optimizer/HLFIR/HLFIROps.cpp.inc: 5206 in hlfir::TransposeOp::verifyInvariantsImpl()()


*** CID 1505867: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/flang/include/flang/Optimizer/HLFIR/HLFIROps.cpp.inc: 5215 in hlfir::TransposeOp::verifyInvariantsImpl()()
5209 }
5210 }
5211 {
5212 unsigned index = 0; (void)index;
5213 auto valueGroup0 = getODSResults(0);
5214

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

5215 for (auto v : valueGroup0) {
5216 if (::mlir::failed(__mlir_ods_local_type_constraint_HLFIROps2(*this, v.getType(), “result”, index++)))
5217 return ::mlir::failure();
5218 }
5219 }
5220 return ::mlir::success();
/build-llvm/tools/clang/stage2-bins/tools/flang/include/flang/Optimizer/HLFIR/HLFIROps.cpp.inc: 5206 in hlfir::TransposeOp::verifyInvariantsImpl()()
5200
5201 ::mlir::LogicalResult TransposeOp::verifyInvariantsImpl() {
5202 {
5203 unsigned index = 0; (void)index;
5204 auto valueGroup0 = getODSOperands(0);
5205

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

5206 for (auto v : valueGroup0) {
5207 if (::mlir::failed(__mlir_ods_local_type_constraint_HLFIROps17(*this, v.getType(), “operand”, index++)))
5208 return ::mlir::failure();
5209 }
5210 }
5211 {

** CID 1505866: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 3222 in mlir::LLVM::AtomicCmpXchgOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::Value, mlir::Value, mlir::Value, mlir::LLVM::AtomicOrdering, mlir::LLVM::AtomicOrdering, mlir::StringAttr, mlir::IntegerAttr, bool, bool, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr)()


*** CID 1505866: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 3222 in mlir::LLVM::AtomicCmpXchgOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::Value, mlir::Value, mlir::Value, mlir::LLVM::AtomicOrdering, mlir::LLVM::AtomicOrdering, mlir::StringAttr, mlir::IntegerAttr, bool, bool, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr)()
3216 odsState.addAttribute(getAlignmentAttrName(odsState.name), alignment);
3217 }
3218 if (weak) {
3219 odsState.addAttribute(getWeakAttrName(odsState.name), ((weak) ? odsBuilder.getUnitAttr() : nullptr));
3220 }
3221 if (volatile_) {

CID 1505866:  Control flow issues  (DEADCODE)
Execution cannot reach this statement: "<temporary>.UnitAttr(NULL);".

3222 odsState.addAttribute(getVolatile_AttrName(odsState.name), ((volatile_) ? odsBuilder.getUnitAttr() : nullptr));
3223 }
3224 if (access_groups) {
3225 odsState.addAttribute(getAccessGroupsAttrName(odsState.name), access_groups);
3226 }
3227 if (alias_scopes) {

** CID 1505865: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc: 1611 in mlir::transform::HoistPadOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc: 1620 in mlir::transform::HoistPadOp::verifyInvariantsImpl()()


*** CID 1505865: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc: 1611 in mlir::transform::HoistPadOp::verifyInvariantsImpl()()
1605 if (::mlir::failed(__mlir_ods_local_attr_constraint_LinalgTransformOps3(*this, tblgen_transpose, “transpose”)))
1606 return ::mlir::failure();
1607 {
1608 unsigned index = 0; (void)index;
1609 auto valueGroup0 = getODSOperands(0);
1610

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

1611 for (auto v : valueGroup0) {
1612 if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgTransformOps1(*this, v.getType(), “operand”, index++)))
1613 return ::mlir::failure();
1614 }
1615 }
1616 {
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp.inc: 1620 in mlir::transform::HoistPadOp::verifyInvariantsImpl()()
1614 }
1615 }
1616 {
1617 unsigned index = 0; (void)index;
1618 auto valueGroup0 = getODSResults(0);
1619

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

1620 for (auto v : valueGroup0) {
1621 if (::mlir::failed(__mlir_ods_local_type_constraint_LinalgTransformOps1(*this, v.getType(), “result”, index++)))
1622 return ::mlir::failure();
1623 }
1624 }
1625 return ::mlir::success();

** CID 1505864: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1980 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1962 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1974 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1986 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1968 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()


*** CID 1505864: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1980 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()
1974 for (auto v : valueGroup2) {
1975 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “operand”, index++)))
1976 return ::mlir::failure();
1977 }
1978 auto valueGroup3 = getODSOperands(3);
1979

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

1980 for (auto v : valueGroup3) {
1981 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “operand”, index++)))
1982 return ::mlir::failure();
1983 }
1984 auto valueGroup4 = getODSOperands(4);
1985
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1962 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()
1956
1957 ::mlir::LogicalResult RawBufferAtomicFMaxOp::verifyInvariantsImpl() {
1958 {
1959 unsigned index = 0; (void)index;
1960 auto valueGroup0 = getODSOperands(0);
1961

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

1962 for (auto v : valueGroup0) {
1963 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “operand”, index++)))
1964 return ::mlir::failure();
1965 }
1966 auto valueGroup1 = getODSOperands(1);
1967
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1974 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()
1968 for (auto v : valueGroup1) {
1969 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “operand”, index++)))
1970 return ::mlir::failure();
1971 }
1972 auto valueGroup2 = getODSOperands(2);
1973

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

1974 for (auto v : valueGroup2) {
1975 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “operand”, index++)))
1976 return ::mlir::failure();
1977 }
1978 auto valueGroup3 = getODSOperands(3);
1979
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1986 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()
1980 for (auto v : valueGroup3) {
1981 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “operand”, index++)))
1982 return ::mlir::failure();
1983 }
1984 auto valueGroup4 = getODSOperands(4);
1985

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

1986 for (auto v : valueGroup4) {
1987 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “operand”, index++)))
1988 return ::mlir::failure();
1989 }
1990 }
1991 return ::mlir::success();
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.cpp.inc: 1968 in mlir::ROCDL::RawBufferAtomicFMaxOp::verifyInvariantsImpl()()
1962 for (auto v : valueGroup0) {
1963 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “operand”, index++)))
1964 return ::mlir::failure();
1965 }
1966 auto valueGroup1 = getODSOperands(1);
1967

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

1968 for (auto v : valueGroup1) {
1969 if (::mlir::failed(__mlir_ods_local_type_constraint_ROCDLOps0(*this, v.getType(), “operand”, index++)))
1970 return ::mlir::failure();
1971 }
1972 auto valueGroup2 = getODSOperands(2);
1973

** CID 1505863: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Utils/StaticValueUtils.cpp: 143 in mlir::isEqualConstantIntOrValueArray(llvm::ArrayRefmlir::OpFoldResult, llvm::ArrayRefmlir::OpFoldResult)()


*** CID 1505863: Performance inefficiencies (AUTO_CAUSES_COPY)
/mlir/lib/Dialect/Utils/StaticValueUtils.cpp: 143 in mlir::isEqualConstantIntOrValueArray(llvm::ArrayRefmlir::OpFoldResult, llvm::ArrayRefmlir::OpFoldResult)()
137 }
138
139 bool isEqualConstantIntOrValueArray(ArrayRef ofrs1,
140 ArrayRef ofrs2) {
141 if (ofrs1.size() != ofrs2.size())
142 return false;

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

143 for (auto [ofr1, ofr2] : llvm::zip_equal(ofrs1, ofrs2))
144 if (!isEqualConstantIntOrValue(ofr1, ofr2))
145 return false;
146 return true;
147 }
148

** CID 1505862: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 15456 in mlir::LLVM::LoadOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::Value, mlir::IntegerAttr, bool, bool, mlir::LLVM::AtomicOrdering, mlir::StringAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr)()


*** CID 1505862: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 15456 in mlir::LLVM::LoadOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::Value, mlir::IntegerAttr, bool, bool, mlir::LLVM::AtomicOrdering, mlir::StringAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr)()
15450 void LoadOp::build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type res, ::mlir::Value addr, /optional/::mlir::IntegerAttr alignment, /optional/bool volatile_, /optional/bool nontemporal, ::mlir::LLVM::AtomicOrdering ordering, /optional/::mlir::StringAttr syncscope, /optional/::mlir::ArrayAttr access_groups, /optional/::mlir::ArrayAttr alias_scopes, /optional/::mlir::ArrayAttr noalias_scopes, /optional/::mlir::ArrayAttr tbaa) {
15451 odsState.addOperands(addr);
15452 if (alignment) {
15453 odsState.addAttribute(getAlignmentAttrName(odsState.name), alignment);
15454 }
15455 if (volatile_) {

CID 1505862:  Control flow issues  (DEADCODE)
Execution cannot reach this statement: "<temporary>.UnitAttr(NULL);".

15456 odsState.addAttribute(getVolatile_AttrName(odsState.name), ((volatile_) ? odsBuilder.getUnitAttr() : nullptr));
15457 }
15458 if (nontemporal) {
15459 odsState.addAttribute(getNontemporalAttrName(odsState.name), ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr));
15460 }
15461 odsState.addAttribute(getOrderingAttrName(odsState.name), ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering));

** CID 1505861: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 3050 in mlir::amdgpu::RawBufferAtomicUminOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 3044 in mlir::amdgpu::RawBufferAtomicUminOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 3067 in mlir::amdgpu::RawBufferAtomicUminOp::verifyInvariantsImpl()()
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 3056 in mlir::amdgpu::RawBufferAtomicUminOp::verifyInvariantsImpl()()


*** CID 1505861: (AUTO_CAUSES_COPY)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 3050 in mlir::amdgpu::RawBufferAtomicUminOp::verifyInvariantsImpl()()
3044 for (auto v : valueGroup0) {
3045 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
3046 return ::mlir::failure();
3047 }
3048 auto valueGroup1 = getODSOperands(1);
3049

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

3050 for (auto v : valueGroup1) {
3051 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), “operand”, index++)))
3052 return ::mlir::failure();
3053 }
3054 auto valueGroup2 = getODSOperands(2);
3055
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 3044 in mlir::amdgpu::RawBufferAtomicUminOp::verifyInvariantsImpl()()
3038 if (::mlir::failed(__mlir_ods_local_attr_constraint_AMDGPU0(*this, tblgen_indexOffset, “indexOffset”)))
3039 return ::mlir::failure();
3040 {
3041 unsigned index = 0; (void)index;
3042 auto valueGroup0 = getODSOperands(0);
3043

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

3044 for (auto v : valueGroup0) {
3045 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
3046 return ::mlir::failure();
3047 }
3048 auto valueGroup1 = getODSOperands(1);
3049
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 3067 in mlir::amdgpu::RawBufferAtomicUminOp::verifyInvariantsImpl()()
3061
3062 if (valueGroup3.size() > 1) {
3063 return emitOpError(“operand group starting at #”) << index
3064 << " requires 0 or 1 element, but found " << valueGroup3.size();
3065 }
3066

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

3067 for (auto v : valueGroup3) {
3068 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
3069 return ::mlir::failure();
3070 }
3071 }
3072 return ::mlir::success();
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/AMDGPU/AMDGPU.cpp.inc: 3056 in mlir::amdgpu::RawBufferAtomicUminOp::verifyInvariantsImpl()()
3050 for (auto v : valueGroup1) {
3051 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU3(*this, v.getType(), “operand”, index++)))
3052 return ::mlir::failure();
3053 }
3054 auto valueGroup2 = getODSOperands(2);
3055

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

3056 for (auto v : valueGroup2) {
3057 if (::mlir::failed(__mlir_ods_local_type_constraint_AMDGPU4(*this, v.getType(), “operand”, index++)))
3058 return ::mlir::failure();
3059 }
3060 auto valueGroup3 = getODSOperands(3);
3061

** CID 1505860: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 15459 in mlir::LLVM::LoadOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::Value, mlir::IntegerAttr, bool, bool, mlir::LLVM::AtomicOrdering, mlir::StringAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr)()


*** CID 1505860: Control flow issues (DEADCODE)
/build-llvm/tools/clang/stage2-bins/tools/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.cpp.inc: 15459 in mlir::LLVM::LoadOp::build(mlir::OpBuilder &, mlir::OperationState &, mlir::Type, mlir::Value, mlir::IntegerAttr, bool, bool, mlir::LLVM::AtomicOrdering, mlir::StringAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr, mlir::ArrayAttr)()
15453 odsState.addAttribute(getAlignmentAttrName(odsState.name), alignment);
15454 }
15455 if (volatile_) {
15456 odsState.addAttribute(getVolatile_AttrName(odsState.name), ((volatile_) ? odsBuilder.getUnitAttr() : nullptr));
15457 }
15458 if (nontemporal) {

CID 1505860:  Control flow issues  (DEADCODE)
Execution cannot reach this statement: "<temporary>.UnitAttr(NULL);".

15459 odsState.addAttribute(getNontemporalAttrName(odsState.name), ((nontemporal) ? odsBuilder.getUnitAttr() : nullptr));
15460 }
15461 odsState.addAttribute(getOrderingAttrName(odsState.name), ::mlir::LLVM::AtomicOrderingAttr::get(odsBuilder.getContext(), ordering));
15462 if (syncscope) {
15463 odsState.addAttribute(getSyncscopeAttrName(odsState.name), syncscope);
15464 }

** CID 1505859: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Optimizer/Support/InternalNames.cpp: 40 in doAncestors[abi:cxx11](llvm::ArrayRefllvm::StringRef, llvm::ArrayRefllvm::StringRef, long)()


*** CID 1505859: Performance inefficiencies (AUTO_CAUSES_COPY)
/flang/lib/Optimizer/Support/InternalNames.cpp: 40 in doAncestors[abi:cxx11](llvm::ArrayRefllvm::StringRef, llvm::ArrayRefllvm::StringRef, long)()
34 std::string prefix;
35 const char *tag = “M”;
36 for (auto mod : modules) {
37 prefix.append(tag).append(mod.lower());
38 tag = “S”;
39 }

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

40 for (auto proc : procs)
41 prefix.append(“F”).append(proc.lower());
42 if (blockId)
43 prefix.append(“B”).append(std::to_string(blockId));
44 return prefix;
45 }


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