re PR tree-optimization/67700 ([graphite] miscompile due to wrong codegen)
fix PR67700 The patch makes the detection of scop parameters in parameter_index_in_region a bit more conservative by discarding scalar variables defined in function of data references defined in the scop. 2015-09-25 Aditya Kumar <aditya.k7@samsung.com> Sebastian Pop <s.pop@samsung.com> PR tree-optimization/67700 * graphite-sese-to-poly.c (parameter_index_in_region): Call invariant_in_sese_p_rec. (extract_affine): Same. (rewrite_cross_bb_scalar_deps): Call update_ssa. * sese.c (invariant_in_sese_p_rec): Export. Handle vdefs and vuses. * sese.h (invariant_in_sese_p_rec): Declare. * testsuite/gcc.dg/graphite/run-id-pr67700.c: New. Co-Authored-By: Sebastian Pop <s.pop@samsung.com> From-SVN: r228214
This commit is contained in:
parent
0a53bd6d4d
commit
d5b5a232d4
6 changed files with 73 additions and 3 deletions
|
@ -1,3 +1,14 @@
|
|||
2015-09-28 Aditya Kumar <aditya.k7@samsung.com>
|
||||
Sebastian Pop <s.pop@samsung.com>
|
||||
|
||||
PR tree-optimization/67700
|
||||
* graphite-sese-to-poly.c (parameter_index_in_region): Call
|
||||
invariant_in_sese_p_rec.
|
||||
(extract_affine): Same.
|
||||
(rewrite_cross_bb_scalar_deps): Call update_ssa.
|
||||
* sese.c (invariant_in_sese_p_rec): Export. Handle vdefs and vuses.
|
||||
* sese.h (invariant_in_sese_p_rec): Declare.
|
||||
|
||||
2015-09-28 David Wohlferd <dw@LimeGreenSocks.com>
|
||||
|
||||
* doc/extend.texi (Asm Labels): Break out text for data vs
|
||||
|
|
|
@ -758,6 +758,9 @@ parameter_index_in_region (tree name, sese region)
|
|||
if (TREE_CODE (TREE_TYPE (name)) != INTEGER_TYPE)
|
||||
return -1;
|
||||
|
||||
if (!invariant_in_sese_p_rec (name, region))
|
||||
return -1;
|
||||
|
||||
i = parameter_index_in_region_1 (name, region);
|
||||
if (i != -1)
|
||||
return i;
|
||||
|
@ -813,7 +816,8 @@ extract_affine (scop_p s, tree e, __isl_take isl_space *space)
|
|||
break;
|
||||
|
||||
case SSA_NAME:
|
||||
gcc_assert (-1 != parameter_index_in_region_1 (e, SCOP_REGION (s)));
|
||||
gcc_assert (-1 != parameter_index_in_region_1 (e, s->region)
|
||||
|| !invariant_in_sese_p_rec (e, s->region));
|
||||
res = extract_affine_name (s, e, space);
|
||||
break;
|
||||
|
||||
|
@ -2462,6 +2466,8 @@ rewrite_cross_bb_scalar_deps (scop_p scop, gimple_stmt_iterator *gsi)
|
|||
def, use_stmt);
|
||||
}
|
||||
|
||||
update_ssa (TODO_update_ssa);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
14
gcc/sese.c
14
gcc/sese.c
|
@ -760,9 +760,10 @@ set_ifsese_condition (ifsese if_region, tree condition)
|
|||
gsi_insert_after (&gsi, cond_stmt, GSI_NEW_STMT);
|
||||
}
|
||||
|
||||
/* Return false if T is completely defined outside REGION. */
|
||||
/* Return true when T is defined outside REGION or when no definitions are
|
||||
variant in REGION. */
|
||||
|
||||
static bool
|
||||
bool
|
||||
invariant_in_sese_p_rec (tree t, sese region)
|
||||
{
|
||||
ssa_op_iter iter;
|
||||
|
@ -776,9 +777,18 @@ invariant_in_sese_p_rec (tree t, sese region)
|
|||
|| gimple_code (stmt) == GIMPLE_CALL)
|
||||
return false;
|
||||
|
||||
/* VDEF is variant when it is in the region. */
|
||||
if (tree vdef = gimple_vdef (stmt))
|
||||
return false;
|
||||
|
||||
/* A VUSE may or may not be variant following the VDEFs. */
|
||||
if (tree vuse = gimple_vuse (stmt))
|
||||
return invariant_in_sese_p_rec (vuse, region);
|
||||
|
||||
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
|
||||
{
|
||||
tree use = USE_FROM_PTR (use_p);
|
||||
|
||||
if (!defined_in_sese_p (use, region))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ extern edge copy_bb_and_scalar_dependences (basic_block, sese, edge,
|
|||
vec<tree> , bool *);
|
||||
extern struct loop *outermost_loop_in_sese (sese, basic_block);
|
||||
extern tree scalar_evolution_in_region (sese, loop_p, tree);
|
||||
extern bool invariant_in_sese_p_rec (tree, sese);
|
||||
|
||||
/* Check that SESE contains LOOP. */
|
||||
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2015-09-28 Aditya Kumar <aditya.k7@samsung.com>
|
||||
Sebastian Pop <s.pop@samsung.com>
|
||||
|
||||
PR tree-optimization/67700
|
||||
* testsuite/gcc.dg/graphite/run-id-pr67700.c: New.
|
||||
|
||||
2015-09-28 Oleg Endo <olegendo@gcc.gnu.org>
|
||||
|
||||
PR target/54236
|
||||
|
|
36
gcc/testsuite/gcc.dg/graphite/run-id-pr67700.c
Normal file
36
gcc/testsuite/gcc.dg/graphite/run-id-pr67700.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct abc {
|
||||
int a[81];
|
||||
} *abcd;
|
||||
|
||||
#define FPMATH_SSE 2
|
||||
int global;
|
||||
|
||||
void __attribute__ ((noinline)) foo()
|
||||
{
|
||||
int pos = 0;
|
||||
int i;
|
||||
|
||||
if (!((global & FPMATH_SSE) != 0))
|
||||
for (i = 8; i <= 15; i++)
|
||||
abcd->a[pos++] = i;
|
||||
|
||||
for (i = 29; i <= 36; i++)
|
||||
abcd->a[pos++] = i;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
abcd = (struct abc*) malloc (sizeof (struct abc));
|
||||
for (i = 0; i <= 80; i++)
|
||||
abcd->a[i] = 0;
|
||||
|
||||
foo();
|
||||
|
||||
assert (abcd->a[8] == 29);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue