Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,14 +630,16 @@ DoWhileLowering::matchAndRewrite(WhileOp whileOp,
// Loop around the "before" region based on condition.
rewriter.setInsertionPointToEnd(before);
auto condOp = cast<ConditionOp>(before->getTerminator());
rewriter.replaceOpWithNewOp<cf::CondBranchOp>(condOp, condOp.getCondition(),
before, condOp.getArgs(),
continuation, ValueRange());
rewriter.create<cf::CondBranchOp>(condOp.getLoc(), condOp.getCondition(),
before, condOp.getArgs(), continuation,
ValueRange());

// Replace the op with values "yielded" from the "before" region, which are
// visible by dominance.
rewriter.replaceOp(whileOp, condOp.getArgs());

// Erase the condition op.
rewriter.eraseOp(condOp);
return success();
}

Expand Down
Loading