[clang] [CIR] Fold ComplexRealOp from ComplexCreateOp (PR #147592)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 9 07:50:27 PDT 2025


================
@@ -2066,6 +2066,11 @@ LogicalResult cir::ComplexRealOp::verify() {
 }
 
 OpFoldResult cir::ComplexRealOp::fold(FoldAdaptor adaptor) {
+  if (auto complexCreateOp = dyn_cast_or_null<cir::ComplexCreateOp>(
+          getOperand().getDefiningOp())) {
+    return complexCreateOp.getOperand(0);
+  }
----------------
bcardosolopes wrote:

Curly braces not needed

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


More information about the cfe-commits mailing list