mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-08 19:20:44 +08:00
re PR c/61779 (gcc -Og fails with impossible constraint on legal C code)
2014-07-14 Richard Biener <rguenther@suse.de> PR tree-optimization/61779 * tree-ssa-copy.c (copy_prop_visit_cond_stmt): Always try simplifying a condition. * gcc.dg/tree-ssa/ssa-copyprop-2.c: New testcase. From-SVN: r212521
This commit is contained in:
parent
72602c6cb4
commit
236aff7251
@ -1,3 +1,9 @@
|
||||
2014-07-14 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/61779
|
||||
* tree-ssa-copy.c (copy_prop_visit_cond_stmt): Always try
|
||||
simplifying a condition.
|
||||
|
||||
2014-07-14 Richard Biener <rguenther@suse.de>
|
||||
|
||||
* builtins.c (c_strlen): Make only_value == 2 really only
|
||||
|
@ -1,3 +1,8 @@
|
||||
2014-07-14 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/61779
|
||||
* gcc.dg/tree-ssa/ssa-copyprop-2.c: New testcase.
|
||||
|
||||
2014-07-14 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/61786
|
||||
|
13
gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c
Normal file
13
gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c
Normal file
@ -0,0 +1,13 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Og -fdump-tree-optimized" } */
|
||||
|
||||
extern long long __sdt_unsp;
|
||||
void
|
||||
f(void)
|
||||
{
|
||||
for (;;)
|
||||
__asm__ ("%0" :: "i" (((!__extension__ (__builtin_constant_p ((((unsigned long long) (__typeof (__builtin_choose_expr (((__builtin_classify_type (0) + 3) & -4) == 4, (0), 0U))) __sdt_unsp) ) == 0) )) ? 1 : -1) ));
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-not "PHI" "optimized" } } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
@ -237,38 +237,26 @@ copy_prop_visit_cond_stmt (gimple stmt, edge *taken_edge_p)
|
||||
enum ssa_prop_result retval = SSA_PROP_VARYING;
|
||||
location_t loc = gimple_location (stmt);
|
||||
|
||||
tree op0 = gimple_cond_lhs (stmt);
|
||||
tree op1 = gimple_cond_rhs (stmt);
|
||||
tree op0 = valueize_val (gimple_cond_lhs (stmt));
|
||||
tree op1 = valueize_val (gimple_cond_rhs (stmt));
|
||||
|
||||
/* The only conditionals that we may be able to compute statically
|
||||
are predicates involving two SSA_NAMEs. */
|
||||
if (TREE_CODE (op0) == SSA_NAME && TREE_CODE (op1) == SSA_NAME)
|
||||
/* See if we can determine the predicate's value. */
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
{
|
||||
op0 = valueize_val (op0);
|
||||
op1 = valueize_val (op1);
|
||||
fprintf (dump_file, "Trying to determine truth value of ");
|
||||
fprintf (dump_file, "predicate ");
|
||||
print_gimple_stmt (dump_file, stmt, 0, 0);
|
||||
}
|
||||
|
||||
/* See if we can determine the predicate's value. */
|
||||
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||
{
|
||||
fprintf (dump_file, "Trying to determine truth value of ");
|
||||
fprintf (dump_file, "predicate ");
|
||||
print_gimple_stmt (dump_file, stmt, 0, 0);
|
||||
}
|
||||
|
||||
/* We can fold COND and get a useful result only when we have
|
||||
the same SSA_NAME on both sides of a comparison operator. */
|
||||
if (op0 == op1)
|
||||
{
|
||||
tree folded_cond = fold_binary_loc (loc, gimple_cond_code (stmt),
|
||||
boolean_type_node, op0, op1);
|
||||
if (folded_cond)
|
||||
{
|
||||
basic_block bb = gimple_bb (stmt);
|
||||
*taken_edge_p = find_taken_edge (bb, folded_cond);
|
||||
if (*taken_edge_p)
|
||||
retval = SSA_PROP_INTERESTING;
|
||||
}
|
||||
}
|
||||
/* Fold COND and see whether we get a useful result. */
|
||||
tree folded_cond = fold_binary_loc (loc, gimple_cond_code (stmt),
|
||||
boolean_type_node, op0, op1);
|
||||
if (folded_cond)
|
||||
{
|
||||
basic_block bb = gimple_bb (stmt);
|
||||
*taken_edge_p = find_taken_edge (bb, folded_cond);
|
||||
if (*taken_edge_p)
|
||||
retval = SSA_PROP_INTERESTING;
|
||||
}
|
||||
|
||||
if (dump_file && (dump_flags & TDF_DETAILS) && *taken_edge_p)
|
||||
|
Loading…
x
Reference in New Issue
Block a user