+2019-11-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/92401
+ * gimple-match-head.c (gimple_resimplify1): Call const_unop only
+ if res_op->code is an expression with code length 1.
+ * gimple-match-head.c (gimple_resimplify2): Call const_binop only
+ if res_op->code is an expression with code length 2.
+ * gimple-match-head.c (gimple_resimplify3): Call fold_ternary only
+ if res_op->code is an expression with code length 3.
+
2019-11-09 Iain Sandoe <iain@sandoe.co.uk>
* config/darwin.c (machopic_mcount_stub_name): Validate the
{
tree tem = NULL_TREE;
if (res_op->code.is_tree_code ())
- tem = const_unop (res_op->code, res_op->type, res_op->ops[0]);
+ {
+ tree_code code = res_op->code;
+ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
+ && TREE_CODE_LENGTH (code) == 1)
+ tem = const_unop (res_op->code, res_op->type, res_op->ops[0]);
+ }
else
tem = fold_const_call (combined_fn (res_op->code), res_op->type,
res_op->ops[0]);
{
tree tem = NULL_TREE;
if (res_op->code.is_tree_code ())
- tem = const_binop (res_op->code, res_op->type,
- res_op->ops[0], res_op->ops[1]);
+ {
+ tree_code code = res_op->code;
+ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
+ && TREE_CODE_LENGTH (code) == 2)
+ tem = const_binop (res_op->code, res_op->type,
+ res_op->ops[0], res_op->ops[1]);
+ }
else
tem = fold_const_call (combined_fn (res_op->code), res_op->type,
res_op->ops[0], res_op->ops[1]);
{
tree tem = NULL_TREE;
if (res_op->code.is_tree_code ())
- tem = fold_ternary/*_to_constant*/ (res_op->code, res_op->type,
- res_op->ops[0], res_op->ops[1],
- res_op->ops[2]);
+ {
+ tree_code code = res_op->code;
+ if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
+ && TREE_CODE_LENGTH (code) == 3)
+ tem = fold_ternary/*_to_constant*/ (res_op->code, res_op->type,
+ res_op->ops[0], res_op->ops[1],
+ res_op->ops[2]);
+ }
else
tem = fold_const_call (combined_fn (res_op->code), res_op->type,
res_op->ops[0], res_op->ops[1], res_op->ops[2]);