Commit 74e80a24 by Richard Guenther Committed by Richard Biener

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
parent b1ba284c
2010-10-13 Richard Guenther <rguenther@suse.de>
PR objc/45878
* tree-ssa-ccpc (ccp_fold_stmt): Use gimple_fold_obj_type_ref.
2010-10-13 Eric Botcazou <ebotcazou@adacore.com> 2010-10-13 Eric Botcazou <ebotcazou@adacore.com>
* cse.c (cse_insn): Fix thinko in the canonicalization of USE insns. * cse.c (cse_insn): Fix thinko in the canonicalization of USE insns.
...@@ -2267,6 +2267,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi) ...@@ -2267,6 +2267,7 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
tree lhs = gimple_call_lhs (stmt); tree lhs = gimple_call_lhs (stmt);
tree val; tree val;
tree argt; tree argt;
tree callee;
bool changed = false; bool changed = false;
unsigned i; unsigned i;
...@@ -2306,17 +2307,25 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi) ...@@ -2306,17 +2307,25 @@ ccp_fold_stmt (gimple_stmt_iterator *gsi)
changed = true; 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)); tree expr = OBJ_TYPE_REF_EXPR (callee);
expr = valueize_op (expr); OBJ_TYPE_REF_EXPR (callee) = valueize_op (expr);
if (TREE_CODE (expr) == ADDR_EXPR if (TREE_CODE (OBJ_TYPE_REF_EXPR (callee)) == ADDR_EXPR)
&& TREE_CODE (TREE_OPERAND (expr, 0)) == FUNCTION_DECL)
{ {
gimple_call_set_fn (stmt, expr); tree t;
t = gimple_fold_obj_type_ref (callee, NULL_TREE);
if (t)
{
gimple_call_set_fn (stmt, t);
changed = true; changed = true;
} }
} }
OBJ_TYPE_REF_EXPR (callee) = expr;
}
return changed; return changed;
} }
......
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