[PATCH] D69006: [SCEV] Simplify umin/max of zext and sext of the same value

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 11:59:13 PDT 2019


nikic added a comment.

Could you please also include test coverage for the smin/smax case? Otherwise this looks good.



================
Comment at: lib/Analysis/ScalarEvolution.cpp:10344
+  switch (Pred) {
+  case ICmpInst::ICMP_SLE: {
+    // If operand >=s 0 then ZExt == SExt.  If operand <s 0 then SExt <u ZExt.
----------------
The implementation of `IsKnownPredicateViaMinOrMax()` canonicalizes ICMP_SGE/ICMP_UGE by swapping (and `isKnownPredicateViaNoOverflow()` does as well), so I would suggest including it here as well.

It doesn't matter for the min/max case as both orders are tried there, but generally this code doesn't seem to assume a particular predicate canonicalization.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69006/new/

https://reviews.llvm.org/D69006





More information about the llvm-commits mailing list