Skip to content

Commit 6aa10ae

Browse files
committed
[Transforms] visitCmpBlock - don't dereference a dyn_cast<>. NFCI.
Use cast<> as we immediately dereference the pointer afterwards - cast<> will assert if we fail. Prevents clang static analyzer warning that we could deference a null pointer.
1 parent 5ac89ad commit 6aa10ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Transforms/Scalar/MergeICmps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ BCECmpBlock visitCmpBlock(Value *const Val, BasicBlock *const Block,
372372
} else {
373373
// In this case, we expect a constant incoming value (the comparison is
374374
// chained).
375-
const auto *const Const = dyn_cast<ConstantInt>(Val);
375+
const auto *const Const = cast<ConstantInt>(Val);
376376
LLVM_DEBUG(dbgs() << "const\n");
377377
if (!Const->isZero()) return {};
378378
LLVM_DEBUG(dbgs() << "false\n");

0 commit comments

Comments
 (0)