[PATCH] D124369: [InstCombine] C0 >>{ashr, exact} (X - C1) --> (C0 << C1) >>{ashr} X

Nicolas Abram via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 11:21:20 PDT 2022


nico-abram added a comment.

In D124369#3471465 <https://reviews.llvm.org/D124369#3471465>, @spatel wrote:

> 1. Please write a more general proof for these transforms. See examples in the comments here: https://github.com/llvm/llvm-project/issues/54890
> 2. Does the lshr transform require "exact" or not?

Is this enough proof for the ashr case? https://alive2.llvm.org/ce/z/iLuDyE

I don't think the lshr without exact is correct (It becomes more poisonous according to alive2), and it looks like we can only do it for positive numbers (which makes sense to me): https://alive2.llvm.org/ce/z/sRq7w9

Will modify to add the correct conditions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124369/new/

https://reviews.llvm.org/D124369



More information about the llvm-commits mailing list