* [patch tree-optimization]: Fix typo in X bitwise-binary-op CST
@ 2011-06-30 18:08 Kai Tietz
2011-07-01 7:59 ` Richard Guenther
0 siblings, 1 reply; 2+ messages in thread
From: Kai Tietz @ 2011-06-30 18:08 UTC (permalink / raw)
To: gcc-patches
Hello,
this patch fixes a typo in type-sinking for bitwise-binary operation X op CST.
ChangeLog gcc/
2011-06-30 Kai Tietz <ktietz@redhat.com>
* tree-ssa-forwprop.c (simplify_bitwise_binary): Fix typo.
ChangeLog gcc/testsuite
2011-06-30 Kai Tietz <ktietz@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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch tree-optimization]: Fix typo in X bitwise-binary-op CST
2011-06-30 18:08 [patch tree-optimization]: Fix typo in X bitwise-binary-op CST Kai Tietz
@ 2011-07-01 7:59 ` Richard Guenther
0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2011-07-01 7:59 UTC (permalink / raw)
To: Kai Tietz; +Cc: gcc-patches
On Thu, Jun 30, 2011 at 8:01 PM, Kai Tietz <ktietz@redhat.com> wrote:
> Hello,
>
> this patch fixes a typo in type-sinking for bitwise-binary operation X op CST.
>
> ChangeLog gcc/
>
> 2011-06-30 Kai Tietz <ktietz@redhat.com>
>
> * tree-ssa-forwprop.c (simplify_bitwise_binary): Fix typo.
>
> ChangeLog gcc/testsuite
>
> 2011-06-30 Kai Tietz <ktietz@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?
Ok.
Thanks,
Richard.
> 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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-01 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-30 18:08 [patch tree-optimization]: Fix typo in X bitwise-binary-op CST Kai Tietz
2011-07-01 7:59 ` Richard Guenther
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).