Bad bad bug. x86 force indirect tail call address into eax when it's meant to force...
authorEvan Cheng <evan.cheng@apple.com>
Thu, 11 Mar 2010 18:49:14 +0000 (18:49 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 11 Mar 2010 18:49:14 +0000 (18:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98270 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/tailcallfp2.ll

index 9b7f6fc6aeee5178826b43e7b0f3677748817d08..88e2fa15ee74d30a918cf4c21b34a8ddc3a03c6e 100644 (file)
@@ -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<RegisterSDNode>(Callee)->getReg() == X86::EAX ||
+               (cast<RegisterSDNode>(Callee)->getReg() == X86::ECX ||
                 cast<RegisterSDNode>(Callee)->getReg() == X86::R11)) ||
               Callee.getOpcode() == ISD::TargetExternalSymbol ||
               Callee.getOpcode() == ISD::TargetGlobalAddress) &&
index 3841f518976b7bf21f1f900612e0bb7a3905b04d..8bfae1bb8de5695a25928ca3ff7b2aaffa6a1ff2 100644 (file)
@@ -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)