diff options
Diffstat (limited to 'gcc/tree-ssa-phiopt.c')
-rw-r--r-- | gcc/tree-ssa-phiopt.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c index bad546d..c7fb073 100644 --- a/gcc/tree-ssa-phiopt.c +++ b/gcc/tree-ssa-phiopt.c @@ -917,6 +917,31 @@ value_replacement (basic_block cond_bb, basic_block middle_bb, && absorbing_element_p (code_def, cond_rhs)))) { gsi = gsi_for_stmt (cond); + if (INTEGRAL_TYPE_P (TREE_TYPE (lhs))) + { + /* Moving ASSIGN might change VR of lhs, e.g. when moving u_6 + def-stmt in: + if (n_5 != 0) + goto <bb 3>; + else + goto <bb 4>; + + <bb 3>: + # RANGE [0, 4294967294] + u_6 = n_5 + 4294967295; + + <bb 4>: + # u_3 = PHI <u_6(3), 4294967295(2)> */ + SSA_NAME_RANGE_INFO (lhs) = NULL; + SSA_NAME_ANTI_RANGE_P (lhs) = 0; + /* If available, we can use VR of phi result at least. */ + tree phires = gimple_phi_result (phi); + struct range_info_def *phires_range_info + = SSA_NAME_RANGE_INFO (phires); + if (phires_range_info) + duplicate_ssa_name_range_info (lhs, SSA_NAME_RANGE_TYPE (phires), + phires_range_info); + } gimple_stmt_iterator gsi_from = gsi_for_stmt (assign); gsi_move_before (&gsi_from, &gsi); replace_phi_edge_with_variable (cond_bb, e1, phi, lhs); |