[all-commits] [llvm/llvm-project] fcf945: [DAG] Fold add(mul(add(A, CA), CM), CB) -> add(mul...

David Green via All-commits all-commits at lists.llvm.org
Wed May 8 14:11:41 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fcf945f4edbad1f2d82df067c2826baa6165dd3e
      https://github.com/llvm/llvm-project/commit/fcf945f4edbad1f2d82df067c2826baa6165dd3e
  Author: David Green <david.green at arm.com>
  Date:   2024-05-08 (Wed, 08 May 2024)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AArch64/addimm-mulimm.ll

  Log Message:
  -----------
  [DAG] Fold add(mul(add(A, CA), CM), CB) -> add(mul(A, CM), CM*CA+CB) (#90860)

This is useful when the inner add has multiple uses, and so cannot be
canonicalized by pushing the constants down through the mul. This patch
adds patterns for both `add(mul(add(A, CA), CM), CB)` and with an extra add
`add(add(mul(add(A, CA), CM), B) CB)` as the second can come up when
lowering geps.



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