[llvm] 29181bd - Revert "[RISCV] Use a switch instead of a series of if-clauses [nfc]"

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 13:34:20 PDT 2023


Author: Philip Reames
Date: 2023-10-25T13:34:10-07:00
New Revision: 29181bd97a24c85bf160ead132bf91027d6bc73c

URL: https://github.com/llvm/llvm-project/commit/29181bd97a24c85bf160ead132bf91027d6bc73c
DIFF: https://github.com/llvm/llvm-project/commit/29181bd97a24c85bf160ead132bf91027d6bc73c.diff

LOG: Revert "[RISCV] Use a switch instead of a series of if-clauses [nfc]"

This reverts commit 3c2203ae03ca8a8cf56691d6f03050ccc2420ff6.  The buildbots were quick to remind me that I had, in fact, missed a switch case.  Oops.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index adcc608b2286dd5..91d8d91cdfe85f7 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -301,21 +301,18 @@ inline raw_ostream &operator<<(raw_ostream &OS, const DemandedFields &DF) {
 /// of instructions) which use only the Used subfields and properties.
 static bool areCompatibleVTYPEs(uint64_t CurVType, uint64_t NewVType,
                                 const DemandedFields &Used) {
-  switch (Used.SEW) {
-  case DemandedFields::SEWEqual:
-    if (RISCVVType::getSEW(CurVType) != RISCVVType::getSEW(NewVType))
-      return false;
-    break;
-  case DemandedFields::SEWGreaterThanOrEqual:
-    if (RISCVVType::getSEW(NewVType) < RISCVVType::getSEW(CurVType))
-      return false;
-    break;
-  case DemandedFields::SEWGreaterThanOrEqualAndLessThan64:
-    if (RISCVVType::getSEW(NewVType) < RISCVVType::getSEW(CurVType) ||
-        RISCVVType::getSEW(NewVType) >= 64)
-      return false;
-    break;
-  }
+  if (Used.SEW == DemandedFields::SEWEqual &&
+      RISCVVType::getSEW(CurVType) != RISCVVType::getSEW(NewVType))
+    return false;
+
+  if (Used.SEW == DemandedFields::SEWGreaterThanOrEqual &&
+      RISCVVType::getSEW(NewVType) < RISCVVType::getSEW(CurVType))
+    return false;
+
+  if (Used.SEW == DemandedFields::SEWGreaterThanOrEqualAndLessThan64 &&
+      (RISCVVType::getSEW(NewVType) < RISCVVType::getSEW(CurVType) ||
+       RISCVVType::getSEW(NewVType) >= 64))
+    return false;
 
   if (Used.LMUL &&
       RISCVVType::getVLMUL(CurVType) != RISCVVType::getVLMUL(NewVType))


        


More information about the llvm-commits mailing list