[all-commits] [llvm/llvm-project] 50000e: [InstCombine] create helper function for mul patte...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Sat Oct 29 09:52:31 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 50000ec2cb16a2f7c157164858ae10074064c1ee
      https://github.com/llvm/llvm-project/commit/50000ec2cb16a2f7c157164858ae10074064c1ee
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-10-29 (Sat, 29 Oct 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp

  Log Message:
  -----------
  [InstCombine] create helper function for mul patterns with 1<<X; NFC

There are at least 2 other potential patterns that could go here.


  Commit: 6064e92b0a84b6d52b25ab1e6da90e74c76c6eb0
      https://github.com/llvm/llvm-project/commit/6064e92b0a84b6d52b25ab1e6da90e74c76c6eb0
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-10-29 (Sat, 29 Oct 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/test/Transforms/InstCombine/mul.ll

  Log Message:
  -----------
  [InstCombine] fold mul with incremented "shl 1" factor

X * ((1 << Z) + 1) --> (X << Z) + X

https://alive2.llvm.org/ce/z/P-7WK9

It's possible that we could do better with propagating
no-wrap, but this carries over the existing logic and
appears to be correct.

The naming differences on the existing folds are a result
of using getName() to set the final value via Builder.
That makes it easier to transfer no-wrap rather than the
gymnastics required from the raw create instruction APIs.


Compare: https://github.com/llvm/llvm-project/compare/d9fdc84da704...6064e92b0a84


More information about the All-commits mailing list