[llvm-commits] [llvm] r47831 - /llvm/trunk/lib/Target/README.txt

Chris Lattner sabre at nondot.org
Sun Mar 2 11:29:42 PST 2008


Author: lattner
Date: Sun Mar  2 13:29:42 2008
New Revision: 47831

URL: http://llvm.org/viewvc/llvm-project?rev=47831&view=rev
Log:
another random note

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=47831&r1=47830&r2=47831&view=diff

==============================================================================
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Sun Mar  2 13:29:42 2008
@@ -705,3 +705,26 @@
 }
 
 //===---------------------------------------------------------------------===//
+
+The loop unroller should partially unroll loops (instead of peeling them)
+when code growth isn't too bad and when an unroll count allows simplification
+of some code within the loop.  One trivial example is:
+
+#include <stdio.h>
+int main() {
+    int nRet = 17;
+    int nLoop;
+    for ( nLoop = 0; nLoop < 1000; nLoop++ ) {
+        if ( nLoop & 1 )
+            nRet += 2;
+        else
+            nRet -= 1;
+    }
+    return nRet;
+}
+
+Unrolling by 2 would eliminate the '&1' in both copies, leading to a net
+reduction in code size.  The resultant code would then also be suitable for
+exit value computation.
+
+//===---------------------------------------------------------------------===//





More information about the llvm-commits mailing list