[clang] [llvm] [LLVM][IR] Add native vector support to ConstantInt & ConstantFP. (PR #74502)

Nikita Popov via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 10:33:27 PST 2023


================
@@ -136,7 +144,11 @@ class ConstantInt final : public ConstantData {
   inline const APInt &getValue() const { return Val; }
 
   /// getBitWidth - Return the bitwidth of this constant.
-  unsigned getBitWidth() const { return Val.getBitWidth(); }
+  unsigned getBitWidth() const {
+    assert(getType()->isIntegerTy() &&
+           "Returning the bitwidth of a vector constant is not support!");
----------------
nikic wrote:

IMHO this is not necessary. If the name were `getSizeInBits()` I would agree, but the term "bit width" implies that we're talking about scalar. We don't use the term "bit width" to refer to full size of a vector.

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


More information about the cfe-commits mailing list