/* Combining of if-expressions on trees.
- Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Contributed by Richard Guenther <rguenther@suse.de>
This file is part of GCC.
#include "tree.h"
#include "basic-block.h"
#include "timevar.h"
-#include "diagnostic.h"
+#include "tree-pretty-print.h"
#include "tree-flow.h"
#include "tree-pass.h"
#include "tree-dump.h"
{
gimple stmt = gsi_stmt (gsi);
- if (gimple_has_volatile_ops (stmt)
+ if (gimple_has_side_effects (stmt)
|| gimple_vuse (stmt))
return false;
}
/* See if we have two comparisons that we can merge into one. */
else if (TREE_CODE_CLASS (gimple_cond_code (inner_cond)) == tcc_comparison
- && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison
- && operand_equal_p (gimple_cond_lhs (inner_cond),
- gimple_cond_lhs (outer_cond), 0)
- && operand_equal_p (gimple_cond_rhs (inner_cond),
- gimple_cond_rhs (outer_cond), 0))
+ && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison)
{
- enum tree_code code1 = gimple_cond_code (inner_cond);
- enum tree_code code2 = gimple_cond_code (outer_cond);
tree t;
- if (!(t = combine_comparisons (UNKNOWN_LOCATION,
- TRUTH_ANDIF_EXPR, code1, code2,
- boolean_type_node,
- gimple_cond_lhs (outer_cond),
- gimple_cond_rhs (outer_cond))))
+ if (!(t = maybe_fold_and_comparisons (gimple_cond_code (inner_cond),
+ gimple_cond_lhs (inner_cond),
+ gimple_cond_rhs (inner_cond),
+ gimple_cond_code (outer_cond),
+ gimple_cond_lhs (outer_cond),
+ gimple_cond_rhs (outer_cond))))
return false;
t = canonicalize_cond_expr_cond (t);
if (!t)
/* See if we have two comparisons that we can merge into one.
This happens for C++ operator overloading where for example
GE_EXPR is implemented as GT_EXPR || EQ_EXPR. */
- else if (TREE_CODE_CLASS (gimple_cond_code (inner_cond)) == tcc_comparison
- && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison
- && operand_equal_p (gimple_cond_lhs (inner_cond),
- gimple_cond_lhs (outer_cond), 0)
- && operand_equal_p (gimple_cond_rhs (inner_cond),
- gimple_cond_rhs (outer_cond), 0))
+ else if (TREE_CODE_CLASS (gimple_cond_code (inner_cond)) == tcc_comparison
+ && TREE_CODE_CLASS (gimple_cond_code (outer_cond)) == tcc_comparison)
{
- enum tree_code code1 = gimple_cond_code (inner_cond);
- enum tree_code code2 = gimple_cond_code (outer_cond);
tree t;
- if (!(t = combine_comparisons (UNKNOWN_LOCATION,
- TRUTH_ORIF_EXPR, code1, code2,
- boolean_type_node,
- gimple_cond_lhs (outer_cond),
- gimple_cond_rhs (outer_cond))))
+ if (!(t = maybe_fold_or_comparisons (gimple_cond_code (inner_cond),
+ gimple_cond_lhs (inner_cond),
+ gimple_cond_rhs (inner_cond),
+ gimple_cond_code (outer_cond),
+ gimple_cond_lhs (outer_cond),
+ gimple_cond_rhs (outer_cond))))
return false;
t = canonicalize_cond_expr_cond (t);
if (!t)
int i;
bbs = blocks_in_phiopt_order ();
+ calculate_dominance_info (CDI_DOMINATORS);
for (i = 0; i < n_basic_blocks - NUM_FIXED_BLOCKS; ++i)
{
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_dump_func
- | TODO_ggc_collect
+ TODO_ggc_collect
| TODO_update_ssa
| TODO_verify_ssa /* todo_flags_finish */
}