From 80d3dd383afb693f1842716d001d358976910ce9 Mon Sep 17 00:00:00 2001 From: Kai Tietz Date: Fri, 1 Jul 2011 12:00:25 +0200 Subject: [PATCH] tree-ssa-forwprop.c (simplify_bitwise_binary): Fix typo. 2011-07-01 Kai Tietz * tree-ssa-forwprop.c (simplify_bitwise_binary): Fix typo. 2011-07-01 Kai Tietz * gcc.dg/tree-ssa/bitwise-sink.c: New test. From-SVN: r175752 --- gcc/ChangeLog | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/tree-ssa/bitwise-sink.c | 11 +++++++++++ gcc/tree-ssa-forwprop.c | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/bitwise-sink.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df258a51c73..e0ceee86218 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2011-07-01 Kai Tietz + + * tree-ssa-forwprop.c (simplify_bitwise_binary): Fix typo. + 2011-07-01 Rainer Orth * config.gcc: Obsolete alpha*-dec-osf5.1, mips-sgi-irix6.5. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9b7219790fc..857ed564f8a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-07-01 Kai Tietz + + * gcc.dg/tree-ssa/bitwise-sink.c: New test. + 2011-07-01 Rainer Orth PR libmudflap/49549 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bitwise-sink.c b/gcc/testsuite/gcc.dg/tree-ssa/bitwise-sink.c new file mode 100644 index 00000000000..f44529995b7 --- /dev/null +++ b/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" } } */ diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index e93acdfc081..893f17b47a4 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -1675,7 +1675,7 @@ simplify_bitwise_binary (gimple_stmt_iterator *gsi) /* 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; -- 2.30.2