diff options
| author | wschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-07 12:39:32 +0000 |
|---|---|---|
| committer | wschmidt <wschmidt@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-07 12:39:32 +0000 |
| commit | cebae8f7473cb2d723b500680eec60e718f2b4e4 (patch) | |
| tree | 1d0bbc4d547189a109687e1d69c9430c4fbf958b | |
| parent | dcb79d5fb6f8851d4e65378f58ecfdb5d59b703b (diff) | |
| download | ppe42-gcc-cebae8f7473cb2d723b500680eec60e718f2b4e4.tar.gz ppe42-gcc-cebae8f7473cb2d723b500680eec60e718f2b4e4.zip | |
2013-05-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* gimple-ssa-strength-reduction.c (find_phi_def): Don't record a
phi def as possibly hiding a basis for a CAND_ADD whose operands
have been commuted in the analysis.
(alloc_cand_and_find_basis): Add parms to call to find_phi_def.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198678 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 7 | ||||
| -rw-r--r-- | gcc/gimple-ssa-strength-reduction.c | 22 |
2 files changed, 26 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 44a600898bc..533f934dc9f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-05-07 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gimple-ssa-strength-reduction.c (find_phi_def): Don't record a + phi def as possibly hiding a basis for a CAND_ADD whose operands + have been commuted in the analysis. + (alloc_cand_and_find_basis): Add parms to call to find_phi_def. + 2013-05-07 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> * config/aarch64/aarch64.md diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index 01e35dcf965..02eae2df2ba 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -413,15 +413,31 @@ cand_chain_hasher::equal (const value_type *chain1, const compare_type *chain2) static hash_table <cand_chain_hasher> base_cand_map; /* Look in the candidate table for a CAND_PHI that defines BASE and - return it if found; otherwise return NULL. */ + return it if found; otherwise return NULL. GS is the candidate + statement with BASE, INDEX, and STRIDE. If GS is a CAND_ADD with + an index of 1 and an SSA name for STRIDE, we must be careful that + we haven't commuted the operands for this candidate. STRIDE must + correspond to the second addend of GS for the eventual transformation + to be legal. If not, return NULL. */ static cand_idx -find_phi_def (tree base) +find_phi_def (gimple gs, enum cand_kind kind, tree base, + double_int index, tree stride) { slsr_cand_t c; if (TREE_CODE (base) != SSA_NAME) return 0; + + /* If we've commuted the operands (so "y + z" is represented as + "z + (1 * y)"), we don't have the pattern we're looking for. + Bail out to avoid doing a wrong replacement downstream. */ + if (kind == CAND_ADD + && index.is_one () + && TREE_CODE (stride) == SSA_NAME + && gimple_assign_rhs_code (gs) == PLUS_EXPR + && stride != gimple_assign_rhs2 (gs)) + return 0; c = base_cand_from_table (base); @@ -565,7 +581,7 @@ alloc_cand_and_find_basis (enum cand_kind kind, gimple gs, tree base, c->next_interp = 0; c->dependent = 0; c->sibling = 0; - c->def_phi = find_phi_def (base); + c->def_phi = find_phi_def (gs, kind, base, index, stride); c->dead_savings = savings; cand_vec.safe_push (c); |

