[flang-commits] [flang] [mlir] [mlir][flang] Added Weighted[Region]BranchOpInterface's. (PR #142079)

Christian Ulmann via flang-commits flang-commits at lists.llvm.org
Tue Jun 3 23:00:02 PDT 2025


================
@@ -80,6 +81,49 @@ detail::verifyBranchSuccessorOperands(Operation *op, unsigned succNo,
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// WeightedBranchOpInterface
+//===----------------------------------------------------------------------===//
+
+static LogicalResult verifyWeights(Operation *op, DenseI32ArrayAttr weights,
+                                   int64_t weightsNum,
+                                   llvm::StringRef weightAnchorName,
+                                   llvm::StringRef weightRefName) {
+  if (weights) {
----------------
Dinistro wrote:

Nit: Swap condition to have an early return. This should reduce nesting and make it a bit easier to parse.

https://github.com/llvm/llvm-project/pull/142079


More information about the flang-commits mailing list