[llvm] e7774f4 - Use static_assert instead of assert (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 26 14:26:55 PST 2021
Author: Kazu Hirata
Date: 2021-12-26T14:26:44-08:00
New Revision: e7774f499bb2a393145d7e696905048d131a3091
URL: https://github.com/llvm/llvm-project/commit/e7774f499bb2a393145d7e696905048d131a3091
DIFF: https://github.com/llvm/llvm-project/commit/e7774f499bb2a393145d7e696905048d131a3091.diff
LOG: Use static_assert instead of assert (NFC)
Identified with misc-static-assert.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/lib/Transforms/Utils/SampleProfileInference.cpp
polly/lib/CodeGen/IslExprBuilder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 4f5512e6fb379..39dd139953b0c 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. <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.
diff --git a/llvm/lib/Transforms/Utils/SampleProfileInference.cpp b/llvm/lib/Transforms/Utils/SampleProfileInference.cpp
index 2f2dff6b5f0b4..01b54c3d88c94 100644
--- a/llvm/lib/Transforms/Utils/SampleProfileInference.cpp
+++ b/llvm/lib/Transforms/Utils/SampleProfileInference.cpp
@@ -455,9 +455,10 @@ class FlowAdjuster {
/// 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 db6680e258a38..4d1094cf3effd 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},
More information about the llvm-commits
mailing list