Bug 58404 - &noninvariant_address not forwproped into ->handled_component
Summary: &noninvariant_address not forwproped into ->handled_component
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 4.9.0
Assignee: Richard Biener
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2013-09-12 10:42 UTC by Jakub Jelinek
Modified: 2013-09-12 13:20 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-09-12 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2013-09-12 10:42:04 UTC
On:

struct S { int s; };
S a[1024];

void
foo ()
{
  for (int i = 0; i < 1024; i++)
    {
      S &r = a[i];
      r.s++;
    }
}

we don't forwprop
  r_4 = &a[i_9];
  r_4->s = 2;
even when a[i_9].s is valid is_gimple_val.  Seen on libgomp.c++/simd-6.C on gomp-4_0-branch.
Comment 1 Richard Biener 2013-09-12 10:43:21 UTC
Confirmed.  I will have a look.
Comment 2 Richard Biener 2013-09-12 13:20:19 UTC
Author: rguenth
Date: Thu Sep 12 13:20:17 2013
New Revision: 202525

URL: http://gcc.gnu.org/viewcvs?rev=202525&root=gcc&view=rev
Log:
2013-09-12  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/58404
	* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Also
	propagate non-invariant addresses into dereferences wrapped
	in component references.

	* g++.dg/tree-ssa/pr58404.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr58404.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-forwprop.c
Comment 3 Richard Biener 2013-09-12 13:20:43 UTC
Fixed.