[all-commits] [llvm/llvm-project] 831b9a: [AArch64][GISel] Don't pointlessly lower G_TRUNC (...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Feb 13 11:52:11 PST 2024


  Branch: refs/heads/release/18.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 831b9a5db2b7be590dcb09d0bf909ba37765a70b
      https://github.com/llvm/llvm-project/commit/831b9a5db2b7be590dcb09d0bf909ba37765a70b
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
    M llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
    M llvm/test/CodeGen/AArch64/GlobalISel/legalize-xtn.mir

  Log Message:
  -----------
  [AArch64][GISel] Don't pointlessly lower G_TRUNC (#81479)

If we have something like G_TRUNC from v2s32 to v2s16, then lowering
this to a concat of two G_TRUNC s32 to s16 followed by G_TRUNC from
v2s16 to v2s8 does not bring us any closer to legality. In fact, the
first part of that is a G_BUILD_VECTOR whose legalization will produce a
new G_TRUNC from v2s32 to v2s16, and both G_TRUNCs will then get
combined to the original, causing a legalization cycle.

Make the lowering condition more precise, by requiring that the original
vector is >128 bits, which is I believe the only case where this
specific splitting approach is useful.

Note that this doesn't actually produce a legal result (the alwaysLegal
is a lie, as before), but it will cause a proper globalisel abort
instead of an infinite legalization loop.

Fixes https://github.com/llvm/llvm-project/issues/81244.

(cherry picked from commit 070848c17c2944afa494d42d3ad42929f3379842)




More information about the All-commits mailing list