Bug 23606 - fold does not fold (type)(a == b) into a == b (with type as the type)
Summary: fold does not fold (type)(a == b) into a == b (with type as the type)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.0
: P2 enhancement
Target Milestone: 4.2.0
Assignee: Andrew Pinski
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: missed-optimization, patch
Depends on:
Blocks: 19986 23111
  Show dependency treegraph
 
Reported: 2005-08-28 23:03 UTC by Andrew Pinski
Modified: 2005-11-22 19:22 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-08-28 23:04:22


Attachments
patch which I am testing (444 bytes, patch)
2005-08-28 23:05 UTC, Andrew Pinski
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-08-28 23:03:43 UTC
I don't have a testcase for this one as convert already does it though with my tree combiner (or when 
TER folds), you can reproduce it with:

int f(int i, int j)
{
  _Bool a = i == j;
  int t = a;
  return t;
}
Comment 1 Andrew Pinski 2005-08-28 23:04:22 UTC
I have a patch which I will be submitting after I do a bootstrap/test.
Comment 2 Andrew Pinski 2005-08-28 23:05:45 UTC
Created attachment 9607 [details]
patch which I am testing
Comment 3 Andrew Pinski 2005-08-28 23:42:19 UTC
Note, type and TREE_CODE (op0) are swapped in the patch (as I did not even build the orginal patch).
Comment 4 Andrew Pinski 2005-11-20 18:14:34 UTC
I am retesting the patch and will apply after a bootstrap/test is finished.
Comment 5 Andrew Pinski 2005-11-22 19:22:24 UTC
Subject: Bug 23606

Author: pinskia
Date: Tue Nov 22 19:22:21 2005
New Revision: 107370

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=107370
Log:
2005-11-22  Andrew Pinski  <pinskia@physics.uc.edu>

        PR middle-end/23606
        * fold-const.c (fold_unary) <case NOP_EXPR, CONVERT_EXPR>: For
        COMPARISON_CLASS_P and an integral types create create a new
        expression with the new type and fold that.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c

Comment 6 Andrew Pinski 2005-11-22 19:22:43 UTC
Fixed.