[clang] [CIR] Lower complex mul and div before callconv lowering (PR #216498)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 12:47:54 PDT 2026


================
@@ -184,6 +184,26 @@ def LoweringPrepare : Pass<"cir-lowering-prepare"> {
   let dependentDialects = ["cir::CIRDialect"];
 }
 
+def ComplexLowering : Pass<"cir-complex-lowering", "mlir::ModuleOp"> {
+  let summary = "Expand complex multiplication and division";
+  let description = [{
+    This pass replaces `cir.complex.mul` and `cir.complex.div` with the
+    arithmetic each one expands to, which for the full complex range is a call
+    to a runtime helper such as `__mulsc3` or `__divsc3`.
+
+    It runs before the calling-convention pass rather than alongside the rest
----------------
andykaylor wrote:

```suggestion
    It must be run before the calling-convention pass rather than alongside the rest
```

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


More information about the cfe-commits mailing list