[PATCH] D43507: [SCEV] Fix isKnownPredicate

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 20 03:37:07 PST 2018


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

IsKnownPredicate is updated to implement the following algorithm
proposed by @sanjoy and @mkazantsev :
isKnownPredicate(Pred, LHS, RHS) {

1. Collect set S all loops on which either LHS or RHS depend.
2. If S is non-empty a. Let PD be the element of S which is dominated by all other elements of S b. Let E(LHS) be value of LHS on entry of PD. To get E(LHS), we should just take LHS and replace all AddRecs that are attached to PD on with their entry values. Define E(RHS) in the same way. c. Let B(LHS) be value of L on backedge of PD. To get B(LHS), we should just take LHS and replace all AddRecs that are attached to PD on with their backedge values. Define B(RHS) in the same way. d. Note that E(LHS) and E(RHS) are automatically available on entry of PD, so we can assert on that. e. Return true if isLoopEntryGuardedByCond(Pred, E(LHS), E(RHS)) && isLoopBackedgeGuardedByCond(Pred, B(LHS), B(RHS))
3. Return true if Pred, L, R is known from ranges, splitting etc.

}
This is follow-up for https://reviews.llvm.org/D42417.


https://reviews.llvm.org/D43507

Files:
  lib/Analysis/ScalarEvolution.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43507.135039.patch
Type: text/x-patch
Size: 4432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180220/72a3731e/attachment.bin>


More information about the llvm-commits mailing list