aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/LoopIdiom
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-19 19:35:49 +0000
committerChris Lattner <sabre@nondot.org>2011-02-19 19:35:49 +0000
commit41bfbb0a8776674c486682cbf2aa80f15abfef68 (patch)
treedac0ce40b8e7de6eb9cca6196fca47833cb4ddb8 /test/Transforms/LoopIdiom
parent3a393728a62122d7009d8e2cbe52a221874e576a (diff)
downloadexternal_llvm-41bfbb0a8776674c486682cbf2aa80f15abfef68.zip
external_llvm-41bfbb0a8776674c486682cbf2aa80f15abfef68.tar.gz
external_llvm-41bfbb0a8776674c486682cbf2aa80f15abfef68.tar.bz2
Stores of null pointers should turn into memset, we weren't recognizing
them as splat values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126041 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopIdiom')
-rw-r--r--test/Transforms/LoopIdiom/basic.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Transforms/LoopIdiom/basic.ll b/test/Transforms/LoopIdiom/basic.ll
index ead2e6f..122d25a 100644
--- a/test/Transforms/LoopIdiom/basic.ll
+++ b/test/Transforms/LoopIdiom/basic.ll
@@ -299,4 +299,26 @@ for.end: ; preds = %for.body
; CHECK: ret void
}
+; Store of null should turn into memset of zero.
+define void @test12(i32** nocapture %P) nounwind ssp {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %indvar = phi i64 [ 0, %entry ], [ %indvar.next, %for.body ]
+ %arrayidx = getelementptr i32** %P, i64 %indvar
+ store i32* null, i32** %arrayidx, align 4
+ %indvar.next = add i64 %indvar, 1
+ %exitcond = icmp eq i64 %indvar.next, 10000
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %for.body
+ ret void
+; CHECK: @test12
+; CHECK-NEXT: entry:
+; CHECK-NEXT: bitcast
+; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* %P1, i8 0, i64 80000, i32 4, i1 false)
+; CHECK-NOT: store
+; CHECK: ret void
+}