[all-commits] [llvm/llvm-project] ebda06: [InstCombine] add test for sdiv with shl; NFC

Sanjay Patel via All-commits all-commits at lists.llvm.org
Sat Oct 8 07:19:20 PDT 2022


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

  Changed paths:
    M llvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll

  Log Message:
  -----------
  [InstCombine] add test for sdiv with shl; NFC


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
    M llvm/test/Transforms/InstCombine/sdiv-exact-by-power-of-two.ll

  Log Message:
  -----------
  [InstCombine] fold exact sdiv to ashr (2nd try)

The 1st attempt failed to updated the test checks as expected.

Original commit message:

sdiv exact X, (1<<ShAmt) --> ashr exact X, ShAmt (if shl is non-negative)

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

It would probably be better to use ValueTracking to replace this
and the existing transform above it, but the analysis does not
account for the no-wrap properly, and it's not immediately clear
to me how to fix it.


Compare: https://github.com/llvm/llvm-project/compare/68d4dbc2c17c...eccb9a77c6e4


More information about the All-commits mailing list