[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.
This commit is contained in:
Simon Pilgrim 2021-05-17 15:57:00 +01:00
parent 6052a8a535
commit 41587466aa
1 changed files with 1 additions and 2 deletions

View File

@ -44378,8 +44378,7 @@ static SDValue combineAndLoadToBZHI(SDNode *Node, SelectionDAG &DAG,
uint64_t ArrayElementCount = Init->getType()->getArrayNumElements();
bool ConstantsMatch = true;
for (uint64_t j = 0; j < ArrayElementCount; j++) {
ConstantInt *Elem =
dyn_cast<ConstantInt>(Init->getAggregateElement(j));
auto *Elem = cast<ConstantInt>(Init->getAggregateElement(j));
if (Elem->getZExtValue() != (((uint64_t)1 << j) - 1)) {
ConstantsMatch = false;
break;