[llvm] [LLVM] Add `Type::getTruncatedType()` and use it in Intrinsics.cpp (PR #196239)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 11:05:51 PDT 2026


================
@@ -67,7 +67,15 @@ class IntegerType : public Type {
 
   /// Returns type twice as wide the input type.
   IntegerType *getExtendedType() const {
-    return Type::getIntNTy(getContext(), 2 * getScalarSizeInBits());
+    return Type::getIntNTy(getContext(), 2 * getBitWidth());
+  }
+
+  /// Returns type half as wide the input type.
+  IntegerType *getTruncatedType() const {
----------------
jurahul wrote:

These functions are not widely used AFAICT, so we can do the rename and add the new variant in the PR itself if the names sound reasonable.

https://github.com/llvm/llvm-project/pull/196239


More information about the llvm-commits mailing list