backport: [multiple changes]
2018-01-17 Richard Biener <rguenther@suse.de> Backport from mainline 2017-12-18 Richard Biener <rguenther@suse.de> PR tree-optimization/81877 * tree-ssa-loop-im.c (ref_indep_loop_p): Remove safelen parameters. (outermost_indep_loop): Adjust. (ref_indep_loop_p_1): Likewise. Remove safelen handling again. (can_sm_ref_p): Adjust. * g++.dg/torture/pr81877.C: New testcase. * g++.dg/vect/pr70729.cc: XFAIL. * g++.dg/vect/pr70729-nest.cc: XFAIL. 2017-12-08 Richard Biener <rguenther@suse.de> PR middle-end/81782 * tree-ssa-uninit.c (warn_uninitialized_vars): Properly handle accesses outside of zero-sized vars. * gcc.dg/uninit-pr81782.c: New testcase. From-SVN: r256792
This commit is contained in:
parent
f743dd807b
commit
4743bef07a
|
@ -1,3 +1,20 @@
|
|||
2018-01-17 Richard Biener <rguenther@suse.de>
|
||||
|
||||
Backport from mainline
|
||||
2017-12-18 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/81877
|
||||
* tree-ssa-loop-im.c (ref_indep_loop_p): Remove safelen parameters.
|
||||
(outermost_indep_loop): Adjust.
|
||||
(ref_indep_loop_p_1): Likewise. Remove safelen handling again.
|
||||
(can_sm_ref_p): Adjust.
|
||||
|
||||
2017-12-08 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR middle-end/81782
|
||||
* tree-ssa-uninit.c (warn_uninitialized_vars): Properly
|
||||
handle accesses outside of zero-sized vars.
|
||||
|
||||
2018-01-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
|
||||
|
||||
Backport from mailine
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
2018-01-17 Richard Biener <rguenther@suse.de>
|
||||
|
||||
Backport from mainline
|
||||
2017-12-18 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/81877
|
||||
* g++.dg/torture/pr81877.C: New testcase.
|
||||
* g++.dg/vect/pr70729.cc: XFAIL.
|
||||
* g++.dg/vect/pr70729-nest.cc: XFAIL.
|
||||
|
||||
2017-12-08 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR middle-end/81782
|
||||
* gcc.dg/uninit-pr81782.c: New testcase.
|
||||
|
||||
2018-01-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
|
||||
|
||||
Backport from mainline
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* { dg-do run } */
|
||||
|
||||
void __attribute__((noinline,noclone)) g(int p, int *out)
|
||||
{
|
||||
int x = 0, y;
|
||||
#pragma GCC ivdep
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
int &r = p ? x : y;
|
||||
r = 42;
|
||||
out[i] = x;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int out[100] = { 0 };
|
||||
g (1, out);
|
||||
if (out[0] != 42)
|
||||
__builtin_abort ();
|
||||
return 0;
|
||||
}
|
|
@ -76,4 +76,4 @@ void Ss::foo (int n)
|
|||
}
|
||||
}
|
||||
|
||||
// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target x86_64-*-* i?86-*-* } } }
|
||||
// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { xfail *-*-* } } }
|
||||
|
|
|
@ -70,4 +70,4 @@ void Ss::foo (float *in, float w)
|
|||
}
|
||||
}
|
||||
|
||||
// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target x86_64-*-* i?86-*-* } } }
|
||||
// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { xfail *-*-* } } }
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wmaybe-uninitialized" } */
|
||||
|
||||
int
|
||||
foo (void)
|
||||
{
|
||||
char empty_array[] = { };
|
||||
int i, ret = 0;
|
||||
|
||||
for (i = 0; i < (int) (sizeof (empty_array) / sizeof (empty_array[0])); i++)
|
||||
ret = empty_array[i]; /* { dg-bogus "uninitialized" } */
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -197,7 +197,7 @@ static struct
|
|||
static bitmap_obstack lim_bitmap_obstack;
|
||||
static obstack mem_ref_obstack;
|
||||
|
||||
static bool ref_indep_loop_p (struct loop *, im_mem_ref *, struct loop *);
|
||||
static bool ref_indep_loop_p (struct loop *, im_mem_ref *);
|
||||
|
||||
/* Minimum cost of an expensive expression. */
|
||||
#define LIM_EXPENSIVE ((unsigned) PARAM_VALUE (PARAM_LIM_EXPENSIVE))
|
||||
|
@ -545,10 +545,10 @@ outermost_indep_loop (struct loop *outer, struct loop *loop, im_mem_ref *ref)
|
|||
aloop != loop;
|
||||
aloop = superloop_at_depth (loop, loop_depth (aloop) + 1))
|
||||
if ((!ref->stored || !bitmap_bit_p (ref->stored, aloop->num))
|
||||
&& ref_indep_loop_p (aloop, ref, loop))
|
||||
&& ref_indep_loop_p (aloop, ref))
|
||||
return aloop;
|
||||
|
||||
if (ref_indep_loop_p (loop, ref, loop))
|
||||
if (ref_indep_loop_p (loop, ref))
|
||||
return loop;
|
||||
else
|
||||
return NULL;
|
||||
|
@ -2111,20 +2111,13 @@ record_dep_loop (struct loop *loop, im_mem_ref *ref, bool stored_p)
|
|||
}
|
||||
|
||||
/* Returns true if REF is independent on all other memory
|
||||
references in LOOP. REF_LOOP is where REF is accessed, SAFELEN is the
|
||||
safelen to apply. */
|
||||
references in LOOP. */
|
||||
|
||||
static bool
|
||||
ref_indep_loop_p_1 (int safelen, struct loop *loop, im_mem_ref *ref,
|
||||
bool stored_p, struct loop *ref_loop)
|
||||
ref_indep_loop_p_1 (struct loop *loop, im_mem_ref *ref, bool stored_p)
|
||||
{
|
||||
stored_p |= (ref->stored && bitmap_bit_p (ref->stored, loop->num));
|
||||
|
||||
if (loop->safelen > safelen
|
||||
/* Check that REF is accessed inside LOOP. */
|
||||
&& (loop == ref_loop || flow_loop_nested_p (loop, ref_loop)))
|
||||
safelen = loop->safelen;
|
||||
|
||||
bool indep_p = true;
|
||||
bitmap refs_to_check;
|
||||
|
||||
|
@ -2135,32 +2128,6 @@ ref_indep_loop_p_1 (int safelen, struct loop *loop, im_mem_ref *ref,
|
|||
|
||||
if (bitmap_bit_p (refs_to_check, UNANALYZABLE_MEM_ID))
|
||||
indep_p = false;
|
||||
else if (safelen > 1)
|
||||
{
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
{
|
||||
fprintf (dump_file,"REF is independent due to safelen %d\n",
|
||||
safelen);
|
||||
print_generic_expr (dump_file, ref->mem.ref, TDF_SLIM);
|
||||
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 indep_p;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bitmap_bit_p (&ref->indep_loop, LOOP_DEP_BIT (loop->num, stored_p)))
|
||||
|
@ -2171,7 +2138,7 @@ ref_indep_loop_p_1 (int safelen, struct loop *loop, im_mem_ref *ref,
|
|||
struct loop *inner = loop->inner;
|
||||
while (inner)
|
||||
{
|
||||
if (!ref_indep_loop_p_1 (safelen, inner, ref, stored_p, ref_loop))
|
||||
if (!ref_indep_loop_p_1 (inner, ref, stored_p))
|
||||
{
|
||||
indep_p = false;
|
||||
break;
|
||||
|
@ -2225,14 +2192,14 @@ ref_indep_loop_p_1 (int safelen, struct loop *loop, im_mem_ref *ref,
|
|||
}
|
||||
|
||||
/* Returns true if REF is independent on all other memory references in
|
||||
LOOP. REF_LOOP is the loop where REF is accessed. */
|
||||
LOOP. */
|
||||
|
||||
static bool
|
||||
ref_indep_loop_p (struct loop *loop, im_mem_ref *ref, struct loop *ref_loop)
|
||||
ref_indep_loop_p (struct loop *loop, im_mem_ref *ref)
|
||||
{
|
||||
gcc_checking_assert (MEM_ANALYZABLE (ref));
|
||||
|
||||
return ref_indep_loop_p_1 (0, loop, ref, false, ref_loop);
|
||||
return ref_indep_loop_p_1 (loop, ref, false);
|
||||
}
|
||||
|
||||
/* Returns true if we can perform store motion of REF from LOOP. */
|
||||
|
@ -2268,7 +2235,7 @@ can_sm_ref_p (struct loop *loop, im_mem_ref *ref)
|
|||
|
||||
/* And it must be independent on all other memory references
|
||||
in LOOP. */
|
||||
if (!ref_indep_loop_p (loop, ref, loop))
|
||||
if (!ref_indep_loop_p (loop, ref))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -290,8 +290,8 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized)
|
|||
/* Do not warn if the access is fully outside of the
|
||||
variable. */
|
||||
if (ref.size != -1
|
||||
&& ref.max_size == ref.size
|
||||
&& (ref.offset + ref.size <= 0
|
||||
&& ((ref.max_size == ref.size
|
||||
&& ref.offset + ref.size <= 0)
|
||||
|| (ref.offset >= 0
|
||||
&& TREE_CODE (DECL_SIZE (base)) == INTEGER_CST
|
||||
&& compare_tree_int (DECL_SIZE (base),
|
||||
|
|
Loading…
Reference in New Issue