[mlir] Fix ReturnInst printing for zero operands

No longer prints a trailing ':'.

PiperOrigin-RevId: 207103812
This commit is contained in:
James Molloy 2018-08-02 08:28:20 -07:00 committed by jpienaar
parent 2a003256ae
commit 6472f5fbbb
2 changed files with 4 additions and 3 deletions

View File

@ -945,9 +945,10 @@ void CFGFunctionPrinter::print(const CondBranchInst *inst) {
void CFGFunctionPrinter::print(const ReturnInst *inst) {
os << "return";
if (inst->getNumOperands() != 0)
os << ' ';
if (inst->getNumOperands() == 0)
return;
os << ' ';
interleaveComma(inst->getOperands(),
[&](const CFGValue *operand) { printValueID(operand); });
os << " : ";

View File

@ -85,7 +85,7 @@ cfgfunc @simpleCFGUsingBBArgs(i32, i64) {
bb42 (%arg0: i32, %f: i64):
// CHECK: "bar"(%arg1) : (i64) -> (i1, i1, i1)
%2 = "bar"(%f) : (i64) -> (i1,i1,i1)
// CHECK: return
// CHECK: return{{$}}
return
// CHECK: }
}