Skip to content

Commit b17f3c6

Browse files
authored
[NFC][MLIR] Add {} for else when if body has {} (llvm#139422)
1 parent 6d11b17 commit b17f3c6

File tree

16 files changed

+34
-20
lines changed

16 files changed

+34
-20
lines changed

mlir/lib/Analysis/Presburger/IntegerRelation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2398,8 +2398,9 @@ bool IntegerRelation::removeDuplicateConstraints() {
23982398
addEquality(getInequality(k));
23992399
removeInequality(k);
24002400
removeInequality(l);
2401-
} else
2401+
} else {
24022402
*this = getEmpty(getSpace());
2403+
}
24032404
break;
24042405
}
24052406

mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,9 @@ class VectorReductionOpConversion
896896
} else if (kind == vector::CombiningKind::MAXNUMF) {
897897
result = createFPReductionComparisonOpLowering<LLVM::vector_reduce_fmax>(
898898
rewriter, loc, llvmType, operand, acc, fmf);
899-
} else
899+
} else {
900900
return failure();
901+
}
901902

902903
rewriter.replaceOp(reductionOp, result);
903904
return success();

mlir/lib/Dialect/Affine/Analysis/LoopAnalysis.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,9 @@ std::optional<uint64_t> mlir::affine::getConstantTripCount(AffineForOp forOp) {
233233
std::min(*tripCount, static_cast<uint64_t>(constExpr.getValue()));
234234
else
235235
tripCount = constExpr.getValue();
236-
} else
236+
} else {
237237
return std::nullopt;
238+
}
238239
}
239240
return tripCount;
240241
}

mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4327,8 +4327,9 @@ void ElementwiseOp::regionBuilder(ImplicitLocOpBuilder &b, Block &block,
43274327
result = helper.buildTernaryFn(kind.ternaryFn, block.getArgument(0),
43284328
block.getArgument(1), block.getArgument(2));
43294329

4330-
} else
4330+
} else {
43314331
assert(false && "found unhandled category in elemwise");
4332+
}
43324333

43334334
yields.push_back(result);
43344335
helper.yieldOutputs(yields);

mlir/lib/Dialect/Mesh/Interfaces/ShardingInterface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ checkOperandAffineExprRecursively(AffineExpr expr,
5757
} else if (rhs.getKind() == AffineExprKind::DimId &&
5858
lhs.getKind() == AffineExprKind::Constant) {
5959
dimExpr = rhs;
60-
} else
60+
} else {
6161
return failure();
62+
}
6263
unsigned position = cast<AffineDimExpr>(dimExpr).getPosition();
6364
if ((size_t)position >= seenIds.size() || seenIds[position])
6465
return failure();

mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,9 @@ static ParseResult parseClauseWithRegionArgs(
662662
parser.parseInteger(mapIndicesVec.emplace_back()) ||
663663
parser.parseRSquare())
664664
return failure();
665-
} else
665+
} else {
666666
mapIndicesVec.push_back(-1);
667+
}
667668
}
668669

669670
return success();

mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,9 +594,10 @@ transform::LoopFuseSiblingOp::apply(transform::TransformRewriter &rewriter,
594594
} else if (isForallWithIdenticalConfiguration(target, source)) {
595595
fusedLoop = fuseIndependentSiblingForallLoops(
596596
cast<scf::ForallOp>(target), cast<scf::ForallOp>(source), rewriter);
597-
} else
597+
} else {
598598
return emitSilenceableFailure(target->getLoc())
599599
<< "operations cannot be fused";
600+
}
600601

601602
assert(fusedLoop && "failed to fuse operations");
602603

mlir/lib/Dialect/SCF/Transforms/LoopPipelining.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,9 @@ scf::ForOp LoopPipelinerInternal::createKernelLoop(
417417
[maxStage - defStage->second];
418418
assert(valueVersion);
419419
newLoopArg.push_back(valueVersion);
420-
} else
420+
} else {
421421
newLoopArg.push_back(forOp.getInitArgs()[retVal.index()]);
422+
}
422423
}
423424
for (auto escape : crossStageValues) {
424425
LiverangeInfo &info = escape.second;

mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ static bool haveNoReadsAfterWriteExceptSameIndex(
124124
OperationEquivalence::Flags::IgnoreLocations)) {
125125
return WalkResult::interrupt();
126126
}
127-
} else
127+
} else {
128128
return WalkResult::interrupt();
129+
}
129130
}
130131
}
131132
return WalkResult::advance();

mlir/lib/Dialect/XeGPU/Transforms/XeGPUSubgroupDistribute.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ void LayoutInfo::print(raw_ostream &os) const {
157157
laneLayout.print(os);
158158
os << ", lane_data: ";
159159
laneData.print(os);
160-
} else
160+
} else {
161161
os << "Not assigned.";
162+
}
162163
}
163164

164165
LayoutInfo LayoutInfo::meet(const LayoutInfo &lhs, const LayoutInfo &rhs) {

0 commit comments

Comments
 (0)