[PATCH] D69918: [CR][WIP] Add `subWithNoWrap()` method

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 6 13:56:30 PST 2019


nikic added inline comments.


================
Comment at: llvm/lib/IR/ConstantRange.cpp:924
+    APInt NewMax = getUnsignedMax().usub_ov(Other.getUnsignedMin(), Overflow);
+    if (Overflow)
+      return getEmpty();
----------------
As we're not using the NewMax result here (doesn't this warn?) you might want to write this as `if (getUnsignedMax().ult(Other.getUnsignedMin()))`, as the overflow condition for usub is trivial...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69918





More information about the llvm-commits mailing list