Skip to content

Commit 4158746

Browse files
committed
[X86] Don't dereference a dyn_cast<> - use a cast<> instead. NFCI.
dyn_cast<> can return null if the cast fails, by using cast<> we assert that the cast is correct helping to avoid a potential null dereference.
1 parent 6052a8a commit 4158746

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44378,8 +44378,7 @@ static SDValue combineAndLoadToBZHI(SDNode *Node, SelectionDAG &DAG,
4437844378
uint64_t ArrayElementCount = Init->getType()->getArrayNumElements();
4437944379
bool ConstantsMatch = true;
4438044380
for (uint64_t j = 0; j < ArrayElementCount; j++) {
44381-
ConstantInt *Elem =
44382-
dyn_cast<ConstantInt>(Init->getAggregateElement(j));
44381+
auto *Elem = cast<ConstantInt>(Init->getAggregateElement(j));
4438344382
if (Elem->getZExtValue() != (((uint64_t)1 << j) - 1)) {
4438444383
ConstantsMatch = false;
4438544384
break;

0 commit comments

Comments
 (0)