* [Committed, trunk/6] Handle NULL def in build_cross_bb_scalars_def
@ 2016-05-07 7:14 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2016-05-07 7:14 UTC (permalink / raw)
To: Sebastian Pop, Richard Biener; +Cc: GCC Patches
[-- Attachment #1: Type: text/plain, Size: 1307 bytes --]
Hi,
Attached patch fixes a graphite 6/7 regression.
[ found regression by doing an fgraphite-identity on-by-default
bootstrap and regtest on x86_64. ]
When compiling gcc.dg/tree-ssa/vrp66.c with -O2 fgraphite-identity, we
arrive at graphite_find_cross_bb_scalar_vars:
...
static void
graphite_find_cross_bb_scalar_vars (scop_p scop, gimple *stmt,
vec<scalar_use> *reads, vec<tree>
*writes)
{
tree def;
if (gimple_code (stmt) == GIMPLE_ASSIGN)
def = gimple_assign_lhs (stmt);
else if (gimple_code (stmt) == GIMPLE_CALL)
def = gimple_call_lhs (stmt);
else if (gimple_code (stmt) == GIMPLE_PHI)
def = gimple_phi_result (stmt);
else
return;
build_cross_bb_scalars_def (scop, def, gimple_bb (stmt), writes);
...
...
with as stmt a resultless call:
...
(gdb) call debug_gimple_stmt (stmt)
# VUSE <.MEM_10(D)>
f2 (_1);
...
Consequently, def becomes NULL_TREE and we run into an assert at the
start of build_cross_bb_scalars_def that asserts that def is not NULL_TREE.
This patch fixes the ICE by handling a NULL_TREE def in
build_cross_bb_scalars_def.
Bootstrapped and reg-tested on x86_64.
Approved at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70956#c2 .
Committed to trunk, backported to 6 branch.
Thanks,
- Tom
[-- Attachment #2: 0005-Handle-NULL-def-in-build_cross_bb_scalars_def.patch --]
[-- Type: text/x-patch, Size: 1217 bytes --]
Handle NULL def in build_cross_bb_scalars_def
2016-05-07 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/70956
* graphite-scop-detection.c (build_cross_bb_scalars_def): Handle NULL
def.
* gcc.dg/graphite/pr70956.c: New test.
---
gcc/graphite-scop-detection.c | 3 +--
gcc/testsuite/gcc.dg/graphite/pr70956.c | 4 ++++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 7615842..dd50a1e 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1722,8 +1722,7 @@ static void
build_cross_bb_scalars_def (scop_p scop, tree def, basic_block def_bb,
vec<tree> *writes)
{
- gcc_assert (def);
- if (!is_gimple_reg (def))
+ if (!def || !is_gimple_reg (def))
return;
/* Do not gather scalar variables that can be analyzed by SCEV as they can be
diff --git a/gcc/testsuite/gcc.dg/graphite/pr70956.c b/gcc/testsuite/gcc.dg/graphite/pr70956.c
new file mode 100644
index 0000000..31fc25f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/pr70956.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fgraphite-identity" } */
+
+#include "../tree-ssa/vrp66.c"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-07 7:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-07 7:14 [Committed, trunk/6] Handle NULL def in build_cross_bb_scalars_def Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).