[clang] [CIR] Upstream TernaryOp (PR #137184)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 24 15:39:03 PDT 2025
================
@@ -1058,6 +1058,48 @@ LogicalResult cir::BinOp::verify() {
return mlir::success();
}
+//===----------------------------------------------------------------------===//
+// TernaryOp
+//===----------------------------------------------------------------------===//
+
+/// Given the region at `index`, or the parent operation if `index` is None,
+/// return the successor regions. These are the regions that may be selected
+/// during the flow of control. `operands` is a set of optional attributes that
+/// correspond to a constant value for each operand, or null if that operand is
+/// not a constant.
+void cir::TernaryOp::getSuccessorRegions(
+ mlir::RegionBranchPoint point, SmallVectorImpl<RegionSuccessor> ®ions) {
+ // The `true` and the `false` region branch back to the parent operation.
+ if (!point.isParent()) {
+ regions.push_back(RegionSuccessor(this->getODSResults(0)));
+ return;
+ }
+
+ // If the condition isn't constant, both regions may be executed.
----------------
andykaylor wrote:
This comment seems to imply a constant check that isn't being performed.
https://github.com/llvm/llvm-project/pull/137184
More information about the cfe-commits
mailing list