[PATCH] D82715: [LVI][CVP] Handle (x | y) < C style conditions

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 09:42:40 PDT 2020


spatel added inline comments.


================
Comment at: llvm/lib/Analysis/LazyValueInfo.cpp:1106
 
+  // If (x | y) < C, then (x < C) && (y < C).
+  if (match(LHS, m_c_Or(m_Specific(Val), m_Value())) &&
----------------
nikic wrote:
> spatel wrote:
> > These transforms only work when C is a low-bit mask or power-of-2 (depending on predicate)?
> > https://alive2.llvm.org/ce/z/pmF7PF
> Ah, to be clear, this is not an equivalence, only an implication. If `(x | y) < 9` we know that both `x < 9` and `y < 9`, but if we know that `x < 9` and `y < 9`, it does not follow that `(x | y) < 9` (which is what the alive proof is showing). Here, we only care about implication in one direction.
Modify/add tests with arbitrary constants to make that more obvious then? I missed the relationship because we're using '7' in all cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82715





More information about the llvm-commits mailing list