public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/21576] New: FRE does not eliminate a redundant builtin call.
@ 2005-05-14 21:24 kazu at cs dot umass dot edu
  2005-05-14 21:30 ` [Bug tree-optimization/21576] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-05-14 21:24 UTC (permalink / raw)
  To: gcc-bugs

Consider:

int
foo (unsigned long a)
{
  int b = __builtin_clzl (a);
  int c = __builtin_clzl (a);
  if (b == c)
    return 1;
  return 0;
}

Here is what I get after FRE.

foo (a)
{
  int c;
  int b;
  int D.1235;

<bb 0>:
  b_3 = __builtin_clzl (a_2);
  c_4 = __builtin_clzl (a_2);
  if (b_3 == c_4) goto <L0>; else goto <L1>;

<L0>:;
  D.1235_7 = 1;
  goto <bb 3> (<L2>);

<L1>:;
  D.1235_6 = 0;

  # D.1235_1 = PHI <1(1), 0(2)>;
<L2>:;
  return D.1235_1;

}

DOM catches this later.

-- 
           Summary: FRE does not eliminate a redundant builtin call.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: dberlin at gcc dot gnu dot org,gcc-bugs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21576


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/21576] FRE does not eliminate a redundant builtin call.
  2005-05-14 21:24 [Bug tree-optimization/21576] New: FRE does not eliminate a redundant builtin call kazu at cs dot umass dot edu
@ 2005-05-14 21:30 ` pinskia at gcc dot gnu dot org
  2005-05-14 21:40 ` dberlin at dberlin dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-14 21:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-14 21:30 -------
Confirmed, here is another testcase (for -ffast-math):
double cos (double);
void link_error();
void f(double a)
{
  double b = cos (a);
  double c = cos (a);
  if (b!=c)
    link_error();
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-05-14 21:30:10
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21576


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/21576] FRE does not eliminate a redundant builtin call.
  2005-05-14 21:24 [Bug tree-optimization/21576] New: FRE does not eliminate a redundant builtin call kazu at cs dot umass dot edu
  2005-05-14 21:30 ` [Bug tree-optimization/21576] " pinskia at gcc dot gnu dot org
@ 2005-05-14 21:40 ` dberlin at dberlin dot org
  2005-05-16  1:15 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: dberlin at dberlin dot org @ 2005-05-14 21:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dberlin at gcc dot gnu dot org  2005-05-14 21:39 -------
Subject: Re:  FRE does not eliminate a
	redundant builtin call.

On Sat, 2005-05-14 at 21:30 +0000, pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-14 21:30 -------
> Confirmed, here is another testcase (for -ffast-math):
> double cos (double);
> void link_error();
> void f(double a)
> {
>   double b = cos (a);
>   double c = cos (a);
>   if (b!=c)
>     link_error();
> }
> 

Yes, we should make the result of a CONST call available, but don't.




-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21576


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/21576] FRE does not eliminate a redundant builtin call.
  2005-05-14 21:24 [Bug tree-optimization/21576] New: FRE does not eliminate a redundant builtin call kazu at cs dot umass dot edu
  2005-05-14 21:30 ` [Bug tree-optimization/21576] " pinskia at gcc dot gnu dot org
  2005-05-14 21:40 ` dberlin at dberlin dot org
@ 2005-05-16  1:15 ` cvs-commit at gcc dot gnu dot org
  2005-05-16  1:17 ` dberlin at gcc dot gnu dot org
  2005-05-16  1:26 ` kazu at cs dot umass dot edu
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-16  1:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-05-16 01:13 -------
Subject: Bug 21576

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dberlin@gcc.gnu.org	2005-05-16 01:12:09

Modified files:
	gcc            : ChangeLog tree-ssa-pre.c tree-vn.c 
	gcc/testsuite/gcc.dg/tree-ssa: ssa-dom-cse-1.c 
Added files:
	gcc/testsuite/gcc.dg/tree-ssa: ssa-pre-10.c ssa-pre-11.c 
	                               ssa-pre-12.c ssa-pre-13.c 
	                               ssa-pre-9.c 

Log message:
	2005-05-15  Daniel Berlin  <dberlin@dberlin.org>
	
	Fix PR tree-optimization/21576
	
	* tree-ssa-pre.c (expression_node_pool): New pool.
	(comparison_node_pool): Ditto.
	(list_node_pool): Ditto.
	(pool_copy_list): New function.
	(phi_translate): Handle CALL_EXPR.
	(valid_in_set): Ditto.
	(create_expression_by_pieces): Ditto.
	(insert_into_preds_of_block): Ditto.
	(insert_aux): Ditto.
	(compute_avail): Ditto.
	(create_value_expr_from): Handle TREE_LIST and CALL_EXPR.
	(can_value_number_call): New function.
	(find_leader): Update comment.
	(init_pre): Create new pools.
	(fini_pre): Free new pools.
	(pass_pre): Add TODO_update_ssa for the future when we are going
	to need vops.
	* tree-vn.c (expressions_equal_p): Handle TREE_LIST.
	(set_value_handle): Ditto.
	(get_value_handle): Ditto.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8792&r2=2.8793
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-pre.c.diff?cvsroot=gcc&r1=2.86&r2=2.87
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-vn.c.diff?cvsroot=gcc&r1=2.10&r2=2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-10.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-11.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-12.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-13.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-9.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-cse-1.c.diff?cvsroot=gcc&r1=1.4&r2=1.5



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21576


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/21576] FRE does not eliminate a redundant builtin call.
  2005-05-14 21:24 [Bug tree-optimization/21576] New: FRE does not eliminate a redundant builtin call kazu at cs dot umass dot edu
                   ` (2 preceding siblings ...)
  2005-05-16  1:15 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-16  1:17 ` dberlin at gcc dot gnu dot org
  2005-05-16  1:26 ` kazu at cs dot umass dot edu
  4 siblings, 0 replies; 6+ messages in thread
From: dberlin at gcc dot gnu dot org @ 2005-05-16  1:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dberlin at gcc dot gnu dot org  2005-05-16 01:14 -------
I fixed it, and made it PRE calls too

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21576


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/21576] FRE does not eliminate a redundant builtin call.
  2005-05-14 21:24 [Bug tree-optimization/21576] New: FRE does not eliminate a redundant builtin call kazu at cs dot umass dot edu
                   ` (3 preceding siblings ...)
  2005-05-16  1:17 ` dberlin at gcc dot gnu dot org
@ 2005-05-16  1:26 ` kazu at cs dot umass dot edu
  4 siblings, 0 replies; 6+ messages in thread
From: kazu at cs dot umass dot edu @ 2005-05-16  1:26 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21576


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-05-16  1:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-14 21:24 [Bug tree-optimization/21576] New: FRE does not eliminate a redundant builtin call kazu at cs dot umass dot edu
2005-05-14 21:30 ` [Bug tree-optimization/21576] " pinskia at gcc dot gnu dot org
2005-05-14 21:40 ` dberlin at dberlin dot org
2005-05-16  1:15 ` cvs-commit at gcc dot gnu dot org
2005-05-16  1:17 ` dberlin at gcc dot gnu dot org
2005-05-16  1:26 ` kazu at cs dot umass dot edu

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).