[PATCH] D35107: Re-enable "[IndVars] Canonicalize comparisons between non-negative values and indvars"

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 7 05:43:19 PDT 2017


anna accepted this revision.
anna added a comment.
This revision is now accepted and ready to land.

LGTM.



================
Comment at: lib/Transforms/Utils/SimplifyIndVar.cpp:268
     ICmp->setOperand(1, NewRHS);
+  } else if (ICmpInst::isSigned(OriginalPred) &&
+             SE->isKnownNonNegative(S) && SE->isKnownNonNegative(X)) {
----------------
Could you please add a comment here why you're using the OriginalPred.
It seems useful to state it. 

Also,IIUC, doing this transform when Pred is swapped version of OriginalPred is error prone. We also need to check that IV is the second operand to avoid breaking canonicalization -- IV is always on the left. 


https://reviews.llvm.org/D35107





More information about the llvm-commits mailing list