[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
Sun Dec 11 02:32:44 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>();
----------------
getSignificantBits - you might need to alter the unit test as 'all bits' representations will safely truncate to -1


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