Use for statement directly as an operand instead of having it pretend to be an induction variable.
PiperOrigin-RevId: 206759180
diff --git a/lib/IR/AsmPrinter.cpp b/lib/IR/AsmPrinter.cpp
index 2e09850..1102559 100644
--- a/lib/IR/AsmPrinter.cpp
+++ b/lib/IR/AsmPrinter.cpp
@@ -552,8 +552,8 @@
case SSAValueKind::FnArgument:
id = nextFnArgumentID++;
break;
- case SSAValueKind::InductionVar:
- id = nextInductionVarID++;
+ case SSAValueKind::ForStmt:
+ id = nextLoopID++;
break;
}
valueIDs[value] = id;
@@ -599,7 +599,7 @@
/// This is the value ID for each SSA value in the current function.
DenseMap<const SSAValue *, unsigned> valueIDs;
unsigned nextValueID = 0;
- unsigned nextInductionVarID = 0;
+ unsigned nextLoopID = 0;
unsigned nextFnArgumentID = 0;
};
} // end anonymous namespace
@@ -900,9 +900,7 @@
if (stmt->getNumResults() != 0)
printer->numberValueID(stmt->getResult(0));
}
- void visitForStmt(ForStmt *stmt) {
- printer->numberValueID(stmt->getInductionVar());
- }
+ void visitForStmt(ForStmt *stmt) { printer->numberValueID(stmt); }
MLFunctionPrinter *printer;
};
@@ -948,7 +946,7 @@
void MLFunctionPrinter::print(const ForStmt *stmt) {
os.indent(numSpaces) << "for ";
- printOperand(stmt->getInductionVar());
+ printOperand(stmt);
os << " = " << *stmt->getLowerBound();
os << " to " << *stmt->getUpperBound();
if (stmt->getStep()->getValue() != 1)