Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: test/Transforms/NaCl/rewrite-agg-ret.ll

Issue 1207543003: PNaCl: Add two new passes: `-rewrite-aggregate-arguments && `-rewrite-aggregate-returns`. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Fix and add a test. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/Transforms/NaCl/rewrite-agg-arg.ll ('k') | tools/bugpoint/bugpoint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/Transforms/NaCl/rewrite-agg-ret.ll
diff --git a/test/Transforms/NaCl/rewrite-agg-ret.ll b/test/Transforms/NaCl/rewrite-agg-ret.ll
new file mode 100644
index 0000000000000000000000000000000000000000..ebaf6d83e2c38bc9571eaa8b9d19742f2fd02949
--- /dev/null
+++ b/test/Transforms/NaCl/rewrite-agg-ret.ll
@@ -0,0 +1,51 @@
+; RUN: opt -S -rewrite-aggregate-returns %s | FileCheck %s
+
+target datalayout = "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32"
+
+%struct = type { i8, i32 }
+
+; CHECK-LABEL: void @structret(%struct* nocapture nonnull sret dereferenceable(8))
+define %struct @structret() {
+; CHECK-NEXT: %a.ret-value = alloca %struct
+ %a = call %struct @structret()
+; CHECK: call void %.fty-cast(%struct* nocapture nonnull sret dereferenceable(8) %a.ret-value)
+; CHECK-NEXT: %a = load %struct, %struct* %a.ret-value
+ ret %struct %a
+; CHECK-NEXT: store %struct %a, %struct* %0
+; CHECK-NEXT: ret void
+}
+
+; CHECK-LABEL: void @arrayret([4 x i32]* nocapture nonnull sret dereferenceable(16))
+define [4 x i32] @arrayret() {
+; CHECK-NEXT: %a.ret-value = alloca [4 x i32]
+ %a = call [4 x i32] @arrayret()
+; CHECK: call void %.fty-cast([4 x i32]* nocapture nonnull sret dereferenceable(16) %a.ret-value)
+; CHECK-NEXT: %a = load [4 x i32], [4 x i32]* %a.ret-value
+ ret [4 x i32] %a
+; CHECK-NEXT: store [4 x i32] %a, [4 x i32]* %0
+; CHECK-NEXT: ret void
+}
+
+; CHECK-LABEL: void @vectorret(<4 x float>* nocapture nonnull sret dereferenceable(16))
+define <4 x float> @vectorret() {
+; CHECK-NEXT: %a.ret-value = alloca <4 x float>
+ %a = call <4 x float> @vectorret()
+; CHECK: call void %.fty-cast(<4 x float>* nocapture nonnull sret dereferenceable(16) %a.ret-value)
+; CHECK-NEXT: %a = load <4 x float>, <4 x float>* %a.ret-value
+ ret <4 x float> %a
+; CHECK-NEXT: store <4 x float> %a, <4 x float>* %0
+; CHECK-NEXT: ret void
+}
+
+; CHECK-LABEL: void @argattrs(%struct* nocapture nonnull sret dereferenceable(8), i32* nocapture, i32)
+define %struct @argattrs(i32* nocapture, i32) {
+ ret %struct undef
+}
+
+; CHECK-LABEL: void @indirectcall(<4 x float> ()* %f)
+define void @indirectcall(<4 x float> ()* %f) {
+; CHECK: bitcast
+ %a = call <4 x float> %f()
+; CHECK-NEXT: call void %f.fty-cast(<4 x float>* nocapture nonnull sret %a.ret-value)
+ ret void
+}
« no previous file with comments | « test/Transforms/NaCl/rewrite-agg-arg.ll ('k') | tools/bugpoint/bugpoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698