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

Unified Diff: test/Transforms/NaCl/rewrite-agg-arg.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 | « lib/Transforms/NaCl/RewriteAggFuns.cpp ('k') | test/Transforms/NaCl/rewrite-agg-ret.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/Transforms/NaCl/rewrite-agg-arg.ll
diff --git a/test/Transforms/NaCl/rewrite-agg-arg.ll b/test/Transforms/NaCl/rewrite-agg-arg.ll
new file mode 100644
index 0000000000000000000000000000000000000000..4fc39cb1e0fc34bcf638526ebb7c441930592f43
--- /dev/null
+++ b/test/Transforms/NaCl/rewrite-agg-arg.ll
@@ -0,0 +1,82 @@
+; RUN: opt -S -rewrite-aggregate-arguments %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 @arrayarg([2 x i32]* nocapture nonnull dereferenceable(8) %a)
+define void @arrayarg([2 x i32] %a) {
+; CHECK-NEXT: agg-arg-loads:
+; CHECK-NEXT: %a.load = load [2 x i32], [2 x i32]* %a
+
+; CHECK: %a.load.call-store = alloca [2 x i32]
+; CHECK-NEXT: store [2 x i32] %a.load, [2 x i32]* %a.load.call-store
+ call void @arrayarg([2 x i32] %a)
+; CHECK: call void %.fty-cast([2 x i32]* nocapture nonnull dereferenceable(8) %a.load.call-store)
+ ret void
+}
+
+; CHECK-LABEL: void @structarg(%struct* nocapture nonnull dereferenceable(8) %a)
+define void @structarg(%struct %a) {
+; CHECK-NEXT: agg-arg-loads:
+; CHECK-NEXT: %a.load = load %struct, %struct* %a
+
+; CHECK: %a.load.call-store = alloca %struct
+; CHECK-NEXT: store %struct %a.load, %struct* %a.load.call-store
+ call void @structarg(%struct %a)
+; CHECK: call void %.fty-cast(%struct* nocapture nonnull dereferenceable(8) %a.load.call-store)
+ ret void
+}
+
+; CHECK-LABEL: void @vectorarg(<4 x i32>* nocapture nonnull dereferenceable(16) %a)
+define void @vectorarg(<4 x i32> %a) {
+; CHECK-NEXT: agg-arg-loads:
+; CHECK-NEXT: %a.load = load <4 x i32>, <4 x i32>* %a
+
+; CHECK: %a.load.call-store = alloca <4 x i32>
+; CHECK-NEXT: store <4 x i32> %a.load, <4 x i32>* %a.load.call-store
+ call void @vectorarg(<4 x i32> %a)
+; CHECK: call void %.fty-cast(<4 x i32>* nocapture nonnull dereferenceable(16) %a.load.call-store)
+ ret void
+}
+
+; CHECK-LABEL: void @multipleargs(i32 %a, %struct* nocapture nonnull dereferenceable(8) %b)
+define void @multipleargs(i32 %a, %struct %b) {
+; CHECK-NEXT: agg-arg-loads:
+; CHECK-NEXT: %b.load = load %struct, %struct* %b
+
+; CHECK: %b.load.call-store = alloca %struct
+; CHECK-NEXT: store %struct %b.load, %struct* %b.load.call-store
+ call void @multipleargs(i32 %a, %struct %b)
+; CHECK: call void %.fty-cast(i32 %a, %struct* nocapture nonnull dereferenceable(8) %b.load.call-store)
+ ret void
+}
+
+; CHECK-LABEL: void @multiplecalls()
+define void @multiplecalls() {
+; CHECK-NEXT: %.call-store = alloca <4 x i32>
+; CHECK-NEXT: store <4 x i32> undef, <4 x i32>* %.call-store
+ call void @vectorarg(<4 x i32> undef)
+; CHECK: call void %.fty-cast(<4 x i32>* nocapture nonnull dereferenceable(16) %.call-store)
+
+; CHECK-NEXT: %.call-store1 = alloca %struct
+; CHECK-NEXT: store %struct undef, %struct* %.call-store1
+ call void @multipleargs(i32 0, %struct undef)
+; CHECK: call void %.fty-cast2(i32 0, %struct* nocapture nonnull dereferenceable(8) %.call-store1)
+ ret void
+}
+
+; CHECK-LABEL: void @indirectcall(void (%struct)* %f)
+define void @indirectcall(void (%struct)* %f) {
+; CHECK-NEXT: %.call-store = alloca %struct
+; CHECK-NEXT: store %struct undef, %struct* %.call-store
+; CHECK-NEXT: %f.fty-cast = bitcast void (%struct)* %f to void (%struct*)*
+ call void %f(%struct undef)
+; CHECK-NEXT: call void %f.fty-cast(%struct* nocapture nonnull dereferenceable(8) %.call-store)
+ ret void
+}
+
+; CHECK-LABEL: void @argattrs(i8* nonnull, %struct* nocapture nonnull dereferenceable(8))
+define void @argattrs(i8* nonnull, %struct) {
+ ret void
+}
« no previous file with comments | « lib/Transforms/NaCl/RewriteAggFuns.cpp ('k') | test/Transforms/NaCl/rewrite-agg-ret.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698