Skip to content

Commit 8309a4f

Browse files
rebase and ensure flattened attr order
1 parent 4633236 commit 8309a4f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/tir/transforms/flatten_buffer.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,13 @@ class BufferFlattener : public StmtExprMutator {
9797
body = For(op->loop_var, std::move(min), std::move(extent), op->kind, std::move(body));
9898
}
9999
// Step 4. Handle annotations
100+
std::set<std::string> ordered_ann_keys;
100101
for (const auto& annotation : op->annotations) {
101-
const String& ann_key = annotation.first;
102-
const ObjectRef& ann_value = annotation.second;
102+
ordered_ann_keys.insert(annotation.first);
103+
}
104+
for (auto it = ordered_ann_keys.rbegin(); it != ordered_ann_keys.rend(); ++it) {
105+
const std::string& ann_key = *it;
106+
const ObjectRef& ann_value = op->annotations.at(ann_key);
103107
if (attr::IsPragmaKey(ann_key)) {
104108
body =
105109
AttrStmt(op->loop_var, ann_key, ConvertAttrValue(ann_key, ann_value), std::move(body));

0 commit comments

Comments
 (0)