summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 5b7629852ee..a8308b80a96 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -2288,9 +2288,11 @@ X86TargetLowering::IsEligibleForTailCallOptimization(SDValue Callee,
// Don't tail call optimize recursive call.
GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee);
if (!G) return false; // FIXME: common external symbols?
- const Function *CalleeF = cast<Function>(G->getGlobal());
- const Type *CalleeRetTy = CalleeF->getReturnType();
- return CallerRetTy == CalleeRetTy;
+ if (const Function *CalleeF = dyn_cast<Function>(G->getGlobal())) {
+ const Type *CalleeRetTy = CalleeF->getReturnType();
+ return CallerRetTy == CalleeRetTy;
+ }
+ return false;
}
FastISel *
OpenPOWER on IntegriCloud