Commit 8bb8e838 by Richard Biener Committed by Richard Biener

re PR tree-optimization/66952 (wrong code at -O2 and -O3 on x86_64-linux-gnu)

2015-07-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/66952
	* tree-ssa-ifcombine.c (pass_tree_ifcombine::execute): For
	blocks we end up executing unconditionally reset all SSA
	info such as range and alignment.
	* tree-ssanames.h (reset_flow_sensitive_info): Declare.
	* tree-ssanames.c (reset_flow_sensitive_info): New function.

	* gcc.dg/torture/pr66952.c: New testcase.

From-SVN: r226062
parent b1db706a
2015-07-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/66952
* tree-ssa-ifcombine.c (pass_tree_ifcombine::execute): For
blocks we end up executing unconditionally reset all SSA
info such as range and alignment.
* tree-ssanames.h (reset_flow_sensitive_info): Declare.
* tree-ssanames.c (reset_flow_sensitive_info): New function.
2015-07-22 Charles Baylis <charles.baylis@linaro.org> 2015-07-22 Charles Baylis <charles.baylis@linaro.org>
* config/aarch64/aarch64-simd.md (vec_store_lanesoi_lane<mode>): Fix * config/aarch64/aarch64-simd.md (vec_store_lanesoi_lane<mode>): Fix
......
2015-07-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/66952
* gcc.dg/torture/pr66952.c: New testcase.
2015-07-22 Charles Baylis <charles.baylis@linaro.org> 2015-07-22 Charles Baylis <charles.baylis@linaro.org>
* gcc.target/aarch64/advsimd-intrinsics/vld2_lane_f32_indices_1.c: New * gcc.target/aarch64/advsimd-intrinsics/vld2_lane_f32_indices_1.c: New
......
/* { dg-do run } */
int a = 128, b;
static int
fn1 (char p1, int p2)
{
return p1 < 0 || p1 > 1 >> p2 ? 0 : p1 << 1;
}
static int
fn2 ()
{
char c = a;
b = fn1 (c, 1);
if ((128 | c) < 0 ? 1 : 0)
return 1;
return 0;
}
int
main ()
{
if (fn2 () != 1)
__builtin_abort ();
return 0;
}
...@@ -765,7 +765,22 @@ pass_tree_ifcombine::execute (function *fun) ...@@ -765,7 +765,22 @@ pass_tree_ifcombine::execute (function *fun)
if (stmt if (stmt
&& gimple_code (stmt) == GIMPLE_COND) && gimple_code (stmt) == GIMPLE_COND)
cfg_changed |= tree_ssa_ifcombine_bb (bb); if (tree_ssa_ifcombine_bb (bb))
{
/* Clear range info from all stmts in BB which is now executed
conditional on a always true/false condition. */
for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
!gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
ssa_op_iter i;
tree op;
FOR_EACH_SSA_TREE_OPERAND (op, stmt, i, SSA_OP_DEF)
reset_flow_sensitive_info (op);
}
cfg_changed |= true;
}
} }
free (bbs); free (bbs);
......
...@@ -528,6 +528,23 @@ duplicate_ssa_name_fn (struct function *fn, tree name, gimple stmt) ...@@ -528,6 +528,23 @@ duplicate_ssa_name_fn (struct function *fn, tree name, gimple stmt)
} }
/* Reset all flow sensitive data on NAME such as range-info, nonzero
bits and alignment. */
void
reset_flow_sensitive_info (tree name)
{
if (POINTER_TYPE_P (TREE_TYPE (name)))
{
/* points-to info is not flow-sensitive. */
if (SSA_NAME_PTR_INFO (name))
mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name));
}
else
SSA_NAME_RANGE_INFO (name) = NULL;
}
/* Release all the SSA_NAMEs created by STMT. */ /* Release all the SSA_NAMEs created by STMT. */
void void
......
...@@ -94,6 +94,7 @@ extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *); ...@@ -94,6 +94,7 @@ extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
extern tree duplicate_ssa_name_fn (struct function *, tree, gimple); extern tree duplicate_ssa_name_fn (struct function *, tree, gimple);
extern void duplicate_ssa_name_range_info (tree, enum value_range_type, extern void duplicate_ssa_name_range_info (tree, enum value_range_type,
struct range_info_def *); struct range_info_def *);
extern void reset_flow_sensitive_info (tree);
extern void release_defs (gimple); extern void release_defs (gimple);
extern void replace_ssa_name_symbol (tree, tree); extern void replace_ssa_name_symbol (tree, tree);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment