[all-commits] [llvm/llvm-project] 7b9482: [InstCombine] fold sdiv with common shl amount in ...

Sanjay Patel via All-commits all-commits at lists.llvm.org
Wed Oct 12 08:32:31 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7b9482df3dde2395608e0d0744c05bff22cff39e
      https://github.com/llvm/llvm-project/commit/7b9482df3dde2395608e0d0744c05bff22cff39e
  Author: Sanjay Patel <spatel at rotateright.com>
  Date:   2022-10-12 (Wed, 12 Oct 2022)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/test/Transforms/InstCombine/div-shift.ll

  Log Message:
  -----------
  [InstCombine] fold sdiv with common shl amount in operands

(X << Z) / (Y << Z) --> X / Y

https://alive2.llvm.org/ce/z/CLKzqT

This requires a surprising "nuw" constraint because we have
to guard against immediate UB via signed-div overflow with
-1 divisor.

This extends 008a89037a49ca0d9 and is another transform
derived from issue #58137.




More information about the All-commits mailing list