summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeador Inge <meadori@codesourcery.com>2012-11-11 07:10:25 +0000
committerMeador Inge <meadori@codesourcery.com>2012-11-11 07:10:25 +0000
commit0c4cbc33ddd648669cddef0876cdbb68cfc209c3 (patch)
tree8700f815a789bb77fec26e136635cb565693130e
parent26ebe398f2bddae5395b4ad8c7ffb5933b2230d1 (diff)
downloadllvm-0c4cbc33ddd648669cddef0876cdbb68cfc209c3.tar.gz
llvm-0c4cbc33ddd648669cddef0876cdbb68cfc209c3.tar.bz2
llvm-0c4cbc33ddd648669cddef0876cdbb68cfc209c3.tar.xz
Remove hard-coded constant in Transforms/InstCombine/memcmp-1.ll
Transforms/InstCombine/memcmp-1.ll has a test case that looks like: @foo = constant [4 x i8] c"foo\00" @hel = constant [4 x i8] c"hel\00" ... %mem1 = getelementptr [4 x i8]* @hel, i32 0, i32 0 %mem2 = getelementptr [4 x i8]* @foo, i32 0, i32 0 %ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3) ret i32 %ret ; CHECK: ret i32 2 The folded return value (2 above) is computed using the system memcmp that the compiler is linked with. This can return different values on different systems. The test was originally written on an OS X 10.7.5 x86-64 box and passed. However, it failed on one of the x86-64 FreeBSD buildbots because the system memcpy on that machine returned a different value (1 instead of 2). I fixed the test by checking the folding constants with regexes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167691 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Transforms/InstCombine/memcmp-1.ll11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/memcmp-1.ll b/test/Transforms/InstCombine/memcmp-1.ll
index 862fd3a85a..4238c5f8fb 100644
--- a/test/Transforms/InstCombine/memcmp-1.ll
+++ b/test/Transforms/InstCombine/memcmp-1.ll
@@ -59,5 +59,14 @@ define i32 @test_simplify5() {
%mem2 = getelementptr [4 x i8]* @foo, i32 0, i32 0
%ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
ret i32 %ret
-; CHECK: ret i32 2
+; CHECK: ret i32 {{[0-9]+}}
+}
+
+define i32 @test_simplify6() {
+; CHECK: @test_simplify6
+ %mem1 = getelementptr [4 x i8]* @foo, i32 0, i32 0
+ %mem2 = getelementptr [4 x i8]* @hel, i32 0, i32 0
+ %ret = call i32 @memcmp(i8* %mem1, i8* %mem2, i32 3)
+ ret i32 %ret
+; CHECK: ret i32 {{-[0-9]+}}
}