aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/ArgumentPromotion/attrs.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-01-17 01:17:03 +0000
committerChris Lattner <sabre@nondot.org>2008-01-17 01:17:03 +0000
commitaf5a54a5b3ede130b5af1c06e72ac5d7039082f1 (patch)
tree2cf96957333606d277053e4ad193fab92eca4d19 /test/Transforms/ArgumentPromotion/attrs.ll
parent9e66d8c6f8e2ff23fa0bfc04ea61c4a323784ced (diff)
downloadexternal_llvm-af5a54a5b3ede130b5af1c06e72ac5d7039082f1.zip
external_llvm-af5a54a5b3ede130b5af1c06e72ac5d7039082f1.tar.gz
external_llvm-af5a54a5b3ede130b5af1c06e72ac5d7039082f1.tar.bz2
Fix arg promotion to propagate the correct attrs on the calls to
promoted functions. This is important for varargs calls in particular. Thanks to duncan for providing a great testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46108 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ArgumentPromotion/attrs.ll')
-rw-r--r--test/Transforms/ArgumentPromotion/attrs.ll25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Transforms/ArgumentPromotion/attrs.ll b/test/Transforms/ArgumentPromotion/attrs.ll
new file mode 100644
index 0000000..0fb38be
--- /dev/null
+++ b/test/Transforms/ArgumentPromotion/attrs.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | opt -argpromotion | llvm-dis | grep zeroext
+
+ %struct.ss = type { i32, i64 }
+
+define internal void @f(%struct.ss* byval %b, i32* byval %X, i32 %i) nounwind {
+entry:
+ %tmp = getelementptr %struct.ss* %b, i32 0, i32 0
+ %tmp1 = load i32* %tmp, align 4
+ %tmp2 = add i32 %tmp1, 1
+ store i32 %tmp2, i32* %tmp, align 4
+
+ store i32 0, i32* %X
+ ret void
+}
+
+define i32 @test(i32* %X) {
+entry:
+ %S = alloca %struct.ss ; <%struct.ss*> [#uses=4]
+ %tmp1 = getelementptr %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
+ store i32 1, i32* %tmp1, align 8
+ %tmp4 = getelementptr %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
+ store i64 2, i64* %tmp4, align 4
+ call void @f( %struct.ss* byval %S, i32* byval %X, i32 zeroext 0)
+ ret i32 0
+}