aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRong Xu <xur@google.com>2014-07-21 16:47:22 -0700
committerRong Xu <xur@google.com>2014-07-29 15:31:03 -0700
commit38a8aecfb882072900434499696b5c32a2274515 (patch)
tree2aac97f0ae24b03cd98c1a06e989c031c173f889 /gcc-4.9/gcc/tree-ssa-sccvn.c
parentc231900e5dcc14d8296bd9f62b45997a49d4d5e7 (diff)
downloadtoolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.gz
toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.tar.bz2
toolchain_gcc-38a8aecfb882072900434499696b5c32a2274515.zip
[4.9] Switch gcc-4.9 to use google/gcc-4_9 branch.
This source drop uses svn version r212828 of google/gcc-4.9 branch. We also cherry-picked r213062, r213063 and r213064 to fix windows build issues. All gcc-4.9 patches before July 3rd are ported to google/gcc-4.9. The following prior commits has not been merged to google branch yet. (They are included in this commit). e7af147f979e657fe2df00808e5b4319b0e088c6, baf87df3cb2683649ba7e9872362a7e721117c23, and c231900e5dcc14d8296bd9f62b45997a49d4d5e7. Change-Id: I4bea3ea470387ff751c2be4cb0d4a12059b9299b
Diffstat (limited to 'gcc-4.9/gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc-4.9/gcc/tree-ssa-sccvn.c89
1 files changed, 33 insertions, 56 deletions
diff --git a/gcc-4.9/gcc/tree-ssa-sccvn.c b/gcc-4.9/gcc/tree-ssa-sccvn.c
index f7ec8b6d6..5bf4e9289 100644
--- a/gcc-4.9/gcc/tree-ssa-sccvn.c
+++ b/gcc-4.9/gcc/tree-ssa-sccvn.c
@@ -3074,33 +3074,12 @@ visit_phi (gimple phi)
/* If all value numbered to the same value, the phi node has that
value. */
if (allsame)
- {
- if (is_gimple_min_invariant (sameval))
- {
- VN_INFO (PHI_RESULT (phi))->has_constants = true;
- VN_INFO (PHI_RESULT (phi))->expr = sameval;
- }
- else
- {
- VN_INFO (PHI_RESULT (phi))->has_constants = false;
- VN_INFO (PHI_RESULT (phi))->expr = sameval;
- }
-
- if (TREE_CODE (sameval) == SSA_NAME)
- return visit_copy (PHI_RESULT (phi), sameval);
-
- return set_ssa_val_to (PHI_RESULT (phi), sameval);
- }
+ return set_ssa_val_to (PHI_RESULT (phi), sameval);
/* Otherwise, see if it is equivalent to a phi node in this block. */
result = vn_phi_lookup (phi);
if (result)
- {
- if (TREE_CODE (result) == SSA_NAME)
- changed = visit_copy (PHI_RESULT (phi), result);
- else
- changed = set_ssa_val_to (PHI_RESULT (phi), result);
- }
+ changed = set_ssa_val_to (PHI_RESULT (phi), result);
else
{
vn_phi_insert (phi, PHI_RESULT (phi));
@@ -3214,24 +3193,18 @@ simplify_binary_expression (gimple stmt)
catch those with constants. The goal here is to simultaneously
combine constants between expressions, but avoid infinite
expansion of expressions during simplification. */
- if (TREE_CODE (op0) == SSA_NAME)
- {
- if (VN_INFO (op0)->has_constants
+ op0 = vn_valueize (op0);
+ if (TREE_CODE (op0) == SSA_NAME
+ && (VN_INFO (op0)->has_constants
|| TREE_CODE_CLASS (code) == tcc_comparison
- || code == COMPLEX_EXPR)
- op0 = valueize_expr (vn_get_expr_for (op0));
- else
- op0 = vn_valueize (op0);
- }
+ || code == COMPLEX_EXPR))
+ op0 = valueize_expr (vn_get_expr_for (op0));
- if (TREE_CODE (op1) == SSA_NAME)
- {
- if (VN_INFO (op1)->has_constants
- || code == COMPLEX_EXPR)
- op1 = valueize_expr (vn_get_expr_for (op1));
- else
- op1 = vn_valueize (op1);
- }
+ op1 = vn_valueize (op1);
+ if (TREE_CODE (op1) == SSA_NAME
+ && (VN_INFO (op1)->has_constants
+ || code == COMPLEX_EXPR))
+ op1 = valueize_expr (vn_get_expr_for (op1));
/* Pointer plus constant can be represented as invariant address.
Do so to allow further propatation, see also tree forwprop. */
@@ -3289,24 +3262,28 @@ simplify_unary_expression (gimple stmt)
return NULL_TREE;
orig_op0 = op0;
- if (VN_INFO (op0)->has_constants)
- op0 = valueize_expr (vn_get_expr_for (op0));
- else if (CONVERT_EXPR_CODE_P (code)
- || code == REALPART_EXPR
- || code == IMAGPART_EXPR
- || code == VIEW_CONVERT_EXPR
- || code == BIT_FIELD_REF)
+ op0 = vn_valueize (op0);
+ if (TREE_CODE (op0) == SSA_NAME)
{
- /* We want to do tree-combining on conversion-like expressions.
- Make sure we feed only SSA_NAMEs or constants to fold though. */
- tree tem = valueize_expr (vn_get_expr_for (op0));
- if (UNARY_CLASS_P (tem)
- || BINARY_CLASS_P (tem)
- || TREE_CODE (tem) == VIEW_CONVERT_EXPR
- || TREE_CODE (tem) == SSA_NAME
- || TREE_CODE (tem) == CONSTRUCTOR
- || is_gimple_min_invariant (tem))
- op0 = tem;
+ if (VN_INFO (op0)->has_constants)
+ op0 = valueize_expr (vn_get_expr_for (op0));
+ else if (CONVERT_EXPR_CODE_P (code)
+ || code == REALPART_EXPR
+ || code == IMAGPART_EXPR
+ || code == VIEW_CONVERT_EXPR
+ || code == BIT_FIELD_REF)
+ {
+ /* We want to do tree-combining on conversion-like expressions.
+ Make sure we feed only SSA_NAMEs or constants to fold though. */
+ tree tem = valueize_expr (vn_get_expr_for (op0));
+ if (UNARY_CLASS_P (tem)
+ || BINARY_CLASS_P (tem)
+ || TREE_CODE (tem) == VIEW_CONVERT_EXPR
+ || TREE_CODE (tem) == SSA_NAME
+ || TREE_CODE (tem) == CONSTRUCTOR
+ || is_gimple_min_invariant (tem))
+ op0 = tem;
+ }
}
/* Avoid folding if nothing changed, but remember the expression. */