Commit 8006f46b by Richard Biener Committed by Richard Biener

fold-const.h (const_unop): Declare.

2014-11-26  Richard Biener  <rguenther@suse.de>

	* fold-const.h (const_unop): Declare.
	(const_binop): Likewise.
	* fold-const.c (const_binop): Export overload that expects
	a type parameter and dispatches to fold_relational_const as well.
	Check both operand kinds for guarding the transforms.
	(const_unop): New function, with constant folding from fold_unary_loc.
	(fold_unary_loc): Dispatch to const_unop for tcc_constant operand.
	Remove constant folding done there from the simplifications.
	(fold_binary_loc): Check for constants using CONSTANT_CLASS_P.
	(fold_negate_expr): Remove dead code from the REAL_CST case.
	Avoid building garbage in the COMPLEX_CST case.
	* gimple-match-head.c (gimple_resimplify1): Dispatch to
	const_unop.
	(gimple_resimplify2): Dispatch to const_binop.
	(gimple_simplify): Likewise.

From-SVN: r218086
parent 41866363
2014-11-26 Richard Biener <rguenther@suse.de>
* fold-const.h (const_unop): Declare.
(const_binop): Likewise.
* fold-const.c (const_binop): Export overload that expects
a type parameter and dispatches to fold_relational_const as well.
Check both operand kinds for guarding the transforms.
(const_unop): New function, with constant folding from fold_unary_loc.
(fold_unary_loc): Dispatch to const_unop for tcc_constant operand.
Remove constant folding done there from the simplifications.
(fold_binary_loc): Check for constants using CONSTANT_CLASS_P.
(fold_negate_expr): Remove dead code from the REAL_CST case.
Avoid building garbage in the COMPLEX_CST case.
* gimple-match-head.c (gimple_resimplify1): Dispatch to
const_unop.
(gimple_resimplify2): Dispatch to const_binop.
(gimple_simplify): Likewise.
2014-11-26 Ilya Enkovich <ilya.enkovich@intel.com> 2014-11-26 Ilya Enkovich <ilya.enkovich@intel.com>
PR bootstrap/63995 PR bootstrap/63995
...@@ -169,5 +169,7 @@ extern bool merge_ranges (int *, tree *, tree *, int, tree, tree, int, ...@@ -169,5 +169,7 @@ extern bool merge_ranges (int *, tree *, tree *, int, tree, tree, int,
tree, tree); tree, tree);
extern tree sign_bit_p (tree, const_tree); extern tree sign_bit_p (tree, const_tree);
extern tree exact_inverse (tree, tree); extern tree exact_inverse (tree, tree);
extern tree const_unop (enum tree_code, tree, tree);
extern tree const_binop (enum tree_code, tree, tree, tree);
#endif // GCC_FOLD_CONST_H #endif // GCC_FOLD_CONST_H
...@@ -94,7 +94,7 @@ gimple_resimplify1 (gimple_seq *seq, ...@@ -94,7 +94,7 @@ gimple_resimplify1 (gimple_seq *seq,
{ {
tree tem = NULL_TREE; tree tem = NULL_TREE;
if (res_code->is_tree_code ()) if (res_code->is_tree_code ())
tem = fold_unary_to_constant (*res_code, type, res_ops[0]); tem = const_unop (*res_code, type, res_ops[0]);
else else
{ {
tree decl = builtin_decl_implicit (*res_code); tree decl = builtin_decl_implicit (*res_code);
...@@ -150,8 +150,7 @@ gimple_resimplify2 (gimple_seq *seq, ...@@ -150,8 +150,7 @@ gimple_resimplify2 (gimple_seq *seq,
{ {
tree tem = NULL_TREE; tree tem = NULL_TREE;
if (res_code->is_tree_code ()) if (res_code->is_tree_code ())
tem = fold_binary_to_constant (*res_code, type, tem = const_binop (*res_code, type, res_ops[0], res_ops[1]);
res_ops[0], res_ops[1]);
else else
{ {
tree decl = builtin_decl_implicit (*res_code); tree decl = builtin_decl_implicit (*res_code);
...@@ -386,7 +385,7 @@ gimple_simplify (enum tree_code code, tree type, ...@@ -386,7 +385,7 @@ gimple_simplify (enum tree_code code, tree type,
{ {
if (constant_for_folding (op0)) if (constant_for_folding (op0))
{ {
tree res = fold_unary_to_constant (code, type, op0); tree res = const_unop (code, type, op0);
if (res != NULL_TREE if (res != NULL_TREE
&& CONSTANT_CLASS_P (res)) && CONSTANT_CLASS_P (res))
return res; return res;
...@@ -409,7 +408,7 @@ gimple_simplify (enum tree_code code, tree type, ...@@ -409,7 +408,7 @@ gimple_simplify (enum tree_code code, tree type,
{ {
if (constant_for_folding (op0) && constant_for_folding (op1)) if (constant_for_folding (op0) && constant_for_folding (op1))
{ {
tree res = fold_binary_to_constant (code, type, op0, op1); tree res = const_binop (code, type, op0, op1);
if (res != NULL_TREE if (res != NULL_TREE
&& CONSTANT_CLASS_P (res)) && CONSTANT_CLASS_P (res))
return res; return res;
......
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