[flang-commits] [flang] [Flang] Canonicalize divdc3 calls into arithmetic-based complex division (PR #146017)
via flang-commits
flang-commits at lists.llvm.org
Fri Jun 27 03:44:32 PDT 2025
Hanwen-ece wrote:
> Thank you for working on this!
>
> Actually, we've been discussing a similar feature on Discourse. You can refer to it here if you're interested: (https://discourse.llvm.org/t/optimization-of-complex-number-division/83468)
>
> I'm currently working on a feature based on the discussion at the end of that thread, and I plan to post the patch next week. In that patch, specifying the newly added driver option `-fcomplex-arithmetic=basic` will allow complex number division to be expanded into a algebraic formula instead of using a runtime function.
Thank you for the heads-up, and it’s great to hear that we’re thinking along the same lines—seems like a case of great minds thinking alike!
It’s truly sweet to see that others have been independently thinking along similar lines—clearly, this is an area worth optimizing. I found the discussion quite illuminating and it actually informed some aspects of the design in my implementation.
I’ve recently finished implementing and submitted a patch that addresses this very optimization. It supports expanding complex division algebraically without relying on the runtime function, and it could potentially serve the same goal as the one you’re working on.
Of course, I’d be happy to hear your thoughts or suggestions—collaboration always leads to better outcomes. But perhaps this patch could save you some effort and serve as a starting point or even a complete solution.
Thanks again for the discussion link, I’d be very glad to receive any suggestions or feedback. I really appreciate the collaborative spirit in this community! Have a wonderful day :)
https://github.com/llvm/llvm-project/pull/146017
More information about the flang-commits
mailing list