[polly] r310504 - [ManagedMemoryRewrite] [Polly] Erase original malloc and free. [NFC]
Siddharth Bhat via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 11:19:46 PDT 2017
Author: bollu
Date: Wed Aug 9 11:19:46 2017
New Revision: 310504
URL: http://llvm.org/viewvc/llvm-project?rev=310504&view=rev
Log:
[ManagedMemoryRewrite] [Polly] Erase original malloc and free. [NFC]
We do not need to keep `malloc` and `free` around since they are
replaced by `polly_{malloc,free}Managed.`
Modified:
polly/trunk/lib/CodeGen/ManagedMemoryRewrite.cpp
polly/trunk/test/GPGPU/managed-memory-rewrite-malloc-free.ll
Modified: polly/trunk/lib/CodeGen/ManagedMemoryRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/ManagedMemoryRewrite.cpp?rev=310504&r1=310503&r2=310504&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/ManagedMemoryRewrite.cpp (original)
+++ polly/trunk/lib/CodeGen/ManagedMemoryRewrite.cpp Wed Aug 9 11:19:46 2017
@@ -102,6 +102,7 @@ public:
Function *PollyMallocManaged = GetOrCreatePollyMallocManaged(M);
assert(PollyMallocManaged && "unable to create polly_mallocManaged");
Malloc->replaceAllUsesWith(PollyMallocManaged);
+ Malloc->eraseFromParent();
}
Function *Free = M.getFunction("free");
@@ -110,6 +111,7 @@ public:
Function *PollyFreeManaged = GetOrCreatePollyFreeManaged(M);
assert(PollyFreeManaged && "unable to create polly_freeManaged");
Free->replaceAllUsesWith(PollyFreeManaged);
+ Free->eraseFromParent();
}
return true;
Modified: polly/trunk/test/GPGPU/managed-memory-rewrite-malloc-free.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/GPGPU/managed-memory-rewrite-malloc-free.ll?rev=310504&r1=310503&r2=310504&view=diff
==============================================================================
--- polly/trunk/test/GPGPU/managed-memory-rewrite-malloc-free.ll (original)
+++ polly/trunk/test/GPGPU/managed-memory-rewrite-malloc-free.ll Wed Aug 9 11:19:46 2017
@@ -41,6 +41,10 @@
; HOST-IR call void @polly_freeManaged(i8* %toFreeBitcast)
; HOST-IR: declare void @polly_freeManaged(i8*)
+; // Check that we remove the original malloc,free
+; HOST-IR-NOT: declare i8* @malloc(i64)
+; HOST-IR-NOT: declare void @free(i8*)
+
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0"
More information about the llvm-commits
mailing list