[AArch64][GlobalISel] Make G_PTRTOINT only legal for s64 + p0
authorJessica Paquette <jpaquette@apple.com>
Wed, 28 Sep 2022 23:20:24 +0000 (16:20 -0700)
committerJessica Paquette <jpaquette@apple.com>
Wed, 28 Sep 2022 23:20:24 +0000 (16:20 -0700)
commit95dabac7a5adf62af5c43863e7bf6db5d4437b72
tree63f934a568ac08bab0b5287007375abca603c27d
parentf49887f7fd3cec483a9938610d7db1d32ddd005b
[AArch64][GlobalISel] Make G_PTRTOINT only legal for s64 + p0

A few issues:

  1. There was no legalizer test for G_PTRTOINT
  2. Same clamping issue as in many other opcodes
  3. AArch64 pointers can only be 64b, so in reality we always have to trunc or
     extend with any size other than p0 anyway.

This seems to actually produce more correct selection for narrow types as well.

Differential Revision: https://reviews.llvm.org/D107588
llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-exceptions.ll
llvm/test/CodeGen/AArch64/GlobalISel/legalize-ptrtoint.mir
llvm/test/CodeGen/AArch64/GlobalISel/select-int-ptr-casts.mir