[all-commits] [llvm/llvm-project] 008a89: [InstCombine] fold udiv with common shl amount in ...

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


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 008a89037a49ca0d9ed85bb8548a048991ff133b
      https://github.com/llvm/llvm-project/commit/008a89037a49ca0d9ed85bb8548a048991ff133b
  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
    M llvm/test/Transforms/PhaseOrdering/reassociate-instcombine.ll

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

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

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

This fixes the motivating example from issue #58137,
but it is not the most general transform. We should
probably also convert left-shift in the divisor to
right-shift in the dividend for that, but that exposes
another missed canonicalization for shifts and adds.




More information about the All-commits mailing list