aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-08-03 07:27:40 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-08-03 07:27:40 +0000
commita0c012fda997b1c2c918752f88abec680274ffe8 (patch)
treed17e0b8f222a02d57b025a9a12e6f28e0d14123c /gcc
parent52639a61657c667c68a4a3e0656a67ed1a95a9b0 (diff)
downloadgcc-a0c012fda997b1c2c918752f88abec680274ffe8.zip
gcc-a0c012fda997b1c2c918752f88abec680274ffe8.tar.gz
gcc-a0c012fda997b1c2c918752f88abec680274ffe8.tar.bz2
gimple-match-head.c (gimple_simplify): For [VEC_]COND_EXPRs on the rhs of assignments first simplify the embedded...
2015-08-03 Richard Biener <rguenther@suse.de> * gimple-match-head.c (gimple_simplify): For [VEC_]COND_EXPRs on the rhs of assignments first simplify the embedded GENERIC condition. From-SVN: r226488
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimple-match-head.c35
2 files changed, 40 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 15ca9d1..a1bdecd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2015-08-03 Richard Biener <rguenther@suse.de>
+ * gimple-match-head.c (gimple_simplify): For [VEC_]COND_EXPRs
+ on the rhs of assignments first simplify the embedded
+ GENERIC condition.
+
+2015-08-03 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/66917
* tree-vectorizer.h (struct dataref_aux): Add base_element_aligned
field.
diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c
index ca7acdf..17bd992 100644
--- a/gcc/gimple-match-head.c
+++ b/gcc/gimple-match-head.c
@@ -660,10 +660,43 @@ gimple_simplify (gimple stmt,
}
case GIMPLE_TERNARY_RHS:
{
+ bool valueized = false;
tree rhs1 = gimple_assign_rhs1 (stmt);
+ /* If this is a [VEC_]COND_EXPR first try to simplify an
+ embedded GENERIC condition. */
+ if (code == COND_EXPR
+ || code == VEC_COND_EXPR)
+ {
+ if (COMPARISON_CLASS_P (rhs1))
+ {
+ tree lhs = TREE_OPERAND (rhs1, 0);
+ tree rhs = TREE_OPERAND (rhs1, 1);
+ lhs = do_valueize (lhs, top_valueize, valueized);
+ rhs = do_valueize (rhs, top_valueize, valueized);
+ code_helper rcode2 = TREE_CODE (rhs1);
+ tree ops2[3] = {};
+ ops2[0] = lhs;
+ ops2[1] = rhs;
+ if ((gimple_resimplify2 (seq, &rcode2, TREE_TYPE (rhs1),
+ ops2, valueize)
+ || valueized)
+ && rcode2.is_tree_code ())
+ {
+ valueized = true;
+ if (TREE_CODE_CLASS ((enum tree_code)rcode2)
+ == tcc_comparison)
+ rhs1 = build2 (rcode2, TREE_TYPE (rhs1),
+ ops2[0], ops2[1]);
+ else if (rcode2 == SSA_NAME
+ || rcode2 == INTEGER_CST)
+ rhs1 = ops2[0];
+ else
+ valueized = false;
+ }
+ }
+ }
tree rhs2 = gimple_assign_rhs2 (stmt);
tree rhs3 = gimple_assign_rhs3 (stmt);
- bool valueized = false;
rhs1 = do_valueize (rhs1, top_valueize, valueized);
rhs2 = do_valueize (rhs2, top_valueize, valueized);
rhs3 = do_valueize (rhs3, top_valueize, valueized);