From: Kazu Hirata Date: Sun, 26 Dec 2021 22:26:44 +0000 (-0800) Subject: Use static_assert instead of assert (NFC) X-Git-Tag: upstream/15.0.7~22176 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e7774f499bb2a393145d7e696905048d131a3091;p=platform%2Fupstream%2Fllvm.git Use static_assert instead of assert (NFC) Identified with misc-static-assert. --- diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 4f5512e..39dd139 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -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. . 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(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. diff --git a/llvm/lib/Transforms/Utils/SampleProfileInference.cpp b/llvm/lib/Transforms/Utils/SampleProfileInference.cpp index 2f2dff6..01b54c3 100644 --- a/llvm/lib/Transforms/Utils/SampleProfileInference.cpp +++ b/llvm/lib/Transforms/Utils/SampleProfileInference.cpp @@ -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]; diff --git a/polly/lib/CodeGen/IslExprBuilder.cpp b/polly/lib/CodeGen/IslExprBuilder.cpp index db6680e..4d1094c 100644 --- a/polly/lib/CodeGen/IslExprBuilder.cpp +++ b/polly/lib/CodeGen/IslExprBuilder.cpp @@ -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},