summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold Schwaighofer <arnold.schwaighofer@gmail.com>2007-11-10 10:48:01 +0000
committerArnold Schwaighofer <arnold.schwaighofer@gmail.com>2007-11-10 10:48:01 +0000
commit38ada868f24b639512e4cfe07871ccea05e09f1a (patch)
tree34745d52746003cd2a4050bbc800ba47978a47f0
parent1a8a08a690a06194653f54453ac41e0e0e7bd3a4 (diff)
downloadllvm-38ada868f24b639512e4cfe07871ccea05e09f1a.tar.gz
llvm-38ada868f24b639512e4cfe07871ccea05e09f1a.tar.bz2
llvm-38ada868f24b639512e4cfe07871ccea05e09f1a.tar.xz
Update tailcall code to include inline attribute operand for memcpy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43978 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp7
-rw-r--r--test/CodeGen/X86/tailcallbyval.ll15
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp
index 8c40b3ca70..d51c1d97a3 100644
--- a/lib/Target/X86/X86ISelLowering.cpp
+++ b/lib/Target/X86/X86ISelLowering.cpp
@@ -1643,9 +1643,10 @@ SDOperand X86TargetLowering::LowerX86_TailCallTo(SDOperand Op,
SDOperand AlignNode = DAG.getConstant(Align, MVT::i32);
SDOperand SizeNode = DAG.getConstant(Size, MVT::i32);
- // Copy relative to framepointer.
- MemOpChains2.push_back(DAG.getNode(ISD::MEMCPY, MVT::Other, Chain, FIN,
- PtrOff, SizeNode, AlignNode));
+ SDOperand AlwaysInline = DAG.getConstant(1, MVT::i1);
+
+ MemOpChains2.push_back(DAG.getMemcpy(Chain, FIN, PtrOff, SizeNode,
+ AlignNode,AlwaysInline));
} else {
SDOperand LoadedArg = DAG.getLoad(VA.getValVT(), Chain, PtrOff, NULL,0);
// Store relative to framepointer.
diff --git a/test/CodeGen/X86/tailcallbyval.ll b/test/CodeGen/X86/tailcallbyval.ll
new file mode 100644
index 0000000000..dc1dea7e11
--- /dev/null
+++ b/test/CodeGen/X86/tailcallbyval.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | llc -march=x86 -tailcallopt | grep TAILCALL
+%struct.s = type { i32, i32, i32 }
+
+define fastcc i32 @tailcallee(%struct.s* byval %a) {
+entry:
+ %tmp2 = getelementptr %struct.s* %a, i32 0, i32 0
+ %tmp3 = load i32* %tmp2
+ ret i32 %tmp3
+}
+
+define fastcc i32 @tailcaller(%struct.s* byval %a) {
+entry:
+ %tmp4 = tail call fastcc i32 @tailcallee(%struct.s* %a byval)
+ ret i32 %tmp4
+}