diff options
author | Dan Gohman <gohman@apple.com> | 2009-10-12 16:36:12 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-10-12 16:36:12 +0000 |
commit | 0032681424a04c321fafb0e6b28ca7cd59b610f8 (patch) | |
tree | 5ad46ad03bc422e0f1120d753d5d1cf5205f1c7a | |
parent | 6bd6ede7d758a815cc640839658fda50922e5eea (diff) | |
download | llvm-0032681424a04c321fafb0e6b28ca7cd59b610f8.tar.gz llvm-0032681424a04c321fafb0e6b28ca7cd59b610f8.tar.bz2 llvm-0032681424a04c321fafb0e6b28ca7cd59b610f8.tar.xz |
Don't forget to mark RAX as live-out of the function when arranging for
it to hold the address of an sret return value, for x86-64 ABI purposes.
Also, fix the test that was originally intended to test this to actually
test it, using FileCheck.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83853 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86ISelLowering.cpp | 3 | ||||
-rw-r--r-- | test/CodeGen/X86/x86-64-sret-return.ll | 11 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index fb5399e4e6..fadc818394 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -1162,6 +1162,9 @@ X86TargetLowering::LowerReturn(SDValue Chain, Chain = DAG.getCopyToReg(Chain, dl, X86::RAX, Val, Flag); Flag = Chain.getValue(1); + + // RAX now acts like a return value. + MF.getRegInfo().addLiveOut(X86::RAX); } RetOps[0] = Chain; // Update chain. diff --git a/test/CodeGen/X86/x86-64-sret-return.ll b/test/CodeGen/X86/x86-64-sret-return.ll index 3ee1a0b21e..7b5f189faa 100644 --- a/test/CodeGen/X86/x86-64-sret-return.ll +++ b/test/CodeGen/X86/x86-64-sret-return.ll @@ -1,9 +1,11 @@ -; RUN: llc < %s +; RUN: llc < %s | FileCheck %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-apple-darwin8" %struct.foo = type { [4 x i64] } +; CHECK: bar: +; CHECK: movq %rdi, %rax define void @bar(%struct.foo* noalias sret %agg.result, %struct.foo* %d) nounwind { entry: %d_addr = alloca %struct.foo* ; <%struct.foo**> [#uses=2] @@ -52,3 +54,10 @@ entry: return: ; preds = %entry ret void } + +; CHECK: foo: +; CHECK: movq %rdi, %rax +define void @foo({ i64 }* noalias nocapture sret %agg.result) nounwind { + store { i64 } { i64 0 }, { i64 }* %agg.result + ret void +} |