Add two missed instcombines related to compares with nsw arithmetic.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 27 Mar 2012 22:03:19 +0000 (22:03 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 27 Mar 2012 22:03:19 +0000 (22:03 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153542 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/README.txt

index 1f69ffb09c0a4a04298f9e84b91acd2b3c06b1ec..2d4925d307a5aee5cc6057519711d748193b8e03 100644 (file)
@@ -961,6 +961,18 @@ optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
 
 //===---------------------------------------------------------------------===//
 
+int g(int x) { return (x - 10) < 0; }
+Should combine to "x <= 9" (the sub has nsw).  Currently not
+optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
+
+//===---------------------------------------------------------------------===//
+
+int g(int x) { return (x + 10) < 0; }
+Should combine to "x < -10" (the add has nsw).  Currently not
+optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
+
+//===---------------------------------------------------------------------===//
+
 This was noticed in the entryblock for grokdeclarator in 403.gcc:
 
         %tmp = icmp eq i32 %decl_context, 4