[Flang] Change fir.divc to perform library call rather than generate inline operations.
authorSacha Ballantyne <Sacha.Ballantyne@arm.com>
Fri, 10 Mar 2023 16:53:01 +0000 (16:53 +0000)
committerSacha Ballantyne <Sacha.Ballantyne@arm.com>
Tue, 4 Apr 2023 16:09:21 +0000 (16:09 +0000)
commita7bb8e273f433cceeb547e87d04114178573496a
tree5980c88c2de818f364ae336aec586794fd159fee
parent0109f8d1e3bf64e4b23db6e2f284185207e46541
[Flang] Change fir.divc to perform library call rather than generate inline operations.

Currently `fir.divc` is always lowered to a sequence of llvm operations to perform complex division, however this causes issues for extreme values when the calculations overflow. While this behaviour would be fine at -Ofast, this is currently the default at all levels.

This patch changes `fir.divc` to lower to a library call instead, except for when KIND=3 as there is no appropriate library call for this case.

Reviewed By: vzakhari

Differential Revision: https://reviews.llvm.org/D145808
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/test/Fir/convert-to-llvm.fir