[all-commits] [llvm/llvm-project] 5a6e08: [InstCombine] reduce code duplication; NFC

Sanjay Patel via All-commits all-commits at lists.llvm.org
Fri May 27 08:54:36 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5a6e0857577e6dafb03716cfd47fa319441691dc
      https://github.com/llvm/llvm-project/commit/5a6e0857577e6dafb03716cfd47fa319441691dc
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-05-27 (Fri, 27 May 2022)

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

  Log Message:
  -----------
  [InstCombine] reduce code duplication; NFC


  Commit: b5b6aa4d53407ff1f7805fc000def63669d64a9f
      https://github.com/llvm/llvm-project/commit/b5b6aa4d53407ff1f7805fc000def63669d64a9f
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-05-27 (Fri, 27 May 2022)

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

  Log Message:
  -----------
  [InstCombine] fold multiply by signbit-splat to cmp+select

(ashr i32 X, 31) * C --> (X < 0) ? -C : 0
https://alive2.llvm.org/ce/z/G8u9SS

With a constant operand, this is an improvement in IR
and codegen (where it can be converted to a mask op).

Without a constant operand, we would have to negate
the operand, so that is probably better left to the backend.

This is similar but not the same optimization that is requested
in #55618.


Compare: https://github.com/llvm/llvm-project/compare/e917801eddbe...b5b6aa4d5340


More information about the All-commits mailing list