[PATCH] Handle GIMPLE_ASSIGNs with different vuse in gimple_equal_p
Tom de Vries
Tom_deVries@mentor.com
Sat Nov 9 16:38:00 GMT 2013
Richard,
Consider the test-case test.c:
...
int z;
int x;
void
f (int c, int d)
{
if (c)
z = 5;
else
{
if (d)
x = 4;
z = 5;
}
}
...
Atm, we don't tail-merge the 'z = 5' blocks, because gimple_equal_p returns
false for the 'z = 5' statements. The relevant code is this:
...
if (TREE_CODE (lhs1) != SSA_NAME
&& TREE_CODE (lhs2) != SSA_NAME)
return (vn_valueize (gimple_vdef (s1))
== vn_valueize (gimple_vdef (s2)));
...
The vdefs of the 'z = 5' statements are different, because the incoming vuses
are different.
This patch handles GIMPLE_ASSIGNs with different vuse in gimple_equal_p, by
doing a structural comparison.
Bootstrapped and regtested on x86_64.
OK for trunk?
Thanks,
- Tom
2013-11-06 Tom de Vries <tom@codesourcery.com>
* tree-ssa-tail-merge.c (gimple_equal_p): Add test for structural
equality for GIMPLE_ASSIGN.
* gcc.dg/tail-merge-store.c: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tmp.patch
Type: text/x-patch
Size: 2405 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20131109/59ecf410/attachment.bin>
More information about the Gcc-patches
mailing list