summaryrefslogtreecommitdiff
path: root/test/Transforms/DeadStoreElimination
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-30 07:23:21 +0000
committerChris Lattner <sabre@nondot.org>2010-11-30 07:23:21 +0000
commitcf82dc376a11acb1b5d46d56c032bb0b9326c682 (patch)
tree5465dd3586d482a9c497d0d4a84f94b3d44581b0 /test/Transforms/DeadStoreElimination
parentc413330c99a573ef3ffe80a46400b1d3eca2398d (diff)
downloadllvm-cf82dc376a11acb1b5d46d56c032bb0b9326c682.tar.gz
llvm-cf82dc376a11acb1b5d46d56c032bb0b9326c682.tar.bz2
llvm-cf82dc376a11acb1b5d46d56c032bb0b9326c682.tar.xz
Rewrite the main DSE loop to be written in terms of reasoning
about pairs of AA::Location's instead of looking for MemDep's "Def" predicate. This is more powerful and general, handling memset/memcpy/store all uniformly, and implementing PR8701 and probably obsoleting parts of memcpyoptimizer. This also fixes an obscure bug with init.trampoline and i8 stores, but I'm not surprised it hasn't been hit yet. Enhancing init.trampoline to carry the size that it stores would allow DSE to be much more aggressive about optimizing them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120406 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/DeadStoreElimination')
-rw-r--r--test/Transforms/DeadStoreElimination/simple.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Transforms/DeadStoreElimination/simple.ll b/test/Transforms/DeadStoreElimination/simple.ll
index 1aa62bb6e0..0c05b15357 100644
--- a/test/Transforms/DeadStoreElimination/simple.ll
+++ b/test/Transforms/DeadStoreElimination/simple.ll
@@ -177,3 +177,36 @@ define void @test14(i32* %Q) {
; CHECK-NEXT: ret void
}
+
+; PR8701
+
+;; Fully dead overwrite of memcpy.
+define void @test15(i8* %P, i8* %Q) nounwind ssp {
+ tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 12, i32 1)
+ tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 12, i32 1)
+ ret void
+; CHECK: @test15
+; CHECK-NEXT: call void @llvm.memcpy
+; CHECK-NEXT: ret
+}
+
+;; Full overwrite of smaller memcpy.
+define void @test16(i8* %P, i8* %Q) nounwind ssp {
+ tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 8, i32 1)
+ tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 12, i32 1)
+ ret void
+; CHECK: @test16
+; CHECK-NEXT: call void @llvm.memcpy
+; CHECK-NEXT: ret
+}
+
+;; Overwrite of memset by memcpy.
+define void @test17(i8* %P, i8* %Q) nounwind ssp {
+ tail call void @llvm.memset.i64(i8* %P, i8 42, i64 8, i32 1)
+ tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 12, i32 1)
+ ret void
+; CHECK: @test17
+; CHECK-NEXT: call void @llvm.memcpy
+; CHECK-NEXT: ret
+}
+