[PATCH] D142542: [InstSimplify] Simplify icmp between Left-Shifted VScale Calls

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 09:31:19 PST 2023


spatel added a comment.

To generalize the pattern, you probably want to use isKnownNonZero() to check that the shifted value always has some bits set. That function appears to already know that the result of a vscale call is always non zero. 
The simplest regression test to verify that would include an `or` with constant to set some bit(s).

The larger shift needs to have "nuw" (don't shift out any set bits) to guarantee that an unsigned comparison holds; "nuw" and "nsw" are needed to reduce a signed comparison?
Here's a generalized proof for 'ugt':
https://alive2.llvm.org/ce/z/Q6J6qn
You'd need to adapt that for each predicate to make sure we have the right constraints on the transform.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142542



More information about the llvm-commits mailing list