We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1d3a335 commit 296cc29Copy full SHA for 296cc29
lib/Tools/LinearLayout.cpp
@@ -1088,7 +1088,16 @@ LinearLayout LinearLayout::removeZeroBasesAlongDim(StringAttr stripDim) const {
1088
}
1089
1090
1091
- return LinearLayout(std::move(result), llvm::to_vector(getOutDimNames()));
+ SmallVector<std::pair<StringAttr, int32_t>> newOutDimSizes;
1092
+ for (auto outDim : getOutDimNames()) {
1093
+ newOutDimSizes.push_back({outDim, getOutDimSize(outDim)});
1094
+ }
1095
+ auto newLayout = LinearLayout(std::move(result), ArrayRef(newOutDimSizes),
1096
+ NoCheckInvariants{});
1097
+ assert(
1098
+ newLayout.isSurjective() == this->isSurjective() &&
1099
+ "Removing zero bases along a dimension should not change surjectivity");
1100
+ return newLayout;
1101
1102
1103
size_t hash_value(const LinearLayout &layout) {
0 commit comments