[all-commits] [llvm/llvm-project] 301350: [GlobalISel] [AArch64] Skip redundant shift amount...

Deepak Shirke via All-commits all-commits at lists.llvm.org
Thu Oct 1 05:33:33 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3013507d8e702c40d0ee1ac1ee4d551742092fa8
      https://github.com/llvm/llvm-project/commit/3013507d8e702c40d0ee1ac1ee4d551742092fa8
  Author: Deepak Shirke <deepakshirke509 at gmail.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:

  Log Message:
  -----------
  [GlobalISel] [AArch64] Skip redundant shift amount masking during isel (#223136)

AArch64 shift instructions (LSL/LSR/ASR) only use the low 5 bits (i32)or
6 bits (i64) of the shift amount. When the shift amount is masked with
an AND that was introduced by legalization of a narrow type zext, or is
a G_ZEXT itself, the operation is redundant and can be skipped during
instruction selection.

This mirrors what AArch64DAGToDAGISel::tryShiftAmountMod does for
SelectionDAG, bringing GlobalISel to parity for i32 shift amounts with
narrow shift amount types (i8, i16).

Before (GlobalISel shl i32 with i8 shift amount):
  and w8, w1, #0xff
  lsl w0, w0, w8

After (matches SelectionDAG):
  lsl w0, w0, w1

Part of the incremental work tracked in
https://github.com/llvm/llvm-project/issues/224245 to replace
tryShiftAmountMod with ComplexPattern-based isel.



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