[llvm-commits] CVS: llvm/lib/Target/README.txt

Nick Lewycky nicholas at mxc.ca
Sun Nov 12 16:23:49 PST 2006



Changes in directory llvm/lib/Target:

README.txt updated: 1.47 -> 1.48
---
Log message:

Cute example from Chris Lattner.


---
Diffs of the changes:  (+40 -0)

 README.txt |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+)


Index: llvm/lib/Target/README.txt
diff -u llvm/lib/Target/README.txt:1.47 llvm/lib/Target/README.txt:1.48
--- llvm/lib/Target/README.txt:1.47	Thu Nov  9 18:23:26 2006
+++ llvm/lib/Target/README.txt	Sun Nov 12 18:23:28 2006
@@ -360,3 +360,43 @@
 pass.
 
 //===---------------------------------------------------------------------===//
+
+-predsimplify should transform this:
+
+void bad(unsigned x)
+{
+  if (x > 4)
+    bar(12);
+  else if (x > 3)
+    bar(523);
+  else if (x > 2)
+    bar(36);
+  else if (x > 1)
+    bar(65);
+  else if (x > 0)
+    bar(45);
+  else
+    bar(367);
+}
+
+into:
+
+void good(unsigned x)
+{
+  if (x == 4)
+    bar(523);
+  else if (x == 3)
+    bar(36);
+  else if (x == 2)
+    bar(65);
+  else if (x == 1)
+    bar(45);
+  else if (x == 0)
+    bar(367);
+  else
+    bar(12);
+}
+
+to enable further optimizations.
+
+//===---------------------------------------------------------------------===//






More information about the llvm-commits mailing list