[PATCH] D38072: [SimplifyIndvar] Replace the srem used by IV if we can prove both of its operands are non-negative

Hongbin Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 10:51:42 PDT 2017


etherzhhb added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyIndVar.cpp:340
+                                   const SCEV *SD) {
+  if (!SE->isKnownNonNegative(SN) || !SE->isKnownNonNegative(SD))
+    return false;
----------------
sanjoy wrote:
> Can we share this work amongst the three helpers?  Something like:
> 
>  - Pass in `NumeratorNonNegative` and `DenominatorNonNegative` bools to this function, and only `NumeratorNonNegative` to the other two.
>  - Compute these bools in `simplifyIVRemainder` as needed
Sure, I will do this. I think this whole simplifyIVRemainder will not process if NumeratorNonNegative  is false, is that correct?


Repository:
  rL LLVM

https://reviews.llvm.org/D38072





More information about the llvm-commits mailing list