[llvm-commits] [llvm] r53450 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/x86-64-frameaddr.ll

Bill Wendling isanbard at gmail.com
Fri Jul 11 00:18:53 PDT 2008


Author: void
Date: Fri Jul 11 02:18:52 2008
New Revision: 53450

URL: http://llvm.org/viewvc/llvm-project?rev=53450&view=rev
Log:
The frame address on an x86-64 box needs to be offset by -8, not -4.


Added:
    llvm/trunk/test/CodeGen/X86/x86-64-frameaddr.ll
Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=53450&r1=53449&r2=53450&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Jul 11 02:18:52 2008
@@ -5348,7 +5348,7 @@
     
   SDOperand RetAddrFI = getReturnAddressFrameIndex(DAG);
   return DAG.getNode(ISD::SUB, getPointerTy(), RetAddrFI, 
-                     DAG.getIntPtrConstant(4));
+                     DAG.getIntPtrConstant(!Subtarget->is64Bit() ? 4 : 8));
 }
 
 SDOperand X86TargetLowering::LowerFRAME_TO_ARGS_OFFSET(SDOperand Op,

Added: llvm/trunk/test/CodeGen/X86/x86-64-frameaddr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/x86-64-frameaddr.ll?rev=53450&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/X86/x86-64-frameaddr.ll (added)
+++ llvm/trunk/test/CodeGen/X86/x86-64-frameaddr.ll Fri Jul 11 02:18:52 2008
@@ -0,0 +1,11 @@
+; RUN: llvm-as < %s | llc -march=x86-64 | grep {leaq	-8(%rsp), %rax}
+ at llvm.noinline = appending global [1 x i8*] [ i8* bitcast (i64* ()* @stack_end_address to i8*) ], section "llvm.metadata"
+
+define internal i64* @stack_end_address() nounwind  {
+entry:
+	tail call i8* @llvm.frameaddress( i32 0 )
+	bitcast i8* %0 to i64*
+	ret i64* %1
+}
+
+declare i8* @llvm.frameaddress(i32) nounwind readnone 





More information about the llvm-commits mailing list