diff options
author | Dan Gohman <gohman@apple.com> | 2010-05-28 16:21:24 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-05-28 16:21:24 +0000 |
commit | ff26d4e9ceabb48463cc1aaeccfd1784fb52f755 (patch) | |
tree | 4ae25c3739b2fb313f735c82b3f627581b5797d4 /test/Other | |
parent | dd9344f3face8f1978a7f9f393c31b628144d1f6 (diff) | |
download | external_llvm-ff26d4e9ceabb48463cc1aaeccfd1784fb52f755.zip external_llvm-ff26d4e9ceabb48463cc1aaeccfd1784fb52f755.tar.gz external_llvm-ff26d4e9ceabb48463cc1aaeccfd1784fb52f755.tar.bz2 |
Teach lint how to look through simple store+load pairs and other
effective no-op constructs, to make it more effective on
unoptimized IR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104950 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Other')
-rw-r--r-- | test/Other/lint.ll | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Other/lint.ll b/test/Other/lint.ll index d0d3c7e..eb6a656 100644 --- a/test/Other/lint.ll +++ b/test/Other/lint.ll @@ -104,3 +104,24 @@ define i8* @return_local(i32 %n, i32 %m) { %s = getelementptr i8* %t, i32 %m ret i8* %s } + +; CHECK: Unusual: Returning alloca or va_arg value +define i32* @return_obscured_local() { +entry: + %retval = alloca i32* + %x = alloca i32 + store i32* %x, i32** %retval + br label %next +next: + %t0 = load i32** %retval + %t1 = insertvalue { i32, i32, i32* } zeroinitializer, i32* %t0, 2 + %t2 = extractvalue { i32, i32, i32* } %t1, 2 + br label %exit +exit: + %t3 = phi i32* [ %t2, %next ] + %t4 = bitcast i32* %t3 to i32* + %t5 = ptrtoint i32* %t4 to i64 + %t6 = add i64 %t5, 0 + %t7 = inttoptr i64 %t6 to i32* + ret i32* %t7 +} |