aboutsummaryrefslogtreecommitdiff
path: root/gcc/sese.c
diff options
context:
space:
mode:
authorAditya Kumar <aditya.k7@samsung.com>2015-09-28 17:29:59 +0000
committerSebastian Pop <spop@gcc.gnu.org>2015-09-28 17:29:59 +0000
commitd5b5a232d4555659943c2776d1df753e5c0387f3 (patch)
tree60998be0eae9d0a781a848fe9f960f7edde0aede /gcc/sese.c
parent0a53bd6d4dc25af160c2986eb1efecd949118ad3 (diff)
downloadgcc-d5b5a232d4555659943c2776d1df753e5c0387f3.zip
gcc-d5b5a232d4555659943c2776d1df753e5c0387f3.tar.gz
gcc-d5b5a232d4555659943c2776d1df753e5c0387f3.tar.bz2
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
Diffstat (limited to 'gcc/sese.c')
-rw-r--r--gcc/sese.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/sese.c b/gcc/sese.c
index db8c629..2050e2d 100644
--- a/gcc/sese.c
+++ b/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;