diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2005-05-07 20:21:04 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2005-05-07 20:21:04 +0000 |
commit | 29a5bf5f0fe5ebd1494a05b6e75570a0d2d9977f (patch) | |
tree | 248016ef0e33eafe120328b8d8683508617126ae | |
parent | 789082af0399576a80141a8bd6241f96e29e2902 (diff) |
* Break tests into individual cases so its easier to see what's going on.
* Add four new cases to handle the new optimizations for strlen, dealing
with:
strlen(x) != 0 -> *x != 0
strlen(x) == 0 -> *x == 0
for each of two cases: strlen(x) != 0 and strlen(x) == 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21767 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Transforms/SimplifyLibCalls/StrLen.ll | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/test/Transforms/SimplifyLibCalls/StrLen.ll b/test/Transforms/SimplifyLibCalls/StrLen.ll index 48f8bfdcf3..8e5962a10a 100644 --- a/test/Transforms/SimplifyLibCalls/StrLen.ll +++ b/test/Transforms/SimplifyLibCalls/StrLen.ll @@ -8,15 +8,48 @@ declare uint %strlen(sbyte*) implementation ; Functions: -int %main () { +uint %test1() { %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0 + %hello_l = call uint %strlen(sbyte* %hello_p) + ret uint %hello_l +} + +uint %test2() { %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0 + %null_l = call uint %strlen(sbyte* %null_p) + ret uint %null_l +} + +uint %test3() { %null_hello_p = getelementptr [7 x sbyte]* %null_hello, int 0, int 0 + %null_hello_l = call uint %strlen(sbyte* %null_hello_p) + ret uint %null_hello_l +} + +bool %test4() { + %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0 + %hello_l = call uint %strlen(sbyte* %hello_p) + %eq_hello = seteq uint %hello_l, 0 + ret bool %eq_hello +} + +bool %test5() { + %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0 + %null_l = call uint %strlen(sbyte* %null_p) + %eq_null = seteq uint %null_l, 0 + ret bool %eq_null +} + +bool %test6() { + %hello_p = getelementptr [6 x sbyte]* %hello, int 0, int 0 %hello_l = call uint %strlen(sbyte* %hello_p) + %ne_hello = setne uint %hello_l, 0 + ret bool %ne_hello +} + +bool %test7() { + %null_p = getelementptr [1 x sbyte]* %null, int 0, int 0 %null_l = call uint %strlen(sbyte* %null_p) - %null_hello_l = call uint %strlen(sbyte* %null_hello_p) - %sum1 = add uint %hello_l, %null_l - %sum2 = add uint %sum1, %null_hello_l - %result = cast uint %sum2 to int - ret int %result + %ne_null = setne uint %null_l, 0 + ret bool %ne_null } |