1+ // ====- GotoSolver.cpp -----------------------------------===//
2+ //
3+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+ // See https://llvm.org/LICENSE.txt for license information.
5+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+ //
7+ // ===----------------------------------------------------------------------===//
18#include " PassDetail.h"
29#include " clang/CIR/Dialect/IR/CIRDialect.h"
310#include " clang/CIR/Dialect/Passes.h"
@@ -10,13 +17,11 @@ using namespace cir;
1017namespace {
1118
1219struct GotoSolverPass : public GotoSolverBase <GotoSolverPass> {
13-
1420 GotoSolverPass () = default ;
1521 void runOnOperation () override ;
1622};
1723
1824static void process (cir::FuncOp func) {
19-
2025 mlir::OpBuilder rewriter (func.getContext ());
2126 llvm::StringMap<Block *> labels;
2227 llvm::SmallVector<cir::GotoOp, 4 > gotos;
@@ -35,14 +40,14 @@ static void process(cir::FuncOp func) {
3540 mlir::OpBuilder::InsertionGuard guard (rewriter);
3641 rewriter.setInsertionPoint (goTo);
3742 Block *dest = labels[goTo.getLabel ()];
38- rewriter. create < cir::BrOp>( goTo.getLoc (), dest);
43+ cir::BrOp::create (rewriter, goTo.getLoc (), dest);
3944 goTo.erase ();
4045 }
4146}
4247
4348void GotoSolverPass::runOnOperation () {
4449 llvm::TimeTraceScope scope (" Goto Solver" );
45- getOperation ()->walk ([&](cir::FuncOp op) { process (op); } );
50+ getOperation ()->walk (& process);
4651}
4752
4853} // namespace
0 commit comments