================
@@ -148,9 +148,10 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
   }
 
   mlir::Value createComplexReal(mlir::Location loc, mlir::Value operand) {
-    auto operandTy = mlir::cast<cir::ComplexType>(operand.getType());
-    return cir::ComplexRealOp::create(*this, loc, operandTy.getElementType(),
-                                      operand);
+    auto resultType = operand.getType();
+    if (mlir::isa<cir::ComplexType>(resultType))
+      resultType = mlir::cast<cir::ComplexType>(resultType).getElementType();
----------------
xlauko wrote:

```suggestion
    if (auto complexResultType = mlir::dyn_cast<cir::ComplexType>(resultType))
      resultType = complexResultType.getElementType();
```

https://github.com/llvm/llvm-project/pull/161080
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to