[PATCH] D13687: [SCEV] Opportunistically interpret unsigned constraints as signed

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 13:56:46 PDT 2015


sanjoy added inline comments.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:7455
@@ -7454,1 +7454,3 @@
 
+static CmpInst::Predicate GetSignedPredicate(CmpInst::Predicate P) {
+  switch (P) {
----------------
reames wrote:
> I'm pretty sure this function already exists somewhere.  If it doesn't, it should be a utility on ICmpInst or something.
Moved to `CmpInst::getSignedPredicate`.

================
Comment at: lib/Analysis/ScalarEvolution.cpp:7534
@@ -7514,1 +7533,3 @@
 
+  // Unsigned comparison is the same as signed comparison when both the operands
+  // are non-negative.
----------------
reames wrote:
> This code is obviously correct, but it only handles one of the two cases immediately above it.  I'd suggest in a separate change, pulling out the two cases above into a lambda, and then calling it twice, once with FoundPred, once with the signed compare if legal.  
Good idea, I'll make a follow up patch doing this.


http://reviews.llvm.org/D13687





More information about the llvm-commits mailing list