File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
mlir/lib/Dialect/SparseTensor/IR Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1142,16 +1142,18 @@ bool mlir::sparse_tensor::isBlockSparsity(AffineMap dimToLvl) {
1142
1142
auto pos = dimOp.getPosition ();
1143
1143
if (binOp.getKind () == AffineExprKind::FloorDiv) {
1144
1144
// Expect only one floordiv for each dimension.
1145
- if (coeffientMap.find (pos) != coeffientMap.end ())
1145
+ auto [it, inserted] = coeffientMap.try_emplace (pos);
1146
+ if (!inserted)
1146
1147
return false ;
1147
1148
// Record coefficient of the floordiv.
1148
- coeffientMap[pos] = conOp.getValue ();
1149
+ it-> second = conOp.getValue ();
1149
1150
} else if (binOp.getKind () == AffineExprKind::Mod) {
1150
1151
// Expect floordiv before mod.
1151
- if (coeffientMap.find (pos) == coeffientMap.end ())
1152
+ auto it = coeffientMap.find (pos);
1153
+ if (it == coeffientMap.end ())
1152
1154
return false ;
1153
1155
// Expect mod to have the same coefficient as floordiv.
1154
- if (conOp.getValue () != coeffientMap[pos] )
1156
+ if (conOp.getValue () != it-> second )
1155
1157
return false ;
1156
1158
hasBlock = true ;
1157
1159
} else {
You can’t perform that action at this time.
0 commit comments