From 968ff81f8ab38d9b244e506677f5baad5b52ada9 Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Thu, 17 Oct 2024 09:56:54 +0000 Subject: [PATCH] Fix coverity issues Signed-off-by: Anatoly Myachev --- third_party/intel/lib/Analysis/AxisInfo.cpp | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/third_party/intel/lib/Analysis/AxisInfo.cpp b/third_party/intel/lib/Analysis/AxisInfo.cpp index f3b09b450a..aeb8e12b5b 100644 --- a/third_party/intel/lib/Analysis/AxisInfo.cpp +++ b/third_party/intel/lib/Analysis/AxisInfo.cpp @@ -105,8 +105,8 @@ class BinaryOpVisitorImpl : public AxisInfoVisitorImpl { AxisInfo getAxisInfo(OpTy op, ArrayRef *> operands) override { - auto lhsInfo = operands[0]->getValue(); - auto rhsInfo = operands[1]->getValue(); + const auto &lhsInfo = operands[0]->getValue(); + const auto &rhsInfo = operands[1]->getValue(); auto rank = lhsInfo.getRank(); assert(operands.size() == 2 && "Expected two operands"); AxisInfo::DimVectorT contiguity; @@ -658,8 +658,8 @@ class CmpOpAxisInfoVisitor final : public AxisInfoVisitorImpl { return AxisInfo(); auto shape = resTy.getShape(); short rank = resTy.getRank(); - auto lhsInfo = operands[0]->getValue(); - auto rhsInfo = operands[1]->getValue(); + const auto &lhsInfo = operands[0]->getValue(); + const auto &rhsInfo = operands[1]->getValue(); AxisInfo::DimVectorT contiguity, divisibility, constancy; std::optional constantValue; @@ -782,8 +782,8 @@ class SelectOpAxisInfoVisitor final : public AxisInfoVisitorImpl { getAxisInfo(OpTy op, ArrayRef *> operands) override { auto condConstancy = operands[0]->getValue().getConstancy(); - auto lhsInfo = operands[1]->getValue(); - auto rhsInfo = operands[2]->getValue(); + const auto &lhsInfo = operands[1]->getValue(); + const auto &rhsInfo = operands[2]->getValue(); auto rank = lhsInfo.getRank(); AxisInfo::DimVectorT contiguity, divisibility, constancy; @@ -967,8 +967,8 @@ class MaxMinOpAxisInfoVisitor final : public AxisInfoVisitorImpl { AxisInfo getAxisInfo(OpTy op, ArrayRef *> operands) override { - auto lhsInfo = operands[0]->getValue(); - auto rhsInfo = operands[1]->getValue(); + const auto &lhsInfo = operands[0]->getValue(); + const auto &rhsInfo = operands[1]->getValue(); auto rank = lhsInfo.getRank(); std::optional constantValue; if (lhsInfo.getConstantValue().has_value() && @@ -1140,8 +1140,8 @@ LogicalResult AxisInfoAnalysis::visitOperation( void AxisInfoAnalysis::visitForOpInductionVar( scf::ForOp op, ArrayRef *> argLattices) { - auto lb = getLatticeElementFor(op, op.getLowerBound())->getValue(); - auto step = getLatticeElementFor(op, op.getStep())->getValue(); + const auto &lb = getLatticeElementFor(op, op.getLowerBound())->getValue(); + const auto &step = getLatticeElementFor(op, op.getStep())->getValue(); AxisInfo::DimVectorT knownContiguity(1, 1); AxisInfo::DimVectorT knownDivisibility(1, 1); @@ -1337,7 +1337,7 @@ void ModuleAxisInfoAnalysis::initialize(FunctionOpInterface funcOp) { return; auto *axisInfoMap = getFuncData(funcOp); auto updateAxisInfoMap = [&](Value value) { - auto axisInfo = analysis->getLatticeElement(value)->getValue(); + const auto &axisInfo = analysis->getLatticeElement(value)->getValue(); AxisInfo curAxisInfo; if (axisInfoMap->count(value)) { curAxisInfo = AxisInfo::join(axisInfo, axisInfoMap->lookup(value));