Skip to content

Commit e7774f4

Browse files
Use static_assert instead of assert (NFC)
Identified with misc-static-assert.
1 parent a1c2ee0 commit e7774f4

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2774,7 +2774,7 @@ SDValue RISCVTargetLowering::LowerOperation(SDValue Op,
27742774
// We define our scalable vector types for lmul=1 to use a 64 bit known
27752775
// minimum size. e.g. <vscale x 2 x i32>. VLENB is in bytes so we calculate
27762776
// vscale as VLENB / 8.
2777-
assert(RISCV::RVVBitsPerBlock == 64 && "Unexpected bits per block!");
2777+
static_assert(RISCV::RVVBitsPerBlock == 64, "Unexpected bits per block!");
27782778
if (isa<ConstantSDNode>(Op.getOperand(0))) {
27792779
// We assume VLENB is a multiple of 8. We manually choose the best shift
27802780
// here because SimplifyDemandedBits isn't always able to simplify it.

llvm/lib/Transforms/Utils/SampleProfileInference.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,10 @@ class FlowAdjuster {
455455
/// Rebalance unknown subgraphs so as each branch splits with probabilities
456456
/// UnknownFirstSuccProbability and 1 - UnknownFirstSuccProbability
457457
void rebalanceUnknownSubgraphs() {
458-
assert(UnknownFirstSuccProbability >= 0.0 &&
459-
UnknownFirstSuccProbability <= 1.0 &&
460-
"the share of the unknown successor should be between 0 and 1");
458+
static_assert(
459+
UnknownFirstSuccProbability >= 0.0 &&
460+
UnknownFirstSuccProbability <= 1.0,
461+
"the share of the unknown successor should be between 0 and 1");
461462
// Try to find unknown subgraphs from each non-unknown block
462463
for (uint64_t I = 0; I < Func.Blocks.size(); I++) {
463464
auto SrcBlock = &Func.Blocks[I];

polly/lib/CodeGen/IslExprBuilder.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,8 @@ Value *IslExprBuilder::createOpICmp(__isl_take isl_ast_expr *Expr) {
526526
isl_ast_op_type OpType = isl_ast_expr_get_op_type(Expr);
527527
assert(OpType >= isl_ast_op_eq && OpType <= isl_ast_op_gt &&
528528
"Unsupported ICmp isl ast expression");
529-
assert(isl_ast_op_eq + 4 == isl_ast_op_gt &&
530-
"Isl ast op type interface changed");
529+
static_assert(isl_ast_op_eq + 4 == isl_ast_op_gt,
530+
"Isl ast op type interface changed");
531531

532532
CmpInst::Predicate Predicates[5][2] = {
533533
{CmpInst::ICMP_EQ, CmpInst::ICMP_EQ},

0 commit comments

Comments
 (0)