diff options
author | Victor Hernandez <vhernandez@apple.com> | 2009-09-24 17:47:49 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2009-09-24 17:47:49 +0000 |
commit | 96b930ddc7f0df9e278a5cb65ad77a559a20964e (patch) | |
tree | dd7af062fff46c35323ed13331eda6126609cf91 /test | |
parent | c34666ee1871d47dfa4865c7138902dd1b770101 (diff) | |
download | external_llvm-96b930ddc7f0df9e278a5cb65ad77a559a20964e.zip external_llvm-96b930ddc7f0df9e278a5cb65ad77a559a20964e.tar.gz external_llvm-96b930ddc7f0df9e278a5cb65ad77a559a20964e.tar.bz2 |
Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82694 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/PointerTracking/sizes.ll | 2 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/malloc-promote-2.ll | 4 | ||||
-rw-r--r-- | test/Transforms/GlobalOpt/malloc-promote-3.ll | 4 | ||||
-rw-r--r-- | test/Transforms/InstCombine/cast-malloc.ll | 2 | ||||
-rw-r--r-- | test/Transforms/InstCombine/cast.ll | 6 | ||||
-rw-r--r-- | test/Transforms/InstCombine/getelementptr.ll | 2 | ||||
-rw-r--r-- | test/Transforms/InstCombine/malloc-free-delete.ll | 2 | ||||
-rw-r--r-- | test/Transforms/InstCombine/malloc2.ll | 1 |
8 files changed, 13 insertions, 10 deletions
diff --git a/test/Analysis/PointerTracking/sizes.ll b/test/Analysis/PointerTracking/sizes.ll index c0b0606..c6224e0 100644 --- a/test/Analysis/PointerTracking/sizes.ll +++ b/test/Analysis/PointerTracking/sizes.ll @@ -63,7 +63,7 @@ entry: define i32 @foo2(i32 %n) nounwind { entry: %call = malloc i8, i32 %n ; <i8*> [#uses=1] -; CHECK: %call = +; CHECK: %malloccall = ; CHECK: ==> %n elements, %n bytes allocated %call2 = tail call i8* @calloc(i64 2, i64 4) nounwind ; <i8*> [#uses=1] ; CHECK: %call2 = diff --git a/test/Transforms/GlobalOpt/malloc-promote-2.ll b/test/Transforms/GlobalOpt/malloc-promote-2.ll index 0d03835..d3d2252 100644 --- a/test/Transforms/GlobalOpt/malloc-promote-2.ll +++ b/test/Transforms/GlobalOpt/malloc-promote-2.ll @@ -1,4 +1,6 @@ -; RUN: opt < %s -globalopt -S | not grep malloc +; RUN: opt < %s -globalopt -globaldce -S | not grep malloc +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin8" @G = internal global i32* null ; <i32**> [#uses=3] diff --git a/test/Transforms/GlobalOpt/malloc-promote-3.ll b/test/Transforms/GlobalOpt/malloc-promote-3.ll index d4ee4e8..a920b61 100644 --- a/test/Transforms/GlobalOpt/malloc-promote-3.ll +++ b/test/Transforms/GlobalOpt/malloc-promote-3.ll @@ -1,4 +1,6 @@ -; RUN: opt < %s -globalopt -S | not grep malloc +; RUN: opt < %s -globalopt -globaldce -S | not grep malloc +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin8" @G = internal global i32* null ; <i32**> [#uses=4] diff --git a/test/Transforms/InstCombine/cast-malloc.ll b/test/Transforms/InstCombine/cast-malloc.ll index 3754032..43a1489 100644 --- a/test/Transforms/InstCombine/cast-malloc.ll +++ b/test/Transforms/InstCombine/cast-malloc.ll @@ -1,6 +1,6 @@ ; test that casted mallocs get converted to malloc of the right type ; RUN: opt < %s -instcombine -S | \ -; RUN: not grep bitcast +; RUN: grep bitcast | count 1 ; The target datalayout is important for this test case. We have to tell ; instcombine that the ABI alignment for a long is 4-bytes, not 8, otherwise diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index 59d7cd0..2722267 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -79,9 +79,9 @@ define void @test11(i32* %P) { } define i32* @test12() { - %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] - %c = bitcast [4 x i8]* %p to i32* ; <i32*> [#uses=1] - ret i32* %c + %c = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] + %p = bitcast [4 x i8]* %c to i32* ; <i32*> [#uses=1] + ret i32* %p } define i8* @test13(i64 %A) { %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; <i8*> [#uses=1] diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll index ffaa6af..285e0ba 100644 --- a/test/Transforms/InstCombine/getelementptr.ll +++ b/test/Transforms/InstCombine/getelementptr.ll @@ -58,7 +58,7 @@ define i32* @test6() { %B = getelementptr i32* %A, i64 2 ret i32* %B ; CHECK: @test6 -; CHECK: getelementptr [4 x i32]* %M, i64 0, i64 2 +; CHECK: getelementptr i8* %malloccall, i64 8 } define i32* @test7(i32* %I, i64 %C, i64 %D) { diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll index 2ed5ec6..fd91e44 100644 --- a/test/Transforms/InstCombine/malloc-free-delete.ll +++ b/test/Transforms/InstCombine/malloc-free-delete.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -instcombine -S | grep {ret i32 0} -; RUN: opt < %s -instcombine -S | not grep malloc +; RUN: opt < %s -instcombine -globaldce -S | not grep malloc ; PR1201 define i32 @main(i32 %argc, i8** %argv) { %c_19 = alloca i8* ; <i8**> [#uses=2] diff --git a/test/Transforms/InstCombine/malloc2.ll b/test/Transforms/InstCombine/malloc2.ll index 102422e..cc1506b 100644 --- a/test/Transforms/InstCombine/malloc2.ll +++ b/test/Transforms/InstCombine/malloc2.ll @@ -1,5 +1,4 @@ ; RUN: opt < %s -instcombine -S | grep {ret i32 0} -; RUN: opt < %s -instcombine -S | not grep malloc ; PR1313 define i32 @test1(i32 %argc, i8* %argv, i8* %envp) { |