From: Evan Cheng Date: Thu, 11 Mar 2010 18:49:14 +0000 (+0000) Subject: Bad bad bug. x86 force indirect tail call address into eax when it's meant to force... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=55282267e144a44232aa4731280d8871ba977bf2;p=oota-llvm.git Bad bad bug. x86 force indirect tail call address into eax when it's meant to force it into a call preserved register instead. Change it to ecx for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98270 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 9b7f6fc6aee..88e2fa15ee7 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -2091,7 +2091,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee, // tailcall must happen after callee-saved registers are poped. // FIXME: Give it a special register class that contains caller-saved // register instead? - unsigned TCReg = Is64Bit ? X86::R11 : X86::EAX; + unsigned TCReg = Is64Bit ? X86::R11 : X86::ECX; Chain = DAG.getCopyToReg(Chain, dl, DAG.getRegister(TCReg, getPointerTy()), Callee,InFlag); @@ -2145,7 +2145,7 @@ X86TargetLowering::LowerCall(SDValue Chain, SDValue Callee, } assert(((Callee.getOpcode() == ISD::Register && - (cast(Callee)->getReg() == X86::EAX || + (cast(Callee)->getReg() == X86::ECX || cast(Callee)->getReg() == X86::R11)) || Callee.getOpcode() == ISD::TargetExternalSymbol || Callee.getOpcode() == ISD::TargetGlobalAddress) && diff --git a/test/CodeGen/X86/tailcallfp2.ll b/test/CodeGen/X86/tailcallfp2.ll index 3841f518976..8bfae1bb8de 100644 --- a/test/CodeGen/X86/tailcallfp2.ll +++ b/test/CodeGen/X86/tailcallfp2.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=x86 -tailcallopt | grep {jmp} | grep {\\*%eax} +; RUN: llc < %s -march=x86 -tailcallopt | grep {jmp} | grep {\\*%ecx} declare i32 @putchar(i32)