[all-commits] [llvm/llvm-project] fe4dbb: [DAGCombiner] Fold add (mul x, C), x to mul x, C+1

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Apr 17 03:34:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fe4dbbb4671eea11f8aaae2f5f3b485128e8c411
      https://github.com/llvm/llvm-project/commit/fe4dbbb4671eea11f8aaae2f5f3b485128e8c411
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-04-17 (Mon, 17 Apr 2023)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AArch64/arm64-promote-const.ll
    M llvm/test/CodeGen/X86/add-of-mul.ll

  Log Message:
  -----------
  [DAGCombiner] Fold add (mul x, C), x to mul x, C+1

While this is normally non-canonical IR, this pattern can appear
during SDAG lowering if the add is actually a getelementptr, as
illustrated in `@test_ptr`. This pattern comes up when doing
provenance-aware high-bit pointer tagging.

Proof: https://alive2.llvm.org/ce/z/DLoEcs

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

Differential Revision: https://reviews.llvm.org/D148341




More information about the All-commits mailing list