[flang-commits] [flang] [mlir] [mlir][flang] Added Weighted[Region]BranchOpInterface's. (PR #142079)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Tue Jun 10 22:08:24 PDT 2025
================
@@ -375,6 +375,114 @@ def SelectLikeOpInterface : OpInterface<"SelectLikeOpInterface"> {
];
}
+//===----------------------------------------------------------------------===//
+// WeightedBranchOpInterface
+//===----------------------------------------------------------------------===//
+
+def WeightedBranchOpInterface : OpInterface<"WeightedBranchOpInterface"> {
+ let description = [{
+ This interface provides weight information for branching terminator
+ operations, i.e. terminator operations with successors.
+
+ This interface provides methods for getting/setting integer non-negative
+ weight of each branch. The probability of executing a branch
+ is computed as the ratio between the branch's weight and the total
+ sum of the weights.
+ The number of weights must match the number of successors of the operation,
+ with one exception for CallOpInterface operations, which may only
----------------
vzakhari wrote:
I believe this is exploited by LLVM dialect tests. Since I replaced the LLVM interface with this one, we have to support this case, e.g. coming from importing LLVM IR.
I can probably do not import the weight from such LLVM IR, and remove this relaxation of the constraint. This seems to affect the current way LLVM IR/Dialect work, so would that be okay to change that in a follow-up PR?
https://github.com/llvm/llvm-project/pull/142079
More information about the flang-commits
mailing list