[llvm-commits] [llvm] r61385 - /llvm/trunk/lib/Target/README.txt
Chris Lattner
sabre at nondot.org
Tue Dec 23 12:52:53 PST 2008
Author: lattner
Date: Tue Dec 23 14:52:52 2008
New Revision: 61385
URL: http://llvm.org/viewvc/llvm-project?rev=61385&view=rev
Log:
add some notes for simplifylibcalls optimizations
Modified:
llvm/trunk/lib/Target/README.txt
Modified: llvm/trunk/lib/Target/README.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=61385&r1=61384&r2=61385&view=diff
==============================================================================
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Tue Dec 23 14:52:52 2008
@@ -1461,3 +1461,28 @@
//===---------------------------------------------------------------------===//
+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.
+
+//===---------------------------------------------------------------------===//
More information about the llvm-commits
mailing list