[PATCH] D100566: [SCEV] Add a ad-hoc pattern on isImpliedCondBalancedTypes

JinGu Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 02:40:37 PDT 2021


jaykang10 added a comment.

In D100566#2706635 <https://reviews.llvm.org/D100566#2706635>, @nikic wrote:

> This needs better test coverage for the various conditions in the code, like step sign, nowrap flags, possibly predicates. Either as IR test cases, or as unit tests.

@nikic I appreciate your comments. I have updated the predicates and added unit tests for them. Please check it.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:10468
+      if (StepCst && (AddRec->getNoWrapFlags(SCEV::FlagNSW) ||
+                      AddRec->getNoWrapFlags(SCEV::FlagNUW))) {
+        if (!StepCst->getValue()->isNegative()) {
----------------
nikic wrote:
> As you are working with signed predicates here, you need nsw. nuw is not enough. Of course, you could handle the analogous case with unsigned predicates, in which case you need nuw (and only nuw, the step sign doesn't matter in that case).
You are right! I will update it.


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

https://reviews.llvm.org/D100566



More information about the llvm-commits mailing list