[llvm-branch-commits] [clang] [CIR] Upstream ComplexImagPtrOp for ComplexType (PR #144236)
Henrich Lauko via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jul 11 07:29:14 PDT 2025
================
@@ -1775,6 +1775,44 @@ OpFoldResult cir::ComplexCreateOp::fold(FoldAdaptor adaptor) {
return cir::ConstComplexAttr::get(realAttr, imagAttr);
}
+//===----------------------------------------------------------------------===//
+// ComplexRealPtrOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult cir::ComplexRealPtrOp::verify() {
+ mlir::Type resultPointeeTy = getType().getPointee();
+ cir::PointerType operandPtrTy = getOperand().getType();
+ auto operandPointeeTy =
+ mlir::cast<cir::ComplexType>(operandPtrTy.getPointee());
+
+ if (resultPointeeTy != operandPointeeTy.getElementType()) {
+ emitOpError()
+ << "cir.complex.real_ptr result type does not match operand type";
+ return failure();
+ }
+
+ return success();
+}
+
+//===----------------------------------------------------------------------===//
+// ComplexImagPtrOp
+//===----------------------------------------------------------------------===//
+
+LogicalResult cir::ComplexImagPtrOp::verify() {
+ mlir::Type resultPointeeTy = getType().getPointee();
+ cir::PointerType operandPtrTy = getOperand().getType();
+ auto operandPointeeTy =
+ mlir::cast<cir::ComplexType>(operandPtrTy.getPointee());
+
+ if (resultPointeeTy != operandPointeeTy.getElementType()) {
+ emitOpError()
+ << "cir.complex.imag_ptr result type does not match operand type";
+ return failure();
----------------
xlauko wrote:
```suggestion
return emitOpError()
<< "cir.complex.imag_ptr result type does not match operand type";
```
https://github.com/llvm/llvm-project/pull/144236
More information about the llvm-branch-commits
mailing list