[llvm] [CodeGenTypes] Remove unused ElSz argument from generated GET_VT_VECATTR (PR #95258)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 00:58:33 PDT 2024


https://github.com/jayfoad updated https://github.com/llvm/llvm-project/pull/95258

>From fe467d49f883cc18024a9eef1492eedf00e0561e Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Wed, 12 Jun 2024 15:52:13 +0100
Subject: [PATCH 1/3] [CodeGenTypes] Remove unused ElSz argument from generated
 GET_VT_VECATTR

---
 llvm/include/llvm/CodeGenTypes/MachineValueType.h | 8 ++++----
 llvm/utils/TableGen/VTEmitter.cpp                 | 5 ++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/llvm/include/llvm/CodeGenTypes/MachineValueType.h b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
index e008503f734b9..4e5e63cfb45e9 100644
--- a/llvm/include/llvm/CodeGenTypes/MachineValueType.h
+++ b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
@@ -256,7 +256,7 @@ namespace llvm {
       default:
         llvm_unreachable("Not a vector MVT!");
 
-#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy, ElSz)                              \
+#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                    \
   case Ty:                                                                     \
     return ElTy;
 #include "llvm/CodeGen/GenVT.inc"
@@ -270,7 +270,7 @@ namespace llvm {
       default:
         llvm_unreachable("Not a vector MVT!");
 
-#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy, ElSz)                              \
+#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                    \
   case Ty:                                                                     \
     return nElem;
 #include "llvm/CodeGen/GenVT.inc"
@@ -440,7 +440,7 @@ namespace llvm {
     }
 
     static MVT getVectorVT(MVT VT, unsigned NumElements) {
-#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy, ElSz)                              \
+#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                    \
   if (!Sc && VT.SimpleTy == ElTy && NumElements == nElem)                      \
     return Ty;
 #include "llvm/CodeGen/GenVT.inc"
@@ -450,7 +450,7 @@ namespace llvm {
     }
 
     static MVT getScalableVectorVT(MVT VT, unsigned NumElements) {
-#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy, ElSz)                              \
+#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                    \
   if (Sc && VT.SimpleTy == ElTy && NumElements == nElem)                       \
     return Ty;
 #include "llvm/CodeGen/GenVT.inc"
diff --git a/llvm/utils/TableGen/VTEmitter.cpp b/llvm/utils/TableGen/VTEmitter.cpp
index 64b54ed134232..d9d3dc2f696cb 100644
--- a/llvm/utils/TableGen/VTEmitter.cpp
+++ b/llvm/utils/TableGen/VTEmitter.cpp
@@ -110,7 +110,7 @@ void VTEmitter::run(raw_ostream &OS) {
   }
   OS << "#endif\n\n";
 
-  OS << "#ifdef GET_VT_VECATTR // (Ty, Sc, nElem, ElTy, ElSz)\n";
+  OS << "#ifdef GET_VT_VECATTR // (Ty, Sc, nElem, ElTy)\n";
   for (const auto *VT : VTsByNumber) {
     if (!VT || !VT->getValueAsBit("isVector"))
       continue;
@@ -121,8 +121,7 @@ void VTEmitter::run(raw_ostream &OS) {
        << VT->getValueAsString("LLVMName") << ", "
        << VT->getValueAsBit("isScalable") << ", "
        << VT->getValueAsInt("nElem") << ", "
-       << ElTy->getName() << ", "
-       << ElTy->getValueAsInt("Size") << ")\n";
+       << ElTy->getName() << ")\n";
     // clang-format on
   }
   OS << "#endif\n\n";

>From 9f44ca8669792d6f1dd759e789033a4de409ed87 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Wed, 12 Jun 2024 16:00:52 +0100
Subject: [PATCH 2/3] Allow clang-format to unalign the backslashes

---
 .../llvm/CodeGenTypes/MachineValueType.h      | 24 +++++++++----------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/llvm/include/llvm/CodeGenTypes/MachineValueType.h b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
index 4e5e63cfb45e9..d3b2380453ec6 100644
--- a/llvm/include/llvm/CodeGenTypes/MachineValueType.h
+++ b/llvm/include/llvm/CodeGenTypes/MachineValueType.h
@@ -256,9 +256,9 @@ namespace llvm {
       default:
         llvm_unreachable("Not a vector MVT!");
 
-#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                    \
-  case Ty:                                                                     \
-    return ElTy;
+#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                  \
+    case Ty:                                                                   \
+      return ElTy;
 #include "llvm/CodeGen/GenVT.inc"
 #undef GET_VT_VECATTR
       }
@@ -270,9 +270,9 @@ namespace llvm {
       default:
         llvm_unreachable("Not a vector MVT!");
 
-#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                    \
-  case Ty:                                                                     \
-    return nElem;
+#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                  \
+    case Ty:                                                                   \
+      return nElem;
 #include "llvm/CodeGen/GenVT.inc"
 #undef GET_VT_VECATTR
       }
@@ -440,9 +440,9 @@ namespace llvm {
     }
 
     static MVT getVectorVT(MVT VT, unsigned NumElements) {
-#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                    \
-  if (!Sc && VT.SimpleTy == ElTy && NumElements == nElem)                      \
-    return Ty;
+#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                  \
+    if (!Sc && VT.SimpleTy == ElTy && NumElements == nElem)                    \
+      return Ty;
 #include "llvm/CodeGen/GenVT.inc"
 #undef GET_VT_VECATTR
 
@@ -450,9 +450,9 @@ namespace llvm {
     }
 
     static MVT getScalableVectorVT(MVT VT, unsigned NumElements) {
-#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                    \
-  if (Sc && VT.SimpleTy == ElTy && NumElements == nElem)                       \
-    return Ty;
+#define GET_VT_VECATTR(Ty, Sc, nElem, ElTy)                                  \
+    if (Sc && VT.SimpleTy == ElTy && NumElements == nElem)                     \
+      return Ty;
 #include "llvm/CodeGen/GenVT.inc"
 #undef GET_VT_VECATTR
 

>From e7a06f9ab581e8379369b1d8ca492ef4f5a9018b Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Thu, 13 Jun 2024 08:56:03 +0100
Subject: [PATCH 3/3] Retrigger CI




More information about the llvm-commits mailing list