[llvm] f581510 - [SVE] Remove reliance on TypeSize comparison operators in unit tests
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 21 00:31:11 PDT 2020
Author: David Sherwood
Date: 2020-10-21T08:05:55+01:00
New Revision: f5815105d2762d68000996bff9041216cd7b732e
URL: https://github.com/llvm/llvm-project/commit/f5815105d2762d68000996bff9041216cd7b732e
DIFF: https://github.com/llvm/llvm-project/commit/f5815105d2762d68000996bff9041216cd7b732e.diff
LOG: [SVE] Remove reliance on TypeSize comparison operators in unit tests
The EXPECT_XY comparison functions all rely upon using the existing
TypeSize comparison operators, which we are deprecating in favour
of isKnownXY. I've changed all such cases to compare either the known
minimum size or the fixed size.
Differential Revision: https://reviews.llvm.org/D89531
Added:
Modified:
llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
llvm/unittests/IR/VectorTypesTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp b/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
index 48b950fa74e9..566b2e75c70c 100644
--- a/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
+++ b/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
@@ -139,19 +139,23 @@ TEST(ScalableVectorMVTsTest, SizeQueries) {
EXPECT_EQ(nxv4i32.getSizeInBits(), nxv2i64.getSizeInBits());
EXPECT_EQ(nxv2f64.getSizeInBits(), nxv2i64.getSizeInBits());
EXPECT_NE(nxv2i32.getSizeInBits(), nxv4i32.getSizeInBits());
- EXPECT_LT(nxv2i32.getSizeInBits(), nxv2i64.getSizeInBits());
- EXPECT_LE(nxv4i32.getSizeInBits(), nxv2i64.getSizeInBits());
- EXPECT_GT(nxv4i32.getSizeInBits(), nxv2i32.getSizeInBits());
- EXPECT_GE(nxv2i64.getSizeInBits(), nxv4i32.getSizeInBits());
+ EXPECT_LT(nxv2i32.getSizeInBits().getKnownMinSize(),
+ nxv2i64.getSizeInBits().getKnownMinSize());
+ EXPECT_LE(nxv4i32.getSizeInBits().getKnownMinSize(),
+ nxv2i64.getSizeInBits().getKnownMinSize());
+ EXPECT_GT(nxv4i32.getSizeInBits().getKnownMinSize(),
+ nxv2i32.getSizeInBits().getKnownMinSize());
+ EXPECT_GE(nxv2i64.getSizeInBits().getKnownMinSize(),
+ nxv4i32.getSizeInBits().getKnownMinSize());
// Check equivalence and ordering on fixed types.
EXPECT_EQ(v4i32.getSizeInBits(), v2i64.getSizeInBits());
EXPECT_EQ(v2f64.getSizeInBits(), v2i64.getSizeInBits());
EXPECT_NE(v2i32.getSizeInBits(), v4i32.getSizeInBits());
- EXPECT_LT(v2i32.getSizeInBits(), v2i64.getSizeInBits());
- EXPECT_LE(v4i32.getSizeInBits(), v2i64.getSizeInBits());
- EXPECT_GT(v4i32.getSizeInBits(), v2i32.getSizeInBits());
- EXPECT_GE(v2i64.getSizeInBits(), v4i32.getSizeInBits());
+ EXPECT_LT(v2i32.getFixedSizeInBits(), v2i64.getFixedSizeInBits());
+ EXPECT_LE(v4i32.getFixedSizeInBits(), v2i64.getFixedSizeInBits());
+ EXPECT_GT(v4i32.getFixedSizeInBits(), v2i32.getFixedSizeInBits());
+ EXPECT_GE(v2i64.getFixedSizeInBits(), v4i32.getFixedSizeInBits());
// Check that scalable and non-scalable types with the same minimum size
// are not considered equal.
@@ -159,7 +163,7 @@ TEST(ScalableVectorMVTsTest, SizeQueries) {
ASSERT_FALSE(v2i64.getSizeInBits() == nxv2f64.getSizeInBits());
// Check that we can obtain a known-exact size from a non-scalable type.
- EXPECT_EQ(v4i32.getSizeInBits(), 128U);
+ EXPECT_EQ(v4i32.getFixedSizeInBits(), 128U);
EXPECT_EQ(v2i64.getFixedSizeInBits(), 128U);
// Check that we can query the known minimum size for both scalable and
diff --git a/llvm/unittests/IR/VectorTypesTest.cpp b/llvm/unittests/IR/VectorTypesTest.cpp
index 37137053bf15..c8a09808428f 100644
--- a/llvm/unittests/IR/VectorTypesTest.cpp
+++ b/llvm/unittests/IR/VectorTypesTest.cpp
@@ -286,10 +286,10 @@ TEST(VectorTypesTest, FixedLenComparisons) {
EXPECT_EQ(V2I32Len.getKnownMinSize(), 64U);
EXPECT_FALSE(V2I32Len.isScalable());
- EXPECT_LT(V2Int32Ty->getPrimitiveSizeInBits(),
- V4Int32Ty->getPrimitiveSizeInBits());
- EXPECT_GT(V2Int64Ty->getPrimitiveSizeInBits(),
- V2Int32Ty->getPrimitiveSizeInBits());
+ EXPECT_LT(V2Int32Ty->getPrimitiveSizeInBits().getFixedSize(),
+ V4Int32Ty->getPrimitiveSizeInBits().getFixedSize());
+ EXPECT_GT(V2Int64Ty->getPrimitiveSizeInBits().getFixedSize(),
+ V2Int32Ty->getPrimitiveSizeInBits().getFixedSize());
EXPECT_EQ(V4Int32Ty->getPrimitiveSizeInBits(),
V2Int64Ty->getPrimitiveSizeInBits());
EXPECT_NE(V2Int32Ty->getPrimitiveSizeInBits(),
@@ -332,14 +332,14 @@ TEST(VectorTypesTest, ScalableComparisons) {
EXPECT_EQ(ScV2I32Len.getKnownMinSize(), 64U);
EXPECT_TRUE(ScV2I32Len.isScalable());
- EXPECT_LT(ScV2Int32Ty->getPrimitiveSizeInBits(),
- ScV4Int32Ty->getPrimitiveSizeInBits());
- EXPECT_GT(ScV2Int64Ty->getPrimitiveSizeInBits(),
- ScV2Int32Ty->getPrimitiveSizeInBits());
- EXPECT_EQ(ScV4Int32Ty->getPrimitiveSizeInBits(),
- ScV2Int64Ty->getPrimitiveSizeInBits());
- EXPECT_NE(ScV2Int32Ty->getPrimitiveSizeInBits(),
- ScV2Int64Ty->getPrimitiveSizeInBits());
+ EXPECT_LT(ScV2Int32Ty->getPrimitiveSizeInBits().getKnownMinSize(),
+ ScV4Int32Ty->getPrimitiveSizeInBits().getKnownMinSize());
+ EXPECT_GT(ScV2Int64Ty->getPrimitiveSizeInBits().getKnownMinSize(),
+ ScV2Int32Ty->getPrimitiveSizeInBits().getKnownMinSize());
+ EXPECT_EQ(ScV4Int32Ty->getPrimitiveSizeInBits().getKnownMinSize(),
+ ScV2Int64Ty->getPrimitiveSizeInBits().getKnownMinSize());
+ EXPECT_NE(ScV2Int32Ty->getPrimitiveSizeInBits().getKnownMinSize(),
+ ScV2Int64Ty->getPrimitiveSizeInBits().getKnownMinSize());
// Check the DataLayout interfaces.
EXPECT_EQ(DL.getTypeSizeInBits(ScV2Int64Ty),
More information about the llvm-commits
mailing list