[llvm] 11f67f5 - [ARM] Replace if's with a switch, NFC

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 3 08:16:34 PST 2021


Author: David Green
Date: 2021-12-03T16:16:30Z
New Revision: 11f67f5a2c286e33fece6c56cd5333549307549a

URL: https://github.com/llvm/llvm-project/commit/11f67f5a2c286e33fece6c56cd5333549307549a
DIFF: https://github.com/llvm/llvm-project/commit/11f67f5a2c286e33fece6c56cd5333549307549a.diff

LOG: [ARM] Replace if's with a switch, NFC

I'm not having a lot of luck with the microosft compiler recently. Maybe
this will help it with its errors:
llvm\lib\IR\AutoUpgrade.cpp(3726): fatal error C1061: compiler limit: blocks nested too deeply

If not, it's a good code cleanup anyway.

Added: 
    

Modified: 
    llvm/lib/IR/AutoUpgrade.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 779b33802eed..aa5c7fc01786 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -3711,30 +3711,37 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
       std::vector<Type *> Tys;
       unsigned ID = CI->getIntrinsicID();
       Type *V2I1Ty = FixedVectorType::get(Builder.getInt1Ty(), 2);
-      if (ID == Intrinsic::arm_mve_mull_int_predicated ||
-          ID == Intrinsic::arm_mve_vqdmull_predicated ||
-          ID == Intrinsic::arm_mve_vldr_gather_base_predicated)
+      switch (ID) {
+      case Intrinsic::arm_mve_mull_int_predicated:
+      case Intrinsic::arm_mve_vqdmull_predicated:
+      case Intrinsic::arm_mve_vldr_gather_base_predicated:
         Tys = {CI->getType(), CI->getOperand(0)->getType(), V2I1Ty};
-      else if (ID == Intrinsic::arm_mve_vldr_gather_base_wb_predicated ||
-               ID == Intrinsic::arm_mve_vstr_scatter_base_predicated ||
-               ID == Intrinsic::arm_mve_vstr_scatter_base_wb_predicated)
+        break;
+      case Intrinsic::arm_mve_vldr_gather_base_wb_predicated:
+      case Intrinsic::arm_mve_vstr_scatter_base_predicated:
+      case Intrinsic::arm_mve_vstr_scatter_base_wb_predicated:
         Tys = {CI->getOperand(0)->getType(), CI->getOperand(0)->getType(),
                V2I1Ty};
-      else if (ID == Intrinsic::arm_mve_vldr_gather_offset_predicated)
+        break;
+      case Intrinsic::arm_mve_vldr_gather_offset_predicated:
         Tys = {CI->getType(), CI->getOperand(0)->getType(),
                CI->getOperand(1)->getType(), V2I1Ty};
-      else if (ID == Intrinsic::arm_mve_vstr_scatter_offset_predicated)
+        break;
+      case Intrinsic::arm_mve_vstr_scatter_offset_predicated:
         Tys = {CI->getOperand(0)->getType(), CI->getOperand(1)->getType(),
                CI->getOperand(2)->getType(), V2I1Ty};
-      else if (ID == Intrinsic::arm_cde_vcx1q_predicated ||
-               ID == Intrinsic::arm_cde_vcx1qa_predicated ||
-               ID == Intrinsic::arm_cde_vcx2q_predicated ||
-               ID == Intrinsic::arm_cde_vcx2qa_predicated ||
-               ID == Intrinsic::arm_cde_vcx3q_predicated ||
-               ID == Intrinsic::arm_cde_vcx3qa_predicated)
+        break;
+      case Intrinsic::arm_cde_vcx1q_predicated:
+      case Intrinsic::arm_cde_vcx1qa_predicated:
+      case Intrinsic::arm_cde_vcx2q_predicated:
+      case Intrinsic::arm_cde_vcx2qa_predicated:
+      case Intrinsic::arm_cde_vcx3q_predicated:
+      case Intrinsic::arm_cde_vcx3qa_predicated:
         Tys = {CI->getOperand(1)->getType(), V2I1Ty};
-      else
+        break;
+      default:
         llvm_unreachable("Unhandled Intrinsic!");
+      }
 
       std::vector<Value *> Ops;
       for (Value *Op : CI->args()) {


        


More information about the llvm-commits mailing list