[all-commits] [llvm/llvm-project] a2963d: [SDAG] fold sub-of-shift to add-of-shift

Sanjay Patel via All-commits all-commits at lists.llvm.org
Fri Feb 18 08:56:08 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a2963d871ee5c2786de409b42f67ffcc39e53184
      https://github.com/llvm/llvm-project/commit/a2963d871ee5c2786de409b42f67ffcc39e53184
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-02-18 (Fri, 18 Feb 2022)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/AArch64/srem-seteq-vec-splat.ll
    M llvm/test/CodeGen/X86/combine-srem.ll
    M llvm/test/CodeGen/X86/imul.ll
    M llvm/test/CodeGen/X86/srem-seteq-vec-splat.ll

  Log Message:
  -----------
  [SDAG] fold sub-of-shift to add-of-shift

This fold is done in IR:
https://alive2.llvm.org/ce/z/jWyFrP

There is an x86 test that shows an improvement
from the added flexibility of using add (commutative).

The other diffs are presumed neutral.

Note that this could also be folded to an 'xor',
but I'm not sure if that would be universally better
(eg, x86 can convert adds more easily into LEA).

This helps prevent regressions from a potential fold for
issue #53829.




More information about the All-commits mailing list