aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-12-23 20:52:52 +0000
committerChris Lattner <sabre@nondot.org>2008-12-23 20:52:52 +0000
commit9cf8ef63c62b0c8865bc4febd45c83e9965b34f2 (patch)
tree92c019d864d3522c682f2e57020595bcae45981c
parent2e24342570dfb574aa26a1921b0fe6faa620a99f (diff)
add some notes for simplifylibcalls optimizations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61385 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/README.txt25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index 2b7e9ed4ff..81b0f9cc23 100644
--- a/lib/Target/README.txt
+++ b/lib/Target/README.txt
@@ -1461,3 +1461,28 @@ void foo (int a, struct T b)
//===---------------------------------------------------------------------===//
+simplifylibcalls should do several optimizations for strspn/strcspn:
+
+strcspn(x, "") -> strlen(x)
+strcspn("", x) -> 0
+strspn("", x) -> 0
+strspn(x, "") -> strlen(x)
+strspn(x, "a") -> strchr(x, 'a')-x
+
+strcspn(x, "a") -> inlined loop for up to 3 letters (similarly for strspn):
+
+size_t __strcspn_c3 (__const char *__s, int __reject1, int __reject2,
+ int __reject3) {
+ register size_t __result = 0;
+ while (__s[__result] != '\0' && __s[__result] != __reject1 &&
+ __s[__result] != __reject2 && __s[__result] != __reject3)
+ ++__result;
+ return __result;
+}
+
+This should turn into a switch on the character. See PR3253 for some notes on
+codegen.
+
+456.hmmer apparently uses strcspn and strspn a lot. 471.omnetpp uses strspn.
+
+//===---------------------------------------------------------------------===//