[PATCH] D12745: [IndVars] Widen more comparisons for non-negative induction vars.

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 10:21:01 PDT 2015


reames added inline comments.

================
Comment at: lib/Transforms/Scalar/IndVarSimplify.cpp:1267
@@ -1247,1 +1266,3 @@
+                                       SE->getConstant(AddRec->getType(), 0));
+
   // Widen the induction variable expression.
----------------
p.s. A follow on change which would be good would be to use NeverNegative to set IsSigned.  (Either value is legal, I think treating it as unsigned would be more canonical.)  This would remove the order of visit dependency in the common case and help create a single canonical form.  

When you do this, you'll need to adjust some of the extension elimination logic to account for when a sext and zext are interchangable.  

Once that's done, we can canonicalize all sext on non-negative indvars to zext.  Arguably, that could be done instead of adjusting the cast removal logic mentioned previously.  


http://reviews.llvm.org/D12745





More information about the llvm-commits mailing list