diff options
author | Jeff Law <law@redhat.com> | 2015-04-27 22:01:28 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2015-04-27 22:01:28 -0600 |
commit | 009b7fc1870354e2c70d21c88fa671113a8e5f13 (patch) | |
tree | a59c6eeaf6d12c3a659434c06b6cf3b9bc71f7ba /gcc/tree-ssa-dom.c | |
parent | 3954ead0d88676855e877a8a20c05f49256260d7 (diff) | |
download | gcc-009b7fc1870354e2c70d21c88fa671113a8e5f13.zip gcc-009b7fc1870354e2c70d21c88fa671113a8e5f13.tar.gz gcc-009b7fc1870354e2c70d21c88fa671113a8e5f13.tar.bz2 |
re PR tree-optimization/65217 (__builtin_unreachable in if statement causes bad assembly generation)
PR tree-optimization/65217
* tree-ssa-dom.c (record_equality): Given two SSA_NAMEs, if just one
of them has a single use, make sure it is the LHS of the implied
copy.
PR tree-optimization/65217
* gcc.target/i386/pr65217.c: Remove XFAIL.
From-SVN: r222499
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r-- | gcc/tree-ssa-dom.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index a67b4e4..c7d427b 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -1762,6 +1762,20 @@ record_equality (tree x, tree y) if (tree_swap_operands_p (x, y, false)) std::swap (x, y); + /* Most of the time tree_swap_operands_p does what we want. But there's + cases where we we know one operand is better for copy propagation than + the other. Given no other code cares about ordering of equality + comparison operators for that purpose, we just handle the special cases + here. */ + if (TREE_CODE (x) == SSA_NAME && TREE_CODE (y) == SSA_NAME) + { + /* If one operand is a single use operand, then make it + X. This will preserve its single use properly and if this + conditional is eliminated, the computation of X can be + eliminated as well. */ + if (has_single_use (y) && ! has_single_use (x)) + std::swap (x, y); + } if (TREE_CODE (x) == SSA_NAME) prev_x = SSA_NAME_VALUE (x); if (TREE_CODE (y) == SSA_NAME) |