[all-commits] [llvm/llvm-project] 913141: [AArch64][GlobalISel] Fix nonterminating legalizat...

Amara Emerson via All-commits all-commits at lists.llvm.org
Fri Apr 17 14:49:24 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 913141e63916622ec63c8670584eb6f71403ff84
      https://github.com/llvm/llvm-project/commit/913141e63916622ec63c8670584eb6f71403ff84
  Author: Amara Emerson <amara at apple.com>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    M llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
    M llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.h
    M llvm/test/CodeGen/AArch64/arm64-zip.ll
    M llvm/test/CodeGen/AArch64/dup.ll
    M llvm/test/CodeGen/AArch64/vec-combine-compare-to-bitmask.ll

  Log Message:
  -----------
  [AArch64][GlobalISel] Fix nonterminating legalization for <8 x s4> vectors. (#192747)

G_CONCAT_VECTORS with <16 x s4> sources hits the bitcast legalization
path, which round-trips through scalar types (e.g. s32) and regenerates
<8 x s4> vectors via G_UNMERGE_VALUES and G_BUILD_VECTOR. The
G_BUILD_VECTOR is then widened to <8 x s8> (via .minScalarOrElt(0, s8)),
producing G_ANYEXT/G_TRUNC artifact pairs. The artifact combiner folds
these pairs away, restoring the original <8 x s4> types, which feeds
back into G_CONCAT_VECTORS again.

This change:
 * Adds .minScalarOrElt(1, s8) to the G_ICMP rules to ensure operand
vector elements are at least s8. This causes <16 x s4> operands to be
widened
to <16 x s8>, and the result type follows via minScalarEltSameAs.

* Add custom legalization for G_CONCAT_VECTORS when element size < 8.
The custom handler widens source operands via G_ANYEXT (e.g.
<8 x s4> -> <8 x s8>), concats the widened vectors (producing a
legal type like <16 x s8>), and truncs the result back to the
original type.

The code is bad but we can fix that later, some fallbacks are fixed with
this.

rdar://153760145



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list