[flang-commits] [flang] fb09f9f - [Flang] Use llvm_unreachable to replace assert, NFC

Kai Luo via flang-commits flang-commits at lists.llvm.org
Tue Jul 4 00:05:44 PDT 2023


Author: Kai Luo
Date: 2023-07-04T15:05:37+08:00
New Revision: fb09f9f914117e9740df6c637d98670955ea52dc

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

LOG: [Flang] Use llvm_unreachable to replace assert, NFC

IIUC, the `default` case should be unreachable inferred from the context.

Reviewed By: kkwli0

Differential Revision: https://reviews.llvm.org/D154344

Added: 
    

Modified: 
    flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp b/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp
index 6442f8a51f0501..9c146a301957aa 100644
--- a/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp
+++ b/flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp
@@ -614,7 +614,7 @@ PPCIntrinsicLibrary::genVecCmp(mlir::Type resultType,
       break;
     }
     default:
-      assert(false && "Invalid vector operation for generator");
+      llvm_unreachable("Invalid vector operation for generator");
     }
   } else if (vecTyInfo.isFloat()) {
     mlir::Value vargs[2];
@@ -631,12 +631,12 @@ PPCIntrinsicLibrary::genVecCmp(mlir::Type resultType,
       vargs[1] = argBases[0];
       break;
     default:
-      assert(false && "Invalid vector operation for generator");
+      llvm_unreachable("Invalid vector operation for generator");
     }
     auto callOp{builder.create<fir::CallOp>(loc, funcOp, vargs)};
     res = callOp.getResult(0);
   } else
-    assert(false && "invalid vector type");
+    llvm_unreachable("invalid vector type");
 
   return res;
 }


        


More information about the flang-commits mailing list