[llvm] r340243 - [LICM][NFC] Add tests from D50730

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 17:37:10 PDT 2018


Author: reames
Date: Mon Aug 20 17:37:09 2018
New Revision: 340243

URL: http://llvm.org/viewvc/llvm-project?rev=340243&view=rev
Log:
[LICM][NFC] Add tests from D50730

Landing tests so corresponding change can show effects clearly.  see
D50730 [AST] Generalize argument specific aliasing


Modified:
    llvm/trunk/test/Transforms/LICM/argmemonly-call.ll

Modified: llvm/trunk/test/Transforms/LICM/argmemonly-call.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/argmemonly-call.ll?rev=340243&r1=340242&r2=340243&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LICM/argmemonly-call.ll (original)
+++ llvm/trunk/test/Transforms/LICM/argmemonly-call.ll Mon Aug 20 17:37:09 2018
@@ -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




More information about the llvm-commits mailing list