[llvm] 1feed66 - [APInt] Remove truncOrSelf, zextOrSelf and sextOrSelf

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 02:01:58 PDT 2022


Author: Jay Foad
Date: 2022-06-07T10:01:49+01:00
New Revision: 1feed6691a2755609cc954a05d0405e8080118c4

URL: https://github.com/llvm/llvm-project/commit/1feed6691a2755609cc954a05d0405e8080118c4
DIFF: https://github.com/llvm/llvm-project/commit/1feed6691a2755609cc954a05d0405e8080118c4.diff

LOG: [APInt] Remove truncOrSelf, zextOrSelf and sextOrSelf

Differential Revision: https://reviews.llvm.org/D125559

Added: 
    

Modified: 
    llvm/include/llvm/ADT/APInt.h
    llvm/lib/Support/APInt.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 45d32e1c1e495..5d8ae2794ce90 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -1261,18 +1261,6 @@ class LLVM_NODISCARD APInt {
   /// extended, truncated, or left alone to make it that width.
   APInt zextOrTrunc(unsigned width) const;
 
-  /// Truncate this APInt if necessary to ensure that its bit width is <= \p
-  /// width.
-  [[deprecated("Use trunc instead")]] APInt truncOrSelf(unsigned width) const;
-
-  /// Sign-extend this APInt if necessary to ensure that its bit width is >= \p
-  /// width.
-  [[deprecated("Use sext instead")]] APInt sextOrSelf(unsigned width) const;
-
-  /// Zero-extend this APInt if necessary to ensure that its bit width is >= \p
-  /// width.
-  [[deprecated("Use zext instead")]] APInt zextOrSelf(unsigned width) const;
-
   /// @}
   /// \name Bit Manipulation Operators
   /// @{

diff  --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index ca8e8a53f37ee..acc68fe0be957 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -1007,24 +1007,6 @@ APInt APInt::sextOrTrunc(unsigned width) const {
   return *this;
 }
 
-APInt APInt::truncOrSelf(unsigned width) const {
-  if (BitWidth > width)
-    return trunc(width);
-  return *this;
-}
-
-APInt APInt::zextOrSelf(unsigned width) const {
-  if (BitWidth < width)
-    return zext(width);
-  return *this;
-}
-
-APInt APInt::sextOrSelf(unsigned width) const {
-  if (BitWidth < width)
-    return sext(width);
-  return *this;
-}
-
 /// Arithmetic right-shift this APInt by shiftAmt.
 /// Arithmetic right-shift function.
 void APInt::ashrInPlace(const APInt &shiftAmt) {


        


More information about the llvm-commits mailing list