summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorPhilip Reames <listmail@philipreames.com>2018-08-21 00:37:09 +0000
committerPhilip Reames <listmail@philipreames.com>2018-08-21 00:37:09 +0000
commitefdd0a426a1176859c6e62d02faa11c2630a17ae (patch)
treed7531ee6f598126719dab52c0a818e089a2ee4b7 /llvm/test
parent4009487e5caaeb0f40dfadcfec6b88d527911d54 (diff)
downloadbcm5719-llvm-efdd0a426a1176859c6e62d02faa11c2630a17ae.tar.gz
bcm5719-llvm-efdd0a426a1176859c6e62d02faa11c2630a17ae.zip
[LICM][NFC] Add tests from D50730
Landing tests so corresponding change can show effects clearly. see D50730 [AST] Generalize argument specific aliasing llvm-svn: 340243
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/LICM/argmemonly-call.ll38
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LICM/argmemonly-call.ll b/llvm/test/Transforms/LICM/argmemonly-call.ll
index b7d7d6a3953..c66391bd11a 100644
--- a/llvm/test/Transforms/LICM/argmemonly-call.ll
+++ b/llvm/test/Transforms/LICM/argmemonly-call.ll
@@ -95,3 +95,41 @@ loop:
br label %loop
}
+
+; memcpy doesn't write to it's source argument, so loads to that location
+; can still be hoisted
+define void @test6(i32* noalias %loc, i32* noalias %loc2) {
+; CHECK-LABEL: @test6
+; CHECK: %val = load i32, i32* %loc2
+; CHECK-LABEL: loop:
+; CHECK: @llvm.memcpy
+ br label %loop
+
+loop:
+ %val = load i32, i32* %loc2
+ store i32 %val, i32* %loc
+ %dest = bitcast i32* %loc to i8*
+ %src = bitcast i32* %loc2 to i8*
+ call void @llvm.memcpy.p0i8.p0i8.i64(i8* %dest, i8* %src, i64 8, i1 false)
+ br label %loop
+}
+
+; FIXME: argument aliasing should let us do this transform
+define void @test7(i32* noalias %loc, i32* noalias %loc2) {
+; CHECK-LABEL: @test7
+; CHECK-LABEL: loop:
+; CHECK: %val = load i32, i32* %loc2
+; CHECK: @custom_memcpy
+ br label %loop
+
+loop:
+ %val = load i32, i32* %loc2
+ store i32 %val, i32* %loc
+ %dest = bitcast i32* %loc to i8*
+ %src = bitcast i32* %loc2 to i8*
+ call void @custom_memcpy(i8* %dest, i8* %src)
+ br label %loop
+}
+
+declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)
+declare void @custom_memcpy(i8* nocapture writeonly, i8* nocapture readonly) argmemonly nounwind
OpenPOWER on IntegriCloud