+2008-09-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/37414
+ * predict.c (optimize_function_for_size_p): Don't segfault if
+ FUN is NULL.
+ * fold-const.c (LOGICAL_OP_NON_SHORT_CIRCUIT, fold_truthop,
+ tree_swap_operands_p): Don't test cfun != NULL before calling
+ optimize_function_for_s*_p.
+
2008-09-08 Eric Botcazou <ebotcazou@adacore.com>
* ira-color.c (ira_reuse_stack_slot): Set slot_num on success at the
\f
#ifndef LOGICAL_OP_NON_SHORT_CIRCUIT
#define LOGICAL_OP_NON_SHORT_CIRCUIT \
- (BRANCH_COST (!cfun || optimize_function_for_speed_p (cfun), \
+ (BRANCH_COST (optimize_function_for_speed_p (cfun), \
false) >= 2)
#endif
that can be merged. Avoid doing this if the RHS is a floating-point
comparison since those can trap. */
- if (BRANCH_COST (!cfun || optimize_function_for_speed_p (cfun),
+ if (BRANCH_COST (optimize_function_for_speed_p (cfun),
false) >= 2
&& ! FLOAT_TYPE_P (TREE_TYPE (rl_arg))
&& simple_operand_p (rl_arg)
if (TREE_CONSTANT (arg0))
return 1;
- if (cfun && optimize_function_for_size_p (cfun))
+ if (optimize_function_for_size_p (cfun))
return 0;
if (reorder && flag_evaluation_order
optimize_function_for_size_p (struct function *fun)
{
return (optimize_size
- || fun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED);
+ || (fun && (fun->function_frequency
+ == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED)));
}
/* Return true when current function should always be optimized for speed. */