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

Paul Walker via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 10:23:14 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!");
----------------
paulwalker-arm wrote:

Ultimately I think this should be more explicit, for example `getScalarBitWidth()`.  For this patch though the need was tiny so I made this change purely to trigger asserts at this level when failure cases are hit once I start expanding the testing.

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


More information about the cfe-commits mailing list