diff options
author | Diana Picus <diana.picus@linaro.org> | 2022-10-11 12:38:08 +0000 |
---|---|---|
committer | Diana Picus <diana.picus@linaro.org> | 2022-10-21 09:09:25 +0000 |
commit | 36799dfd519ccaa1170efe36d907c0b513c50203 (patch) | |
tree | 897d3f23e6c1f93ab50a1509c229d35fe3346d5f /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | c8938809d155682ef5eec170897b8c26b8cbf3ea (diff) | |
download | llvm-36799dfd519ccaa1170efe36d907c0b513c50203.zip llvm-36799dfd519ccaa1170efe36d907c0b513c50203.tar.gz llvm-36799dfd519ccaa1170efe36d907c0b513c50203.tar.bz2 |
[flang] Rename hypotf on MSVC platforms
The single precision `hypot` intrinsic is lowered to a call to the libm
`hypotf` function. However, the MSVC runtime lacks a hypotf function
and instead uses `_hypotf` (*). This patch tries to find and rewrite
calls to `hypotf` if we're on a MSVC platform.
Calls to libm functions can be introduced even after lowering (**).
Therefore, we try to do the rewriting at the very end of FIR to LLVM
lowering.
Fixes https://github.com/llvm/llvm-project/issues/57563
(*) More specifically, MSVC's headers define hypotf as an inline
function that just calls _hypotf. This works fine for clang, since it
will include those headers, but flang only links with the CRT so we
don't get a free ride.
(**) https://github.com/llvm/llvm-project/blob/56f94ede2af9a327e59fe84dbf8cbbb7bb1dfa79/flang/lib/Optimizer/CodeGen/CodeGen.cpp#L3391
Differential Revision: https://reviews.llvm.org/D135853
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions