Bug 15878 - a & b & ~a & ~b not optimized at the tree level
Summary: a & b & ~a & ~b not optimized at the tree level
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: 4.2.0
Assignee: Daniel Berlin
URL:
Keywords: missed-optimization, TREE
Depends on: 21445
Blocks: 19986
  Show dependency treegraph
 
Reported: 2004-06-08 18:36 UTC by Andrew Pinski
Modified: 2005-12-13 04:18 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-09 04:24:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-06-08 18:36:45 UTC
From looking at bugs which were fixed for 3.5.0 which were done on the RTL, I noticed this one (From 
PR 5263).

int f(int a,int b) { return a&b~a&~b; }
Comment 1 Andrew Pinski 2004-06-20 20:38:20 UTC
Confirmed.
Comment 2 Daniel Berlin 2005-08-28 20:00:06 UTC
I have a patch for this
Comment 3 Andrew Pinski 2005-12-13 04:18:57 UTC
Fixed by:
2005-12-12  Jeff Law  <law@redhat.com>

        * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Remove
        reassociation code.
        * passes.c (init_optimization_passes): Run reassociation again
        after loop optimizations.

2005-12-12  Daniel Berlin  <dberlin@dberlin.org>

        * tree-ssa-dom.c (thread_across_edge): Canonicalize condition
        if necessary.
        (optimize_stmt): Ditto.
        (canonicalize_comparison): New function.
        * tree-ssa-operands.c (swap_tree_operands): Make external.
        (get_expr_operands): Stop auto-canonicalization.
        * tree-ssa-reassoc.c: Rewrite.
        (init_optimization_passes):
        * tree-flow.h (swap_tree_operands): Prototype.
        * Makefile.in (tree-ssa-reassoc.o): Update dependencies.