[Bug tree-optimization/80702] New: FRE fails to eliminate to leader dominating after unreachable edge removal
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 10 11:49:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80702
Bug ID: 80702
Summary: FRE fails to eliminate to leader dominating after
unreachable edge removal
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: rguenth at gcc dot gnu.org
CC: matz at gcc dot gnu.org
Target Milestone: ---
For
int c;
int foo (int a, int b)
{
c = a + b;
int d = c - a;
int e;
if (d == b)
c = 2 * a;
e = 2 * a;
return e;
}
at -O2 SCCVN sees
Marking all edges out of BB 2 but (2 -> 3) as not executable
Visiting BB 3
Value numbering _3 stmt = _3 = a_5(D) * 2;
Setting value number of _3 to _3 (changed)
...
Visiting BB 4
...
Value numbering e_11 stmt = e_11 = a_5(D) * 2;
Setting value number of e_11 to _3 (changed)
but elimination ends up with the following because _3 is not thought to
be available in BB 4 (the domwalk used during elimination pops availability
of _3 after visiting dom children):
<bb 2> [0.00%]:
_1 = a_5(D) + b_6(D);
c = _1;
_3 = a_5(D) * 2;
c = _3;
e_11 = a_5(D) * 2;
return e_11;
A value-numbering rewrite should preserve the value-numbering but also
eventually do better during elimination.
Within the current scheme one could try to "cleverly" put aside info
we pop after visiting all dom children and restore it from a BB with
a single executable predecessor edge src.
The end goal should be merging of early CCP, forwprop and FRE without
losing the CFG cleanup early CCP is able to do and the followup FRE
that enables. Basically allow more CSE w/o the need to iterate though
CFG cleanup which would enable more CSE.
More information about the Gcc-bugs
mailing list