aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-predcom.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-01-07 08:49:10 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-01-07 08:49:10 +0100
commit41626746d0bd5aaff66a5489e80781917be881da (patch)
tree071e8492cc75475aa723d80b5247b3945695f667 /gcc/tree-predcom.c
parentcc349a3901254b334d2ab2bf6eadb35eeb8fdb48 (diff)
downloadgcc-41626746d0bd5aaff66a5489e80781917be881da.zip
gcc-41626746d0bd5aaff66a5489e80781917be881da.tar.gz
gcc-41626746d0bd5aaff66a5489e80781917be881da.tar.bz2
re PR tree-optimization/59643 (Predictive commoning unnecessarily punts on scimark2 SOR)
PR tree-optimization/59643 * tree-predcom.c (split_data_refs_to_components): If one dr is read and one write, determine_offset fails and the write isn't in the bad component, just put the read into the bad component. * gcc.dg/pr59643.c: New test. * gcc.c-torture/execute/pr59643.c: New test. From-SVN: r206384
Diffstat (limited to 'gcc/tree-predcom.c')
-rw-r--r--gcc/tree-predcom.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 92cecfa..7169b2f 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -772,10 +772,37 @@ split_data_refs_to_components (struct loop *loop,
bad = component_of (comp_father, n);
/* If both A and B are reads, we may ignore unsuitable dependences. */
- if (DR_IS_READ (dra) && DR_IS_READ (drb)
- && (ia == bad || ib == bad
- || !determine_offset (dra, drb, &dummy_off)))
- continue;
+ if (DR_IS_READ (dra) && DR_IS_READ (drb))
+ {
+ if (ia == bad || ib == bad
+ || !determine_offset (dra, drb, &dummy_off))
+ continue;
+ }
+ /* If A is read and B write or vice versa and there is unsuitable
+ dependence, instead of merging both components into a component
+ that will certainly not pass suitable_component_p, just put the
+ read into bad component, perhaps at least the write together with
+ all the other data refs in it's component will be optimizable. */
+ else if (DR_IS_READ (dra) && ib != bad)
+ {
+ if (ia == bad)
+ continue;
+ else if (!determine_offset (dra, drb, &dummy_off))
+ {
+ merge_comps (comp_father, comp_size, bad, ia);
+ continue;
+ }
+ }
+ else if (DR_IS_READ (drb) && ia != bad)
+ {
+ if (ib == bad)
+ continue;
+ else if (!determine_offset (dra, drb, &dummy_off))
+ {
+ merge_comps (comp_father, comp_size, bad, ib);
+ continue;
+ }
+ }
merge_comps (comp_father, comp_size, ia, ib);
}