[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.`

llvm-svn: 310504
This commit is contained in:
Siddharth Bhat 2017-08-09 18:19:46 +00:00
parent 49e5acab33
commit 9298ff2dee
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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"