1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Fix PR6196. GV callee may not be a function.

llvm-svn: 95017
This commit is contained in:
Evan Cheng 2010-02-01 22:40:09 +00:00
parent b91a142542
commit efa391da81
2 changed files with 17 additions and 3 deletions

View File

@ -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());
if (const Function *CalleeF = dyn_cast<Function>(G->getGlobal())) {
const Type *CalleeRetTy = CalleeF->getReturnType();
return CallerRetTy == CalleeRetTy;
}
return false;
}
FastISel *

View File

@ -0,0 +1,12 @@
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu
; PR6196
%"char[]" = type [1 x i8]
@.str = external constant %"char[]", align 1 ; <%"char[]"*> [#uses=1]
define i32 @regex_subst() nounwind {
entry:
%0 = tail call i32 bitcast (%"char[]"* @.str to i32 (i32)*)(i32 0) nounwind ; <i32> [#uses=1]
ret i32 %0
}