aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-10-24 04:23:03 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-10-24 04:23:03 +0000
commit66284e063a1e46500acae48bdc0e4a00652021d1 (patch)
tree7326efcf20c334046c044082a205dc2eb1f17466 /test
parent5a850beb2e3032e6ff3474ce5317f5454060328c (diff)
downloadexternal_llvm-66284e063a1e46500acae48bdc0e4a00652021d1.zip
external_llvm-66284e063a1e46500acae48bdc0e4a00652021d1.tar.gz
external_llvm-66284e063a1e46500acae48bdc0e4a00652021d1.tar.bz2
Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst. Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/malloc-free-delete.ll6
-rw-r--r--test/Transforms/RaiseAllocations/2004-11-08-FreeUseCrash.ll10
-rw-r--r--test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll17
-rw-r--r--test/Transforms/RaiseAllocations/FreeCastConstantExpr.ll11
-rw-r--r--test/Transforms/RaiseAllocations/dg.exp3
5 files changed, 4 insertions, 43 deletions
diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll
index fd91e44..a4b7496 100644
--- a/test/Transforms/InstCombine/malloc-free-delete.ll
+++ b/test/Transforms/InstCombine/malloc-free-delete.ll
@@ -1,11 +1,13 @@
-; RUN: opt < %s -instcombine -S | grep {ret i32 0}
-; RUN: opt < %s -instcombine -globaldce -S | not grep malloc
+; RUN: opt < %s -instcombine -globaldce -S | FileCheck %s
; PR1201
define i32 @main(i32 %argc, i8** %argv) {
%c_19 = alloca i8* ; <i8**> [#uses=2]
%malloc_206 = malloc i8, i32 10 ; <i8*> [#uses=1]
+; CHECK-NOT: malloc
store i8* %malloc_206, i8** %c_19
%tmp_207 = load i8** %c_19 ; <i8*> [#uses=1]
free i8* %tmp_207
+; CHECK-NOT: free
ret i32 0
+; CHECK: ret i32 0
}
diff --git a/test/Transforms/RaiseAllocations/2004-11-08-FreeUseCrash.ll b/test/Transforms/RaiseAllocations/2004-11-08-FreeUseCrash.ll
deleted file mode 100644
index 75e02e8..0000000
--- a/test/Transforms/RaiseAllocations/2004-11-08-FreeUseCrash.ll
+++ /dev/null
@@ -1,10 +0,0 @@
-; RUN: opt < %s -raiseallocs -disable-output
-
-define void @main() {
- %tmp.13 = call i32 (...)* @free( i32 32 ) ; <i32> [#uses=1]
- %tmp.14 = inttoptr i32 %tmp.13 to i32* ; <i32*> [#uses=0]
- ret void
-}
-
-declare i32 @free(...)
-
diff --git a/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll b/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll
deleted file mode 100644
index 675bb3d..0000000
--- a/test/Transforms/RaiseAllocations/2007-10-17-InvokeFree.ll
+++ /dev/null
@@ -1,17 +0,0 @@
-; RUN: opt < %s -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(...)
-
diff --git a/test/Transforms/RaiseAllocations/FreeCastConstantExpr.ll b/test/Transforms/RaiseAllocations/FreeCastConstantExpr.ll
deleted file mode 100644
index 1cf0729..0000000
--- a/test/Transforms/RaiseAllocations/FreeCastConstantExpr.ll
+++ /dev/null
@@ -1,11 +0,0 @@
-; This situation can occur due to the funcresolve pass.
-;
-; RUN: opt < %s -raiseallocs -S | not grep call
-
-declare void @free(i8*)
-
-define void @test(i32* %P) {
- call void bitcast (void (i8*)* @free to void (i32*)*)( i32* %P )
- ret void
-}
-
diff --git a/test/Transforms/RaiseAllocations/dg.exp b/test/Transforms/RaiseAllocations/dg.exp
deleted file mode 100644
index f200589..0000000
--- a/test/Transforms/RaiseAllocations/dg.exp
+++ /dev/null
@@ -1,3 +0,0 @@
-load_lib llvm.exp
-
-RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]