[PATCH] D58329: [ValueTracking] Known bits support for unsigned saturating add/sub

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 19 07:00:49 PST 2019


spatel added inline comments.


================
Comment at: lib/Analysis/ValueTracking.cpp:1540-1546
+        bool IsAdd = II->getIntrinsicID() == Intrinsic::uadd_sat;
+        KnownBits ExtLHS = Known.zext(BitWidth + 1);
+        ExtLHS.Zero.setSignBit();
+        KnownBits ExtRHS = Known2.zext(BitWidth + 1);
+        ExtRHS.Zero.setSignBit();
+        KnownBits ExtRes = KnownBits::computeForAddSub(
+            IsAdd, /* NSW */ false, ExtLHS, ExtRHS);
----------------
This is more accurate than what we currently do in computeOverflowForUnsignedAdd(), right? Can we adjust that existing API to use this method and then call it?



Repository:
  rL LLVM

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

https://reviews.llvm.org/D58329





More information about the llvm-commits mailing list