aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/APIntTest.cpp
diff options
context:
space:
mode:
authorSchuyler Eldridge <schuyler.eldridge@sifive.com>2021-11-30 00:47:08 -0500
committerSchuyler Eldridge <schuyler.eldridge@sifive.com>2021-11-30 17:03:12 -0500
commit63f417ef39963afa9722a7b3c5cf3b28a9d41883 (patch)
tree1449b06641d65a75af52e887c98ee08adba00d41 /llvm/unittests/ADT/APIntTest.cpp
parentaeeacbd989fc474d920afa1b1dd3fb4ef502c726 (diff)
downloadllvm-63f417ef39963afa9722a7b3c5cf3b28a9d41883.zip
llvm-63f417ef39963afa9722a7b3c5cf3b28a9d41883.tar.gz
llvm-63f417ef39963afa9722a7b3c5cf3b28a9d41883.tar.bz2
[ADT] Remove 0-width Asserts in APInt.getZExtValue
Remove assertion that disallows getting a zero-extended value from a zero-width APInt. This check is too restrictive and makes it difficult to use APInt to model zero-width things, e.g., zero-width wires in the CIRCT project. Signed-off-by: Schuyler Eldridge <schuyler.eldridge@sifive.com> Reviewed By: lattner, darthscsi, nikic Differential Revision: https://reviews.llvm.org/D114768
Diffstat (limited to 'llvm/unittests/ADT/APIntTest.cpp')
-rw-r--r--llvm/unittests/ADT/APIntTest.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/APIntTest.cpp b/llvm/unittests/ADT/APIntTest.cpp
index 8a731633..95cb213 100644
--- a/llvm/unittests/ADT/APIntTest.cpp
+++ b/llvm/unittests/ADT/APIntTest.cpp
@@ -3054,6 +3054,9 @@ TEST(APIntTest, ZeroWidth) {
EXPECT_EQ(0U, APInt(4, 3).trunc(0).getBitWidth());
EXPECT_TRUE(ZW.isAllOnes());
+ // Zero extension.
+ EXPECT_EQ(0U, ZW.getZExtValue());
+
SmallString<42> STR;
ZW.toStringUnsigned(STR);
EXPECT_EQ("0", STR);