aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-10-13 18:25:08 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-10-13 18:25:08 +0000
commit74e80a24737ac20950916267ba4fb2a906523c5c (patch)
tree612dfb381152e5eb24ae56533da457fac8dfda06 /gcc/tree-ssa-ccp.c
parentb1ba284ce3661918d857e9ea26bc8b1b428d6669 (diff)
downloadgcc-74e80a24737ac20950916267ba4fb2a906523c5c.zip
gcc-74e80a24737ac20950916267ba4fb2a906523c5c.tar.gz
gcc-74e80a24737ac20950916267ba4fb2a906523c5c.tar.bz2
re PR objc/45878 (Can't compile even a trivial ObjC program with -fexceptions -O2)
2010-10-13 Richard Guenther <rguenther@suse.de> PR objc/45878 * tree-ssa-ccpc (ccp_fold_stmt): Use gimple_fold_obj_type_ref. From-SVN: r165430
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 2fa4726..6504941 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -2267,6 +2267,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
tree lhs = gimple_call_lhs (stmt);
tree val;
tree argt;
+ tree callee;
bool changed = false;
unsigned i;
@@ -2306,16 +2307,24 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
changed = true;
}
}
- if (TREE_CODE (gimple_call_fn (stmt)) == OBJ_TYPE_REF)
+
+ callee = gimple_call_fn (stmt);
+ if (TREE_CODE (callee) == OBJ_TYPE_REF
+ && TREE_CODE (OBJ_TYPE_REF_EXPR (callee)) == SSA_NAME)
{
- tree expr = OBJ_TYPE_REF_EXPR (gimple_call_fn (stmt));
- expr = valueize_op (expr);
- if (TREE_CODE (expr) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL)
- {
- gimple_call_set_fn (stmt, expr);
- changed = true;
- }
+ tree expr = OBJ_TYPE_REF_EXPR (callee);
+ OBJ_TYPE_REF_EXPR (callee) = valueize_op (expr);
+ if (TREE_CODE (OBJ_TYPE_REF_EXPR (callee)) == ADDR_EXPR)
+ {
+ tree t;
+ t = gimple_fold_obj_type_ref (callee, NULL_TREE);
+ if (t)
+ {
+ gimple_call_set_fn (stmt, t);
+ changed = true;
+ }
+ }
+ OBJ_TYPE_REF_EXPR (callee) = expr;
}
return changed;