[PATCH] D35302: [IRCE] Recognize loops with unsigned latch conditions

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 10:07:28 PDT 2017

anna requested changes to this revision.
anna added a comment.
This revision now requires changes to proceed.

Couple of minor changes. I haven't looked at the tests yet.

Do you mind separating out the `ULT/ULE` changes from the `UGT/UGE` just for ease of reviewing? Once the first part is reviewed, the second would be pretty straightforward.

Comment at: lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:462
   bool IndVarIncreasing;
+  bool SignedPredicate;
Pls rename this as `isSignedPredicate`.

Comment at: lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:846
+    SignedPredicate = Pred == ICmpInst::ICMP_SLT || Pred == ICmpInst::ICMP_SGT;
+    ICmpInst::Predicate GuardPred =
+        SignedPredicate ? CmpInst::ICMP_SLT : CmpInst::ICMP_ULT;
Pls name this as the `PredOpCode`. I got confused with guards..

Comment at: lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp:978
-LoopConstrainer::calculateSubRanges() const {
+LoopConstrainer::calculateSubRanges(bool SignedPredicate) const {
   IntegerType *Ty = cast<IntegerType>(LatchTakenCount->getType());
This to `isSignedPredicate` as well. Similarly for all other booleans.


More information about the llvm-commits mailing list