summaryrefslogtreecommitdiff
path: root/gcc/tree-cfgcleanup.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-14 12:59:15 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-14 12:59:15 +0000
commit04a37b12bbd351cd32ea592906aef2f1033253e0 (patch)
tree1c951111002e36e36791d6b8c618654105a3bdc9 /gcc/tree-cfgcleanup.c
parent389034a4ab3bc82b6feee643ddab6b130ca46388 (diff)
downloadgcc-04a37b12bbd351cd32ea592906aef2f1033253e0.tar.gz
2015-10-14 Richard Biener <rguenther@suse.de>
PR tree-optimization/67915 * match.pd: Handle comparisons of addresses of STRING_CSTs. * gimplify.c (gimplify_cond_expr): Fold the GIMPLE conds we build. * tree-cfgcleanup.c (cleanup_control_expr_graph): Remove GENERIC stmt folding in favor of GIMPLE one. * gcc.dg/torture/pr67915.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228810 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r--gcc/tree-cfgcleanup.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 40e14566ed1..eeedd8a423b 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -56,6 +56,9 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "tree-ssa-propagate.h"
#include "tree-scalar-evolution.h"
+#include "gimple-match.h"
+#include "gimple-fold.h"
+
/* The set of blocks in that at least one of the following changes happened:
-- the statement at the end of the block was changed
@@ -96,32 +99,34 @@ cleanup_control_expr_graph (basic_block bb, gimple_stmt_iterator gsi)
edge taken_edge;
bool retval = false;
gimple *stmt = gsi_stmt (gsi);
- tree val;
if (!single_succ_p (bb))
{
edge e;
edge_iterator ei;
bool warned;
- location_t loc;
+ tree val = NULL_TREE;
fold_defer_overflow_warnings ();
- loc = gimple_location (stmt);
switch (gimple_code (stmt))
{
case GIMPLE_COND:
- val = fold_binary_loc (loc, gimple_cond_code (stmt),
- boolean_type_node,
- gimple_cond_lhs (stmt),
- gimple_cond_rhs (stmt));
- break;
+ {
+ code_helper rcode;
+ tree ops[3] = {};
+ if (gimple_simplify (stmt, &rcode, ops, NULL, no_follow_ssa_edges,
+ no_follow_ssa_edges)
+ && rcode == INTEGER_CST)
+ val = ops[0];
+ break;
+ }
case GIMPLE_SWITCH:
val = gimple_switch_index (as_a <gswitch *> (stmt));
break;
default:
- val = NULL_TREE;
+ ;
}
taken_edge = find_taken_edge (bb, val);
if (!taken_edge)