The static analyzer is warning about a potential null dereference, as we're already earlying-out for a null Constant pointer I've just folded this into a dyn_cast_or_null<ConstantInt>.
No test case, this is by inspection only.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@373322
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!IRInstrVar->hasInitializer())
return false;
- const Constant *InitVal = IRInstrVar->getInitializer();
+ auto *InitVal = dyn_cast_or_null<ConstantInt>(IRInstrVar->getInitializer());
if (!InitVal)
return false;
-
- return (dyn_cast<ConstantInt>(InitVal)->getZExtValue() &
- VARIANT_MASK_IR_PROF) != 0;
+ return (InitVal->getZExtValue() & VARIANT_MASK_IR_PROF) != 0;
}
// Check if we can safely rename this Comdat function.