diff options
author | Chris Lattner <sabre@nondot.org> | 2008-01-17 01:17:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-01-17 01:17:03 +0000 |
commit | ab04e13a1f017c2b0a82344b4c083d92139ee2cc (patch) | |
tree | 2cf96957333606d277053e4ad193fab92eca4d19 /test/Transforms | |
parent | 644340a9bdc663762a58784e0b86c87aeeb41116 (diff) |
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')
-rw-r--r-- | test/Transforms/ArgumentPromotion/attrs.ll | 25 |
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 0000000000..0fb38be1f0 --- /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 +} |