Hello,

this patch fixes a typo in type-sinking for bitwise-binary operation X op CST.

ChangeLog gcc/

2011-06-30  Kai Tietz  <kti...@redhat.com>

        * tree-ssa-forwprop.c (simplify_bitwise_binary): Fix typo.

ChangeLog gcc/testsuite

2011-06-30  Kai Tietz  <kti...@redhat.com>

        * gcc.dg/tree-ssa/bitwise-sink.c: New test.

Bootstrapped and regression tested for all standard languages plus Ada and 
Obj-C++ on x86_64-pc-linux-gnu. Ok for apply?

Regards,
Kai

Index: gcc-head/gcc/testsuite/gcc.dg/tree-ssa/bitwise-sink.c
===================================================================
--- /dev/null
+++ gcc-head/gcc/testsuite/gcc.dg/tree-ssa/bitwise-sink.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int
+foo (_Bool x)
+{
+  return (x ^ 1);
+}
+
+/* { dg-final { scan-tree-dump-times "x\[^ \]* \\^ 1" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc-head/gcc/tree-ssa-forwprop.c
===================================================================
--- gcc-head.orig/gcc/tree-ssa-forwprop.c
+++ gcc-head/gcc/tree-ssa-forwprop.c
@@ -1946,7 +1946,7 @@ simplify_bitwise_binary (gimple_stmt_ite
   /* Try to fold (type) X op CST -> (type) (X op ((type-x) CST)).  */
   if (TREE_CODE (arg2) == INTEGER_CST
       && CONVERT_EXPR_CODE_P (def1_code)
-      && INTEGRAL_TYPE_P (def1_arg1)
+      && INTEGRAL_TYPE_P (TREE_TYPE (def1_arg1))
       && int_fits_type_p (arg2, TREE_TYPE (def1_arg1)))
     {
       gimple newop;

Reply via email to