aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-10-17 20:12:58 +0000
committerDevang Patel <dpatel@apple.com>2007-10-17 20:12:58 +0000
commit84458323a254c4ee31aae553f1a8b66742cd0562 (patch)
treee6c98b3ee1e06cc7c8a675d9f8d2ad6c235d44df
parent469b7a4ec114c9b7ecb438b253c489542ba1c96e (diff)
Do not raise free() call that is called through invoke instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43083 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/IPO/RaiseAllocations.cpp2
-rw-r--r--test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll17
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index 44702bc817..e6d8723f45 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -204,6 +204,8 @@ bool RaiseAllocations::runOnModule(Module &M) {
Users.pop_back();
if (Instruction *I = dyn_cast<Instruction>(U)) {
+ if (isa<InvokeInst>(I))
+ continue;
CallSite CS = CallSite::get(I);
if (CS.getInstruction() && !CS.arg_empty() &&
(CS.getCalledFunction() == FreeFunc ||
diff --git a/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll b/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll
new file mode 100644
index 0000000000..513cf6f339
--- /dev/null
+++ b/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll
@@ -0,0 +1,17 @@
+; RUN: llvm-as <%s | opt -raiseallocs -stats -disable-output |& \
+; RUN: not grep {Number of allocations raised}
+define void @foo() {
+entry:
+ %buffer = alloca i16*
+ %tmp = load i16** %buffer, align 8
+ invoke i32(...)* @free(i16* %tmp)
+ to label %invcont unwind label %unwind
+invcont:
+ br label %finally
+unwind:
+ br label %finally
+finally:
+ ret void
+}
+declare i32 @free(...)
+