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

Nick Lewycky nicholas at mxc.ca
Sun Nov 15 09:51:23 PST 2009


Author: nicholas
Date: Sun Nov 15 11:51:23 2009
New Revision: 88855

URL: http://llvm.org/viewvc/llvm-project?rev=88855&view=rev
Log:
Add a complex missed optimization opportunity I came across while investigating
bug 5438.

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=88855&r1=88854&r2=88855&view=diff

==============================================================================
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Sun Nov 15 11:51:23 2009
@@ -1719,3 +1719,18 @@
 int bar() { return foo("abcd"); }
 
 //===---------------------------------------------------------------------===//
+
+InstCombine should use SimplifyDemandedBits to remove the or instruction:
+
+define i1 @test(i8 %x, i8 %y) {
+  %A = or i8 %x, 1
+  %B = icmp ugt i8 %A, 3
+  ret i1 %B
+}
+
+Currently instcombine calls SimplifyDemandedBits with either all bits or just
+the sign bit, if the comparison is obviously a sign test. In this case, we only
+need all but the bottom two bits from %A, and if we gave that mask to SDB it
+would delete the or instruction for us.
+
+//===---------------------------------------------------------------------===//





More information about the llvm-commits mailing list