diff options
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index ff341d4..ad2178d 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2215,7 +2215,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) enum gimplify_status ret; int i, nargs; gimple call; - bool builtin_va_start_p = FALSE; + bool builtin_va_start_p = false; location_t loc = EXPR_LOCATION (*expr_p); gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR); @@ -4566,8 +4566,20 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, tree fnptrtype = TREE_TYPE (CALL_EXPR_FN (*from_p)); CALL_EXPR_FN (*from_p) = TREE_OPERAND (CALL_EXPR_FN (*from_p), 0); STRIP_USELESS_TYPE_CONVERSION (CALL_EXPR_FN (*from_p)); - assign = gimple_build_call_from_tree (*from_p); - gimple_call_set_fntype (assign, TREE_TYPE (fnptrtype)); + tree fndecl = get_callee_fndecl (*from_p); + if (fndecl + && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL + && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_EXPECT + && call_expr_nargs (*from_p) == 3) + assign = gimple_build_call_internal (IFN_BUILTIN_EXPECT, 3, + CALL_EXPR_ARG (*from_p, 0), + CALL_EXPR_ARG (*from_p, 1), + CALL_EXPR_ARG (*from_p, 2)); + else + { + assign = gimple_build_call_from_tree (*from_p); + gimple_call_set_fntype (assign, TREE_TYPE (fnptrtype)); + } notice_special_calls (assign); if (!gimple_call_noreturn_p (assign)) gimple_call_set_lhs (assign, *to_p); |