Bug 15991 - phi nodes with identical arguments still remain at t50.tailc
Summary: phi nodes with identical arguments still remain at t50.tailc
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization, patch
Depends on:
Blocks:
 
Reported: 2004-06-14 23:58 UTC by Kazu Hirata
Modified: 2004-07-10 00:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-06-15 02:51:32


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kazu Hirata 2004-06-14 23:58:50 UTC
# grep "PHI <0B([0-9]*), 0B([0-9]*)>" *.i.t50*
bb-reorder.i.t50.tailc:  # best_edge.1682_439 = PHI <0B(64), 0B(85)>;
cfgrtl.i.t50.tailc:  # x_36 = PHI <0B(4), 0B(8)>;
expmed.i.t50.tailc:  # tem_214 = PHI <0B(84), 0B(85)>;
optabs.i.t50.tailc:  # temp_393 = PHI <0B(30), 0B(29)>;
optabs.i.t50.tailc:  # temp_106 = PHI <0B(92), 0B(91)>;
recog.i.t50.tailc:  # eh_edge_50 = PHI <0B(34), 0B(31)>;
recog.i.t50.tailc:  # out_set_5 = PHI <0B(6), 0B(8)>;
tree-ssa-ccp.i.t50.tailc:  # uses_4 = PHI <0B(5), 0B(6)>;
tree-ssa-forwprop.i.t50.tailc:  # df_786 = PHI <0B(8), 0B(9)>;

I have yet to find a small testcase for the above.
It may be just a matter of running redphi one more time.
Comment 1 Andrew Pinski 2004-06-15 02:51:31 UTC
Confirmed, this seems very important as we are missing a lot of constant propagation.
Comment 2 Zdenek Dvorak 2004-06-15 16:11:05 UTC
kill_redundant_phi_nodes does not handle these cases since the variables are 
pointers, and copy propagating constants for pointers requires folding the 
statements and rewriting the ssa form afterwards, which I originally wanted to 
avoid.  Now that we from some reason need to rewrite the ssa form anyway, it 
should be fairly easy to implement.

I however do not know why dom+dce fail to eliminate this.
Comment 3 Zdenek Dvorak 2004-06-17 14:52:58 UTC
Patch:

http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01402.html
Comment 4 GCC Commits 2004-06-17 17:47:52 UTC
Subject: Bug 15991

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rakdver@gcc.gnu.org	2004-06-17 17:47:47

Modified files:
	gcc            : ChangeLog tree-cfg.c tree-flow-inline.h 
	                 tree-flow.h tree-ssa.c tree-ssanames.c tree.h 

Log message:
	PR tree-optimization/15991
	* tree-cfg.c (tree_block_label): Export.
	* tree-flow-inline.h (bsi_after_labels): New function.
	* tree-flow.h (bsi_after_labels, tree_block_label): Declare.
	* tree-ssa.c (propagate_into_addr): New function.
	(replace_immediate_uses): Handle propagation of pointer constants.
	(raise_value): Do not restrict propagation of pointer constants.
	* tree-ssanames.c (duplicate_ssa_name): New function.
	* tree.h (duplicate_ssa_name): Declare.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4016&r2=2.4017
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-cfg.c.diff?cvsroot=gcc&r1=2.12&r2=2.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-flow-inline.h.diff?cvsroot=gcc&r1=2.8&r2=2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-flow.h.diff?cvsroot=gcc&r1=2.8&r2=2.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa.c.diff?cvsroot=gcc&r1=2.9&r2=2.10
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssanames.c.diff?cvsroot=gcc&r1=2.2&r2=2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&r1=1.519&r2=1.520

Comment 5 Andrew Pinski 2004-06-17 17:53:16 UTC
Fixed.
Comment 6 Diego Novillo 2004-06-17 17:59:10 UTC
Subject: Re:  phi nodes with identical
	arguments still remain at t50.tailc

On Thu, 2004-06-17 at 13:47, cvs-commit at gcc dot gnu dot org wrote:

> 	PR tree-optimization/15991
> 	* tree-cfg.c (tree_block_label): Export.
> 	* tree-flow-inline.h (bsi_after_labels): New function.
> 	* tree-flow.h (bsi_after_labels, tree_block_label): Declare.
> 	* tree-ssa.c (propagate_into_addr): New function.
> 	(replace_immediate_uses): Handle propagation of pointer constants.
> 	(raise_value): Do not restrict propagation of pointer constants.
> 	* tree-ssanames.c (duplicate_ssa_name): New function.
> 	* tree.h (duplicate_ssa_name): Declare.
> 
Did you also add a test case?  Or was there one present already?


Thanks.  Diego.