[PATCH] D65017: [InstCombine] Teach foldOrOfICmps to allow icmp eq MIN_INT/MAX to be part of a range comparision. Similar for foldAndOfICmps

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 12:07:15 PDT 2019


craig.topper marked an inline comment as done.
craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:1226-1229
+      // X u> 13 & X != UINT_MAX -> (X-14) u< UINT_MAX-14
+      if (RHSC->isMaxValue(false))
+        return insertRangeTest(LHS0, LHSC->getValue() + 1, RHSC->getValue(),
+                               false, true);
----------------
lebedev.ri wrote:
> Update comment please: `X u> 13 & X != UINT_MAX -> (X-(C+1)) u< UINT_MAX-(C+1)`
> https://rise4fun.com/Alive/qt2, ok
> Comment does not specify the precondition that `C != UINT_MAX`
> I'm guessing that case is handled elsewhere?
There's an earlier assert above this switch that says LHSC != RHSC which would ensure C can't be UINT_MAX.


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

https://reviews.llvm.org/D65017





More information about the llvm-commits mailing list