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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 21 14:55:48 PDT 2021


nikic added a comment.

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.



================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:10468
+      if (StepCst && (AddRec->getNoWrapFlags(SCEV::FlagNSW) ||
+                      AddRec->getNoWrapFlags(SCEV::FlagNUW))) {
+        if (!StepCst->getValue()->isNegative()) {
----------------
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).


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

https://reviews.llvm.org/D100566



More information about the llvm-commits mailing list