diff options
author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2021-03-26 12:49:38 +0100 |
---|---|---|
committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2021-06-02 11:40:34 +0200 |
commit | 9c54ee437898314f956cfc048d9038ca775ea692 (patch) | |
tree | 207c6db189ee64f93a245c612f1c42d4e83b3995 /llvm/lib/CodeGen/TargetLoweringBase.cpp | |
parent | 942be7cb4d98eb1fa0ffdc5d122e8c931cbc4cd6 (diff) | |
download | llvm-9c54ee437898314f956cfc048d9038ca775ea692.zip llvm-9c54ee437898314f956cfc048d9038ca775ea692.tar.gz llvm-9c54ee437898314f956cfc048d9038ca775ea692.tar.bz2 |
[SimplifyLibCalls] Take size of int into consideration when emitting ldexp/ldexpf
When rewriting
powf(2.0, itofp(x)) -> ldexpf(1.0, x)
exp2(sitofp(x)) -> ldexp(1.0, sext(x))
exp2(uitofp(x)) -> ldexp(1.0, zext(x))
the wrong type was used for the second argument in the ldexp/ldexpf
libc call, for target architectures with 16 bit "int" type.
The transform incorrectly used a bitcasted function pointer with
a 32-bit argument when emitting the ldexp/ldexpf call for such
targets.
The fault is solved by using the correct function prototype
in the call, by asking TargetLibraryInfo about the size of "int".
TargetLibraryInfo by default derives the size of the int type by
assuming that it is 16 bits for 16-bit architectures, and
32 bits otherwise. If this isn't true for a target it should be
possible to override that default in the TargetLibraryInfo
initializer.
Differential Revision: https://reviews.llvm.org/D99438
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringBase.cpp')
0 files changed, 0 insertions, 0 deletions