Skip to content

Commit 2f6c890

Browse files
make replace function more compact
1 parent 13802d4 commit 2f6c890

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,13 +494,11 @@ class SparseInsertGenerator
494494
TensorType rtp;
495495
void replaceWithUnderscore(std::string &lvlType) {
496496
for (auto it = lvlType.begin(); it != lvlType.end();) {
497-
if (*it == '(') {
497+
if (*it == '(' || *it == ',') {
498498
*it = '_';
499499
} else if (*it == ')' || *it == ' ') {
500500
it = lvlType.erase(it);
501501
continue;
502-
} else if (*it == ',') {
503-
*it = '_';
504502
}
505503
it++;
506504
}

0 commit comments

Comments
 (0)