I'm not sure there's a test case for this, but it's better to be safe.
// Try looking through a bitcast from one function type to another.
// Commonly happens with calls to objc_msgSend().
const Value *CalleeV = CS.getCalledValue();
- if (auto *BC = dyn_cast<ConstantExpr>(CalleeV)) {
+ auto *BC = dyn_cast<ConstantExpr>(CalleeV);
+ if (BC && BC->getOpcode() == Instruction::BitCast) {
if (const auto *F = dyn_cast<Function>(BC->getOperand(0))) {
Info.Callee = MachineOperand::CreateGA(F, 0);
}