Use static_assert instead of assert (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 26 Dec 2021 22:26:44 +0000 (14:26 -0800)
committerKazu Hirata <kazu@google.com>
Sun, 26 Dec 2021 22:26:44 +0000 (14:26 -0800)
Identified with misc-static-assert.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Transforms/Utils/SampleProfileInference.cpp
polly/lib/CodeGen/IslExprBuilder.cpp

index 4f5512e..39dd139 100644 (file)
@@ -2774,7 +2774,7 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
     // We define our scalable vector types for lmul=1 to use a 64 bit known
     // minimum size. e.g. <vscale x 2 x i32>. VLENB is in bytes so we calculate
     // vscale as VLENB / 8.
-    assert(RISCV::RVVBitsPerBlock == 64 && "Unexpected bits per block!");
+    static_assert(RISCV::RVVBitsPerBlock == 64, "Unexpected bits per block!");
     if (isa<ConstantSDNode>(Op.getOperand(0))) {
       // We assume VLENB is a multiple of 8. We manually choose the best shift
       // here because SimplifyDemandedBits isn't always able to simplify it.
index 2f2dff6..01b54c3 100644 (file)
@@ -455,9 +455,10 @@ private:
   /// Rebalance unknown subgraphs so as each branch splits with probabilities
   /// UnknownFirstSuccProbability and 1 - UnknownFirstSuccProbability
   void rebalanceUnknownSubgraphs() {
-    assert(UnknownFirstSuccProbability >= 0.0 &&
-           UnknownFirstSuccProbability <= 1.0 &&
-           "the share of the unknown successor should be between 0 and 1");
+    static_assert(
+        UnknownFirstSuccProbability >= 0.0 &&
+            UnknownFirstSuccProbability <= 1.0,
+        "the share of the unknown successor should be between 0 and 1");
     // Try to find unknown subgraphs from each non-unknown block
     for (uint64_t I = 0; I < Func.Blocks.size(); I++) {
       auto SrcBlock = &Func.Blocks[I];
index db6680e..4d1094c 100644 (file)
@@ -526,8 +526,8 @@ Value *IslExprBuilder::createOpICmp(__isl_take isl_ast_expr *Expr) {
   isl_ast_op_type OpType = isl_ast_expr_get_op_type(Expr);
   assert(OpType >= isl_ast_op_eq && OpType <= isl_ast_op_gt &&
          "Unsupported ICmp isl ast expression");
-  assert(isl_ast_op_eq + 4 == isl_ast_op_gt &&
-         "Isl ast op type interface changed");
+  static_assert(isl_ast_op_eq + 4 == isl_ast_op_gt,
+                "Isl ast op type interface changed");
 
   CmpInst::Predicate Predicates[5][2] = {
       {CmpInst::ICMP_EQ, CmpInst::ICMP_EQ},