SuccessChanges

Summary

  1. [SimplifyLibCalls] Take size of int into consideration when emitting ldexp/ldexpf (details)
  2. [LegalizeTypes] Avoid promotion of exponent in FPOWI (details)
  3. [CodeGen] Refactor libcall lookups for RTLIB::POWI_* (details)
  4. [InstCombine][msp430] Pre-commit test case for @llvm.powi and 16-bit ints (details)
  5. [SimpleLoopUnswitch] Port partially invariant unswitch from LoopUnswitch to SimpleLoopUnswitch (details)
  6. Add a toplevel .mailmap file (details)
  7. [mailmap] Use my chromium address as my canonical email address (details)
  8. [AMDGPU][Libomptarget][NFC] Remove atmi_place_t (details)
  9. [lld/mac] Implement -reexport_framework, -reexport_library, -reexport-l (details)
  10. [AMDGPU][Libomptarget][NFC] Remove bunch of dead structs (details)
  11. [AArch64] Optimise bitreverse lowering in ISel (details)
Commit 9c54ee437898314f956cfc048d9038ca775ea692 by bjorn.a.pettersson
[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
The file was modifiedllvm/test/Transforms/InstCombine/pow_fp_int.ll
The file was modifiedllvm/include/llvm/Analysis/TargetLibraryInfo.h
The file was modifiedllvm/test/Transforms/InstCombine/simplify-libcalls.ll
The file was modifiedllvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
The file was modifiedllvm/lib/Analysis/TargetLibraryInfo.cpp
The file was modifiedllvm/test/Transforms/InstCombine/exp2-1.ll
Commit d1273d39d377dffeab684ca58176302dbad6c629 by bjorn.a.pettersson
[LegalizeTypes] Avoid promotion of exponent in FPOWI

The FPOWI DAG node is normally lowered to a libcall to one of the
RTLIB::POWI* runtime functions and the exponent should normally
have a type matching sizeof(int) when making the call. Thus,
type promotion of the exponent could lead to an FPOWI with a type
for the second operand that would be incorrect when doing the
libcall (a situation which would be hard to detect post-legalization
if we allow such FPOWI nodes).

This patch is changing DAGTypeLegalizer::PromoteIntOp_FPOWI to
do the rewrite into a libcall directly instead of promoting the
operand. This way we can check that the exponent is smaller than
sizeof(int) and we can let TargetLowering handle promotion as
part of making the libcall. It could be noticed here that makeLibCall
has some knowledge about targets such as 64-bit RISCV, for which the
libcall argument should be extended to a type larger than sizeof(int).

Differential Revision: https://reviews.llvm.org/D102950
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Commit 536e02a23c6555403a844810a42d2f32b7e59d63 by bjorn.a.pettersson
[CodeGen] Refactor libcall lookups for RTLIB::POWI_*

Use RuntimeLibcalls to get a common way to pick correct RTLIB::POWI_*
libcall for a given value type.

This includes a small refactoring of ExpandFPLibCall and
ExpandArgFPLibCall in SelectionDAGLegalize to share a bit of code,
plus adding an ExpandFPLibCall version that can be called directly
when expanding FPOWI/STRICT_FPOWI to ensure that we actually use
the same RTLIB::Libcall when expanding the libcall as we used when
checking the legality of such a call by doing a getLibcallName check.

Differential Revision: https://reviews.llvm.org/D103050
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
The file was modifiedllvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
The file was modifiedllvm/include/llvm/CodeGen/RuntimeLibcalls.h
The file was modifiedllvm/lib/CodeGen/TargetLoweringBase.cpp
Commit fe208a4ef449d6e917dc5695ba793f4428980de3 by bjorn.a.pettersson
[InstCombine][msp430] Pre-commit test case for @llvm.powi and 16-bit ints

This is a pre-commit of a test case D99439 which is a patch that
updates @llvm.powi to handle different int sizes for the exponent.

Problem is that @llvm.powi is used as an IR construct that maps
to RT libcalls to __powi* functions, and those lib functions depend
on sizeof(int) to use correct type for the exponent.

The test cases show that we use i32 for the powi expenent, which
later would result in wrong type being used in libcalls (miscompile).

But there are also a couple of the negative test cases that show
that we rewrite into using powi when having a uitofp conversion
from i16, which would be wrong when doing the libcall as an
"unsigned int" isn't guaranteed to fit inside the "int" argument
in the called libcall function.

Differential Revision: https://reviews.llvm.org/D102919
The file was addedllvm/test/Transforms/InstCombine/pow_fp_int16.ll
Commit f3a27511c9f820f12a16445a7c130cb34693608d by jingu.kang
[SimpleLoopUnswitch] Port partially invariant unswitch from LoopUnswitch to SimpleLoopUnswitch

This re-enables commit 107d19eb017ff6734986af077eb2e9f6600114a9 with bug fixes.

Differential Revision: https://reviews.llvm.org/D99354
The file was modifiedllvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
The file was addedllvm/test/Transforms/SimpleLoopUnswitch/partial-unswitch-mssa-threshold.ll
The file was addedllvm/test/Transforms/SimpleLoopUnswitch/partial-unswitch-update-memoryssa.ll
The file was addedllvm/test/Transforms/SimpleLoopUnswitch/endless-unswitch.ll
The file was modifiedllvm/test/Transforms/SimpleLoopUnswitch/partial-unswitch.ll
Commit 39b3c00ec33f50837d9fe52b0b56c7d11eff377f by thakis
Add a toplevel .mailmap file

See "Proposal: Adding a toplevel .mailmap file" on llvm-dev:
https://lists.llvm.org/pipermail/llvm-dev/2021-May/150741.html

Differential Revision: https://reviews.llvm.org/D103360
The file was added.mailmap
Commit e008d0123c5cbc224e0ef2392482a94c96783694 by thakis
[mailmap] Use my chromium address as my canonical email address
The file was modified.mailmap
Commit 2368170a8d943a32f4024db1b830c8301df67b7f by Pushpinder.Singh
[AMDGPU][Libomptarget][NFC] Remove atmi_place_t

atmi_place_t has been replaced with int DeviceId.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D103508
The file was modifiedopenmp/libomptarget/plugins/amdgpu/impl/machine.h
The file was modifiedopenmp/libomptarget/plugins/amdgpu/impl/atmi.h
The file was modifiedopenmp/libomptarget/plugins/amdgpu/impl/system.cpp
The file was modifiedopenmp/libomptarget/plugins/amdgpu/impl/rt.h
The file was modifiedopenmp/libomptarget/plugins/amdgpu/impl/atmi_runtime.h
The file was modifiedopenmp/libomptarget/plugins/amdgpu/src/rtl.cpp
Commit 78ce89bb1e8049e81aea3e374feab4f5900d257c by thakis
[lld/mac] Implement -reexport_framework, -reexport_library, -reexport-l

These are slightly easier-to-use versions of -sub_library and -sub_umbrella.

Differential Revision: https://reviews.llvm.org/D103497
The file was modifiedlld/MachO/Driver.cpp
The file was modifiedlld/MachO/Options.td
The file was modifiedlld/test/MachO/sub-library.s
Commit b25546a4b40675b596dcfdbfd491b10fa12d88e6 by Pushpinder.Singh
[AMDGPU][Libomptarget][NFC] Remove bunch of dead structs

Dropped structs are atmi_machine_t, atmi_device_t and atmi_memory_t

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D103509
The file was modifiedopenmp/libomptarget/plugins/amdgpu/impl/atmi.h
The file was modifiedopenmp/libomptarget/plugins/amdgpu/impl/system.cpp
Commit e971099a9b9b83680d9fa85b7b3b4a1e5f37a845 by irina.dobrescu
[AArch64] Optimise bitreverse lowering in ISel

Differential Revision: https://reviews.llvm.org/D103105
The file was modifiedllvm/test/CodeGen/AArch64/neon_rbit.ll
The file was modifiedllvm/test/CodeGen/AArch64/bitreverse.ll
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.h
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.cpp