Skip to content

Commit b79ceaa

Browse files
authored
Fix coverity issues (#2504)
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent 700abe3 commit b79ceaa

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

third_party/intel/lib/Analysis/AxisInfo.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ class BinaryOpVisitorImpl : public AxisInfoVisitorImpl<OpTy> {
105105
AxisInfo
106106
getAxisInfo(OpTy op,
107107
ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override {
108-
auto lhsInfo = operands[0]->getValue();
109-
auto rhsInfo = operands[1]->getValue();
108+
const auto &lhsInfo = operands[0]->getValue();
109+
const auto &rhsInfo = operands[1]->getValue();
110110
auto rank = lhsInfo.getRank();
111111
assert(operands.size() == 2 && "Expected two operands");
112112
AxisInfo::DimVectorT contiguity;
@@ -658,8 +658,8 @@ class CmpOpAxisInfoVisitor final : public AxisInfoVisitorImpl<OpTy> {
658658
return AxisInfo();
659659
auto shape = resTy.getShape();
660660
short rank = resTy.getRank();
661-
auto lhsInfo = operands[0]->getValue();
662-
auto rhsInfo = operands[1]->getValue();
661+
const auto &lhsInfo = operands[0]->getValue();
662+
const auto &rhsInfo = operands[1]->getValue();
663663

664664
AxisInfo::DimVectorT contiguity, divisibility, constancy;
665665
std::optional<int64_t> constantValue;
@@ -782,8 +782,8 @@ class SelectOpAxisInfoVisitor final : public AxisInfoVisitorImpl<OpTy> {
782782
getAxisInfo(OpTy op,
783783
ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override {
784784
auto condConstancy = operands[0]->getValue().getConstancy();
785-
auto lhsInfo = operands[1]->getValue();
786-
auto rhsInfo = operands[2]->getValue();
785+
const auto &lhsInfo = operands[1]->getValue();
786+
const auto &rhsInfo = operands[2]->getValue();
787787
auto rank = lhsInfo.getRank();
788788

789789
AxisInfo::DimVectorT contiguity, divisibility, constancy;
@@ -967,8 +967,8 @@ class MaxMinOpAxisInfoVisitor final : public AxisInfoVisitorImpl<OpTy> {
967967
AxisInfo
968968
getAxisInfo(OpTy op,
969969
ArrayRef<const dataflow::Lattice<AxisInfo> *> operands) override {
970-
auto lhsInfo = operands[0]->getValue();
971-
auto rhsInfo = operands[1]->getValue();
970+
const auto &lhsInfo = operands[0]->getValue();
971+
const auto &rhsInfo = operands[1]->getValue();
972972
auto rank = lhsInfo.getRank();
973973
std::optional<int64_t> constantValue;
974974
if (lhsInfo.getConstantValue().has_value() &&
@@ -1140,8 +1140,8 @@ LogicalResult AxisInfoAnalysis::visitOperation(
11401140

11411141
void AxisInfoAnalysis::visitForOpInductionVar(
11421142
scf::ForOp op, ArrayRef<dataflow::Lattice<AxisInfo> *> argLattices) {
1143-
auto lb = getLatticeElementFor(op, op.getLowerBound())->getValue();
1144-
auto step = getLatticeElementFor(op, op.getStep())->getValue();
1143+
const auto &lb = getLatticeElementFor(op, op.getLowerBound())->getValue();
1144+
const auto &step = getLatticeElementFor(op, op.getStep())->getValue();
11451145

11461146
AxisInfo::DimVectorT knownContiguity(1, 1);
11471147
AxisInfo::DimVectorT knownDivisibility(1, 1);
@@ -1337,7 +1337,7 @@ void ModuleAxisInfoAnalysis::initialize(FunctionOpInterface funcOp) {
13371337
return;
13381338
auto *axisInfoMap = getFuncData(funcOp);
13391339
auto updateAxisInfoMap = [&](Value value) {
1340-
auto axisInfo = analysis->getLatticeElement(value)->getValue();
1340+
const auto &axisInfo = analysis->getLatticeElement(value)->getValue();
13411341
AxisInfo curAxisInfo;
13421342
if (axisInfoMap->count(value)) {
13431343
curAxisInfo = AxisInfo::join(axisInfo, axisInfoMap->lookup(value));

0 commit comments

Comments
 (0)