summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen
diff options
context:
space:
mode:
authorJF Bastien <jfb@google.com>2015-10-28 17:50:23 +0000
committerJF Bastien <jfb@google.com>2015-10-28 17:50:23 +0000
commitddaa1c7eb13f6c8177b880c46cd2ea28bb5917be (patch)
treefffd6086819e4e668e61581cfddb26f430bbe926 /llvm/test/CodeGen
parentc432c8f856e0bd84de980a9d9bb2d31b06fa95b1 (diff)
downloadbcm5719-llvm-ddaa1c7eb13f6c8177b880c46cd2ea28bb5917be.tar.gz
bcm5719-llvm-ddaa1c7eb13f6c8177b880c46cd2ea28bb5917be.zip
WebAssembly: disable some loop-idiom recognition
memset/memcpy aren't fully supported yet. We should invert this test once they are supported. llvm-svn: 251534
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r--llvm/test/CodeGen/WebAssembly/loop-idiom.ll53
1 files changed, 53 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/WebAssembly/loop-idiom.ll b/llvm/test/CodeGen/WebAssembly/loop-idiom.ll
new file mode 100644
index 00000000000..2906df20a22
--- /dev/null
+++ b/llvm/test/CodeGen/WebAssembly/loop-idiom.ll
@@ -0,0 +1,53 @@
+; RUN: opt -loop-idiom -S < %s -march=wasm32 | FileCheck %s
+
+target datalayout = "e-p:32:32-i64:64-n32:64-S128"
+target triple = "wasm32-unknown-unknown"
+
+
+; Make sure loop-idiom doesn't create memcpy or memset. These aren't well
+; supported in WebAssembly for now.
+;
+; TODO Check the patterns are recognized once memcpy / memset are supported.
+
+; CHECK-LABEL: @cpy(
+; CHECK-NOT: llvm.memcpy
+; CHECK: load
+; CHECK: store
+define void @cpy(i64 %Size) {
+bb.nph:
+ %Base = alloca i8, i32 10000
+ %Dest = alloca i8, i32 10000
+ br label %for.body
+
+for.body:
+ %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %for.body ]
+ %I.0.014 = getelementptr i8, i8* %Base, i64 %indvar
+ %DestI = getelementptr i8, i8* %Dest, i64 %indvar
+ %V = load i8, i8* %I.0.014, align 1
+ store i8 %V, i8* %DestI, align 1
+ %indvar.next = add i64 %indvar, 1
+ %exitcond = icmp eq i64 %indvar.next, %Size
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end:
+ ret void
+}
+
+; CHECK-LABEL: @set(
+; CHECK-NOT: llvm.memset
+; CHECK: store
+define void @set(i8* %Base, i64 %Size) {
+bb.nph:
+ br label %for.body
+
+for.body:
+ %indvar = phi i64 [ 0, %bb.nph ], [ %indvar.next, %for.body ]
+ %I.0.014 = getelementptr i8, i8* %Base, i64 %indvar
+ store i8 0, i8* %I.0.014, align 1
+ %indvar.next = add i64 %indvar, 1
+ %exitcond = icmp eq i64 %indvar.next, %Size
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end:
+ ret void
+}
OpenPOWER on IntegriCloud