diff options
author | Tanya Lattner <tonic@nondot.org> | 2007-06-06 21:59:26 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2007-06-06 21:59:26 +0000 |
commit | 682f683669d01f208c647ebce8d41a2580ef7707 (patch) | |
tree | 22e1669c64a0169879c6eef35c26689ae01ce43e /test/Transforms/Inline | |
parent | 25e0cb3180b2d2d13cd613c52bea7ee76daa89dc (diff) | |
download | external_llvm-682f683669d01f208c647ebce8d41a2580ef7707.zip external_llvm-682f683669d01f208c647ebce8d41a2580ef7707.tar.gz external_llvm-682f683669d01f208c647ebce8d41a2580ef7707.tar.bz2 |
Instruct the inliner to obey the noinline attribute. Add test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37481 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/Inline')
-rw-r--r-- | test/Transforms/Inline/2007-06-06-NoInline.ll | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/Transforms/Inline/2007-06-06-NoInline.ll b/test/Transforms/Inline/2007-06-06-NoInline.ll new file mode 100644 index 0000000..51bba07 --- /dev/null +++ b/test/Transforms/Inline/2007-06-06-NoInline.ll @@ -0,0 +1,46 @@ +; RUN: llvm-as < %s | opt -inline -f - | llvm-dis | grep "define internal i32 @bar" +@llvm.noinline = appending global [1 x i8*] [ i8* bitcast (i32 (i32, i32)* @bar to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] + +define internal i32 @bar(i32 %x, i32 %y) { +entry: + %x_addr = alloca i32 ; <i32*> [#uses=2] + %y_addr = alloca i32 ; <i32*> [#uses=2] + %retval = alloca i32, align 4 ; <i32*> [#uses=2] + %tmp = alloca i32, align 4 ; <i32*> [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + store i32 %x, i32* %x_addr + store i32 %y, i32* %y_addr + %tmp1 = load i32* %x_addr ; <i32> [#uses=1] + %tmp2 = load i32* %y_addr ; <i32> [#uses=1] + %tmp3 = add i32 %tmp1, %tmp2 ; <i32> [#uses=1] + store i32 %tmp3, i32* %tmp + %tmp4 = load i32* %tmp ; <i32> [#uses=1] + store i32 %tmp4, i32* %retval + br label %return + +return: ; preds = %entry + %retval5 = load i32* %retval ; <i32> [#uses=1] + ret i32 %retval5 +} + +define i32 @foo(i32 %a, i32 %b) { +entry: + %a_addr = alloca i32 ; <i32*> [#uses=2] + %b_addr = alloca i32 ; <i32*> [#uses=2] + %retval = alloca i32, align 4 ; <i32*> [#uses=2] + %tmp = alloca i32, align 4 ; <i32*> [#uses=2] + %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] + store i32 %a, i32* %a_addr + store i32 %b, i32* %b_addr + %tmp1 = load i32* %b_addr ; <i32> [#uses=1] + %tmp2 = load i32* %a_addr ; <i32> [#uses=1] + %tmp3 = call i32 @bar( i32 %tmp1, i32 %tmp2 ) ; <i32> [#uses=1] + store i32 %tmp3, i32* %tmp + %tmp4 = load i32* %tmp ; <i32> [#uses=1] + store i32 %tmp4, i32* %retval + br label %return + +return: ; preds = %entry + %retval5 = load i32* %retval ; <i32> [#uses=1] + ret i32 %retval5 +} |