[PATCH] D139683: [APInt] provide a safe API for zext value and sext value.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 01:00:42 PST 2022


RKSimon added inline comments.


================
Comment at: llvm/include/llvm/ADT/APInt.h:1522
+  std::optional<int64_t> trySExtValue() const {
+    return (getActiveBits() <= 64) ? std::optional<int64_t>(getSExtValue())
+                                   : std::optional<int64_t>();
----------------
RKSimon wrote:
> RKSimon wrote:
> > getSignificantBits - you might need to alter the unit test as 'all bits' representations will safely truncate to -1
> getActiveBits ->getSignificantBits 
Still needs to be converted to getSignificantBits to match getSExtValue


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139683



More information about the llvm-commits mailing list