Skip to content

Commit

Permalink
clang-format ...
Browse files Browse the repository at this point in the history
  • Loading branch information
gitoleg committed Apr 23, 2024
1 parent 0a7ce23 commit 44c77ef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ mlir::LogicalResult CIRGenFunction::buildGotoStmt(const GotoStmt &S) {
mlir::Block *currBlock = builder.getBlock();
mlir::Block *gotoBlock = currBlock;
if (!currBlock->empty() &&
currBlock->back().hasTrait<mlir::OpTrait::IsTerminator>()) {
currBlock->back().hasTrait<mlir::OpTrait::IsTerminator>()) {
gotoBlock = builder.createBlock(builder.getBlock()->getParent());
builder.setInsertionPointToEnd(gotoBlock);
}
Expand Down
7 changes: 4 additions & 3 deletions clang/lib/CIR/Dialect/IR/CIRDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1985,7 +1985,8 @@ ParseResult cir::FuncOp::parse(OpAsmParser &parser, OperationState &state) {
state.addAttribute(getExtraAttrsAttrName(state.name), extraAttrs);

auto hasLabelsNameAttr = getGlobalDtorAttrName(state.name);
if (::mlir::succeeded(parser.parseOptionalKeyword(hasLabelsNameAttr.strref())))
if (::mlir::succeeded(
parser.parseOptionalKeyword(hasLabelsNameAttr.strref())))
state.addAttribute(hasLabelsNameAttr, parser.getBuilder().getUnitAttr());

// Parse the optional function body.
Expand Down Expand Up @@ -3079,8 +3080,8 @@ LogicalResult BinOp::verify() {
//===----------------------------------------------------------------------===//

LogicalResult LabelOp::verify() {
auto* op = getOperation();
auto* blk = op->getBlock();
auto *op = getOperation();
auto *blk = op->getBlock();
if (&blk->front() != op)
return emitError() << "LabelOp must be the first operation in a block";
return mlir::success();
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/Dialect/Transforms/FlattenCFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class CIRLoopOpInterfaceFlattening
});

// Lower optional body region yield.
for (auto& blk : op.getBody().getBlocks()) {
for (auto &blk : op.getBody().getBlocks()) {
auto bodyYield = dyn_cast<mlir::cir::YieldOp>(blk.getTerminator());
if (bodyYield)
lowerTerminator(bodyYield, (step ? step : cond), rewriter);
Expand Down
19 changes: 9 additions & 10 deletions clang/lib/CIR/Dialect/Transforms/GotoSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ struct GotoSolverPass : public GotoSolverBase<GotoSolverPass> {
};

static void process(mlir::cir::FuncOp func) {

mlir::OpBuilder rewriter(func.getContext());
std::map<std::string, Block*> labels;
std::map<std::string, Block *> labels;
std::vector<mlir::cir::GotoOp> gotos;

func.getBody().walk([&](mlir::Operation* op) {
func.getBody().walk([&](mlir::Operation *op) {
if (auto lab = dyn_cast<mlir::cir::LabelOp>(op)) {
labels.emplace(lab.getLabel().str(), lab->getBlock());
lab.erase();
Expand All @@ -40,19 +40,18 @@ static void process(mlir::cir::FuncOp func) {
rewriter.create<mlir::cir::BrOp>(goTo.getLoc(), dest);
goTo.erase();
}

}

void GotoSolverPass::runOnOperation() {
SmallVector<Operation *, 16> ops;
getOperation()->walk([&](mlir::cir::FuncOp op) {
if (op.getHasLabels())
process(op);
});
SmallVector<Operation *, 16> ops;
getOperation()->walk([&](mlir::cir::FuncOp op) {
if (op.getHasLabels())
process(op);
});
}

} // namespace

std::unique_ptr<Pass> mlir::createGotoSolverPass() {
return std::make_unique<GotoSolverPass>();
return std::make_unique<GotoSolverPass>();
}

0 comments on commit 44c77ef

Please sign in to comment.