Skip to content

Commit 046ab0e

Browse files
authored
[NFC] Simplify populating axisinfo map (#8800)
A default constructed `AxisInfo` passed as an operand to `AxisInfo::join` will always result in `join` returning the other operand. This means that we can call `join` unconditionally even when there is no existing entry in the map. This collapses the three separate map lookups (the check, the join, and the population) to just a single one.
1 parent 4cf9906 commit 046ab0e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/Analysis/AxisInfo.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,13 +1350,8 @@ void ModuleAxisInfoAnalysis::initialize(FunctionOpInterface funcOp,
13501350
// pessimistic state.
13511351
if (axisInfo.getRank() == 0)
13521352
axisInfo = AxisInfo::getPessimisticValueState(value);
1353-
AxisInfo curAxisInfo;
1354-
if (axisInfoMap->count(value)) {
1355-
curAxisInfo = AxisInfo::join(axisInfo, axisInfoMap->lookup(value));
1356-
} else {
1357-
curAxisInfo = axisInfo;
1358-
}
1359-
(*axisInfoMap)[value] = curAxisInfo;
1353+
auto &valInfo = (*axisInfoMap)[value];
1354+
valInfo = AxisInfo::join(axisInfo, valInfo);
13601355
};
13611356
funcOp.walk([&](Operation *op) {
13621357
for (auto value : op->getResults()) {

0 commit comments

Comments
 (0)