[clang] [CIR] Upstream TernaryOp for VectorType (PR #142393)

Henrich Lauko via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 2 11:32:05 PDT 2025


================
@@ -1589,6 +1589,24 @@ LogicalResult cir::VecShuffleDynamicOp::verify() {
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// VecTernaryOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult cir::VecTernaryOp::verify() {
+  // Verify that the condition operand has the same number of elements as the
+  // other operands.  (The automatic verification already checked that all
+  // operands are vector types and that the second and third operands are the
+  // same type.)
+  if (mlir::cast<cir::VectorType>(getCond().getType()).getSize() !=
+      getVec1().getType().getSize()) {
+    return emitOpError() << ": the number of elements in "
+                         << getCond().getType() << " and "
+                         << getVec1().getType() << " don't match";
+  }
+  return success();
+}
----------------
xlauko wrote:

No need for verifier, operation already checks that all types are equal.

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


More information about the cfe-commits mailing list