Commit ba6ee9fc by Richard Biener Committed by Richard Biener

re PR tree-optimization/80304 (Wrong result with do concurrent)

2017-04-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/80304
	* tree-ssa-loop-im.c (ref_indep_loop_p_1): Also recurse
	for safelen.

	* gcc.dg/torture/pr80304.c: New testcase.

From-SVN: r246803
parent 4d1a05f1
2017-04-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/80304
* tree-ssa-loop-im.c (ref_indep_loop_p_1): Also recurse
for safelen.
2017-04-10 Nathan Sidwell <nathan@acm.org>
PR target/79905
......
2017-04-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/80304
* gcc.dg/torture/pr80304.c: New testcase.
2017-04-10 Nathan Sidwell <nathan@acm.org>
PR target/79905
......
/* { dg-do run } */
int __attribute__((pure,noinline,noclone)) foo (int *p)
{
return *p * 2;
}
int main()
{
int k = 0;
int i;
#pragma GCC ivdep
for (k = 0; k < 9;)
{
i = 0;
while (1)
{
k += foo (&i);
if (k > 7)
break;
i++;
}
}
if (k != 12)
__builtin_abort ();
return 0;
}
......@@ -2145,9 +2145,21 @@ ref_indep_loop_p_1 (int safelen, struct loop *loop, im_mem_ref *ref,
fprintf (dump_file, "\n");
}
/* We need to recurse to properly handle UNANALYZABLE_MEM_ID. */
struct loop *inner = loop->inner;
while (inner)
{
if (!ref_indep_loop_p_1 (safelen, inner, ref, stored_p, ref_loop))
{
indep_p = false;
break;
}
inner = inner->next;
}
/* Avoid caching here as safelen depends on context and refs
are shared between different contexts. */
return true;
return indep_p;
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment