diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-06 23:36:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-06 23:36:59 +0000 |
commit | 3d2e54bb742505089a88ca7944921a8128d0b291 (patch) | |
tree | 54cef1587abdb46193f65b3b59f8852a74390809 | |
parent | 09c11aa7f599e783a4c9fe489de7cf365f1f8bb9 (diff) | |
download | llvm-3d2e54bb742505089a88ca7944921a8128d0b291.tar.gz llvm-3d2e54bb742505089a88ca7944921a8128d0b291.tar.bz2 llvm-3d2e54bb742505089a88ca7944921a8128d0b291.tar.xz |
testcase for PR1307
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35705 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll b/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll new file mode 100644 index 0000000000..7c78355e6d --- /dev/null +++ b/test/Transforms/SimplifyLibCalls/2007-04-06-strchr-miscompile.ll @@ -0,0 +1,28 @@ +; RUN: llvm-as < %s | opt -simplify-libcalls -instcombine | llvm-dis > %t && +; RUN: grep '@str,.*i64 3' %t && +; RUN: grep '@str1,.*i64 7' %t && +; RUN: grep 'ret i8.*null' %t +; PR1307 + +@str = internal constant [5 x i8] c"foog\00" +@str1 = internal constant [8 x i8] c"blahhh!\00" +@str2 = internal constant [5 x i8] c"Ponk\00" + +define i8* @test1() { + %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str, i32 0, i32 2), i32 103 ) ; <i8*> [#uses=1] + ret i8* %tmp3 +} + +declare i8* @strchr(i8*, i32) + +define i8* @test2() { + %tmp3 = tail call i8* @strchr( i8* getelementptr ([8 x i8]* @str1, i32 0, i32 2), i32 0 ) ; <i8*> [#uses=1] + ret i8* %tmp3 +} + +define i8* @test3() { +entry: + %tmp3 = tail call i8* @strchr( i8* getelementptr ([5 x i8]* @str2, i32 0, i32 1), i32 80 ) ; <i8*> [#uses=1] + ret i8* %tmp3 +} + |