diff options
author | Martin Liska <mliska@suse.cz> | 2016-07-20 13:16:47 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2016-07-20 11:16:47 +0000 |
commit | 144530cf6352a55404e04bce3354e23d7c7c2d1d (patch) | |
tree | a52565acc7e86be00d9aefe1d8c726836c81d7c7 /gcc/graphite-isl-ast-to-gimple.c | |
parent | 04ac4afa844abb88a4a3bddd9dbfe5572d38aea4 (diff) | |
download | gcc-144530cf6352a55404e04bce3354e23d7c7c2d1d.tar.gz |
Properly handly PHI stmts in later_of_the_two (PR
PR middle-end/71898
* graphite-isl-ast-to-gimple.c (later_of_the_two):
Properly handly PHI stmts.
* gfortran.dg/graphite/pr71898.f90: New test.
From-SVN: r238513
Diffstat (limited to 'gcc/graphite-isl-ast-to-gimple.c')
-rw-r--r-- | gcc/graphite-isl-ast-to-gimple.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index fb9c8468ebc..07c88026cde 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -1305,6 +1305,18 @@ later_of_the_two (gimple_stmt_iterator gsi1, gimple_stmt_iterator gsi2) /* Find the iterator which is the latest. */ if (bb1 == bb2) { + gimple *stmt1 = gsi_stmt (gsi1); + gimple *stmt2 = gsi_stmt (gsi2); + + if (stmt1 != NULL && stmt2 != NULL) + { + bool is_phi1 = gimple_code (stmt1) == GIMPLE_PHI; + bool is_phi2 = gimple_code (stmt2) == GIMPLE_PHI; + + if (is_phi1 != is_phi2) + return is_phi1 ? gsi2 : gsi1; + } + /* For empty basic blocks gsis point to the end of the sequence. Since there is no operator== defined for gimple_stmt_iterator and for gsis not pointing to a valid statement gsi_next would assert. */ |