[PATCH] D89531: [SVE] Remove reliance on TypeSize comparison operators in unit tests

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 16 03:32:14 PDT 2020


david-arm created this revision.
david-arm added reviewers: sdesmalen, CarolineConcatto, ctetreau.
Herald added subscribers: llvm-commits, psnobl, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.
david-arm requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89531

Files:
  llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
  llvm/unittests/IR/VectorTypesTest.cpp


Index: llvm/unittests/IR/VectorTypesTest.cpp
===================================================================
--- llvm/unittests/IR/VectorTypesTest.cpp
+++ llvm/unittests/IR/VectorTypesTest.cpp
@@ -286,10 +286,10 @@
   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 @@
   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),
Index: llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
===================================================================
--- llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
+++ llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
@@ -139,19 +139,23 @@
   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 @@
   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89531.298577.patch
Type: text/x-patch
Size: 4511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201016/a6f0407a/attachment.bin>


More information about the llvm-commits mailing list