[all-commits] [llvm/llvm-project] 3a0dbf: [GISel] Handle Flags in G_PTR_ADD Combines

Fabian Ritter via All-commits all-commits at lists.llvm.org
Thu Aug 7 06:34:09 PDT 2025


  Branch: refs/heads/users/ritter-x2a/08-07-_gisel_handle_flags_in_g_ptr_add_combines
  Home:   https://github.com/llvm/llvm-project
  Commit: 3a0dbfa95fa603737b584855b08a565628350c01
      https://github.com/llvm/llvm-project/commit/3a0dbfa95fa603737b584855b08a565628350c01
  Author: Fabian Ritter <fabian.ritter at amd.com>
  Date:   2025-08-07 (Thu, 07 Aug 2025)

  Changed paths:
    M llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
    M llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
    M llvm/test/CodeGen/AArch64/GlobalISel/combine-ptradd-reassociation.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combine-ptr-add-chain.mir

  Log Message:
  -----------
  [GISel] Handle Flags in G_PTR_ADD Combines

So far, GlobalISel's G_PTR_ADD combines have ignored MIFlags like nuw, nusw,
and inbounds. That was in many cases unnecessarily conservative and in others
unsound, since reassociations re-used the existing G_PTR_ADD instructions
without invalidating their flags. This patch aims to improve that.

I've checked the transforms in this PR with Alive2 on corresponding middle-end
IR constructs.

A longer-term goal would be to encapsulate the logic that determines which
GEP/ISD::PTRADD/G_PTR_ADD flags can be preserved in which case, since this
occurs in similar forms in the middle end, the SelectionDAG combines, and the
GlobalISel combines here.

For SWDEV-516125.



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