Implement operands for the 'if' statement.
This CL also includes two other minor changes:
- change the implemented syntax from 'if (cond)' to 'if cond', as specified by MLIR spec.
- a minor fix to the implementation of the ForStmt.
PiperOrigin-RevId: 210618122
diff --git a/lib/IR/AsmPrinter.cpp b/lib/IR/AsmPrinter.cpp
index 2cc20ac..21dd4c6 100644
--- a/lib/IR/AsmPrinter.cpp
+++ b/lib/IR/AsmPrinter.cpp
@@ -186,7 +186,7 @@
}
void ModuleState::visitIfStmt(const IfStmt *ifStmt) {
- recordIntegerSetReference(ifStmt->getCondition());
+ recordIntegerSetReference(ifStmt->getIntegerSet());
for (auto &childStmt : *ifStmt->getThen())
visitStatement(&childStmt);
if (ifStmt->hasElse())
@@ -1406,9 +1406,11 @@
}
void MLFunctionPrinter::print(const IfStmt *stmt) {
- os.indent(numSpaces) << "if (";
- printIntegerSetReference(stmt->getCondition());
- os << ") {\n";
+ os.indent(numSpaces) << "if ";
+ IntegerSet *set = stmt->getIntegerSet();
+ printIntegerSetReference(set);
+ printDimAndSymbolList(stmt->getStmtOperands(), set->getNumDims());
+ os << " {\n";
print(stmt->getThen());
os.indent(numSpaces) << "}";
if (stmt->hasElse()) {