summaryrefslogtreecommitdiff
path: root/test/Transforms/LoopIdiom
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-01 19:39:01 +0000
committerChris Lattner <sabre@nondot.org>2011-01-01 19:39:01 +0000
commit30980b68151a1c1527306aa0f39e3b297af05583 (patch)
tree5540c5deb3b9bb21870f89d7e442951f9ad7db2b /test/Transforms/LoopIdiom
parent7a54997d670d92f7f0ece87911800aa68fcb8c6d (diff)
downloadllvm-30980b68151a1c1527306aa0f39e3b297af05583.tar.gz
llvm-30980b68151a1c1527306aa0f39e3b297af05583.tar.bz2
llvm-30980b68151a1c1527306aa0f39e3b297af05583.tar.xz
implement the "no aliasing accesses in loop" safety check. This pass
should be correct now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122659 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopIdiom')
-rw-r--r--test/Transforms/LoopIdiom/basic.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/LoopIdiom/basic.ll b/test/Transforms/LoopIdiom/basic.ll
index f694474a6c..7f96b3c669 100644
--- a/test/Transforms/LoopIdiom/basic.ll
+++ b/test/Transforms/LoopIdiom/basic.ll
@@ -42,3 +42,26 @@ for.end: ; preds = %for.body, %entry
; CHECK: call void @llvm.memset.p0i8.i64(i8* %Base1, i8 1, i64 %tmp, i32 4, i1 false)
; CHECK-NOT: store
}
+
+; This is a case where there is an extra may-aliased store in the loop, we can't
+; promote the memset.
+define void @test3(i32* %Base, i64 %Size, i8 *%MayAlias) nounwind ssp {
+entry:
+ br label %for.body
+
+for.body: ; preds = %entry, %for.body
+ %i.011 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
+ %add.ptr.i = getelementptr i32* %Base, i64 %i.011
+ store i32 16843009, i32* %add.ptr.i, align 4
+
+ store i8 42, i8* %MayAlias
+ %inc = add nsw i64 %i.011, 1
+ %exitcond = icmp eq i64 %inc, %Size
+ br i1 %exitcond, label %for.end, label %for.body
+
+for.end: ; preds = %entry
+ ret void
+; CHECK: @test3
+; CHECK-NOT: memset
+; CHECK: ret void
+}