[PATCH] D44001: [SCEV] Prove implications for SCEVUnknown Phis

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 03:34:56 PST 2018


mkazantsev created this revision.
mkazantsev added reviewers: sanjoy, skatkov, apilipenko, reames.

This patch teaches SCEV how to prove implications for SCEVUnknown nodes that are Phis.
If we need to prove `Pred` for `LHS, RHS`, and `LHS` is a Phi with possible incoming values
`L1, L2, ..., LN`, then if we prove `Pred` for `(L1, RHS), (L2, RHS), ..., (LN, RHS)` then we can also
prove it for `(LHS, RHS)`. If both `LHS` and `RHS` are Phis from the same block, it is sufficient
to prove the predicate for values that come from the same predecessor block.

The typical case that it handles is that we sometimes need to prove that `Phi(Len, Len - 1) >= 0`
given that `Len > 0`. The new logic was added to `isImpliedViaOperations` and only uses it and
non-recursive reasoning to prove the facts we need, so it should not hurt compile time a lot.


https://reviews.llvm.org/D44001

Files:
  include/llvm/Analysis/ScalarEvolution.h
  lib/Analysis/ScalarEvolution.cpp
  test/Transforms/IRCE/decrementing-loop.ll
  test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44001.136709.patch
Type: text/x-patch
Size: 10177 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180302/5bd69228/attachment.bin>


More information about the llvm-commits mailing list