[clang] [CIR] Allow use different Int types together in Vec Shift Op (PR #141111)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu May 22 16:59:20 PDT 2025


================
@@ -1427,13 +1427,13 @@ OpFoldResult cir::SelectOp::fold(FoldAdaptor adaptor) {
 //===----------------------------------------------------------------------===//
 LogicalResult cir::ShiftOp::verify() {
   mlir::Operation *op = getOperation();
-  mlir::Type resType = getResult().getType();
   const bool isOp0Vec = mlir::isa<cir::VectorType>(op->getOperand(0).getType());
   const bool isOp1Vec = mlir::isa<cir::VectorType>(op->getOperand(1).getType());
   if (isOp0Vec != isOp1Vec)
     return emitOpError() << "input types cannot be one vector and one scalar";
-  if (isOp1Vec && op->getOperand(1).getType() != resType) {
-    return emitOpError() << "shift amount must have the type of the result "
+
+  if (isOp1Vec && !mlir::isa<cir::VectorType>(getResult().getType())) {
----------------
andykaylor wrote:

Is the requirement that the operands and the result must have the same size elements enforced somewhere else?

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


More information about the cfe-commits mailing list