[all-commits] [llvm/llvm-project] e44a30: [InstCombine] invert canonicalization of sext (x >...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Tue Jan 24 13:44:34 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e44a305690add9f759d2fba85827bca260c94b41
      https://github.com/llvm/llvm-project/commit/e44a305690add9f759d2fba85827bca260c94b41
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2023-01-24 (Tue, 24 Jan 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
    M llvm/test/Transforms/InstCombine/X86/x86-masked-memops.ll
    M llvm/test/Transforms/InstCombine/and.ll
    M llvm/test/Transforms/InstCombine/bitcast-inseltpoison.ll
    M llvm/test/Transforms/InstCombine/bitcast.ll
    M llvm/test/Transforms/InstCombine/icmp.ll
    M llvm/test/Transforms/InstCombine/overflow-mul.ll
    M llvm/test/Transforms/InstCombine/vec_sext.ll
    M llvm/test/Transforms/InstCombine/xor-ashr.ll
    M llvm/test/Transforms/InstCombine/xor.ll

  Log Message:
  -----------
  [InstCombine] invert canonicalization of sext (x > -1) --> not (ashr x)

https://alive2.llvm.org/ce/z/2iC4oB

This is similar to changes made for zext + lshr:
21d3871b7c90
6c39a3aae1dc

The existing fold did not account for extra uses, so we
see some instruction count reductions in the test diffs.

This is intended to improve analysis (icmp likely has more
transforms than any other opcode), make other transforms
more symmetric with zext/lshr, and it can be inverted
in codegen if profitable.

As with the earlier changes, there is potential to uncover
infinite combine loops, but I have not found any yet.




More information about the All-commits mailing list