[PATCH] D12073: Make ScalarEvolution::isKnownPredicate a little smarter

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 13:01:35 PDT 2015


sanjoy requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:7357
@@ +7356,3 @@
+    return false;
+  if (LAR->getLoop() != RAR->getLoop())
+    return false;
----------------
Optional: I'd have just folded the null checks into this condition.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:7367
@@ +7366,3 @@
+  auto CheckWrap = [Pred](const SCEVAddRecExpr *AR) -> bool {
+    if (ICmpInst::getSignedPredicate(Pred) == Pred) {
+      if (!AR->getNoWrapFlags(SCEV::FlagNSW))
----------------
I'd use `CmpInst::isSigned(Pred)` here.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:7368
@@ +7367,3 @@
+    if (ICmpInst::getSignedPredicate(Pred) == Pred) {
+      if (!AR->getNoWrapFlags(SCEV::FlagNSW))
+        return false;
----------------
Why not `return AR->getNoWrapFlags(SCEV::FlagNSW);` here, and `return AR->getNoWrapFlags(SCEV::FlagNUW);` in the `else` block?


http://reviews.llvm.org/D12073





More information about the llvm-commits mailing list