aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index e55467a..1990e10 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2551,10 +2551,25 @@ expand_call_stmt (gcall *stmt)
return;
}
+ /* If this is a call to a built-in function and it has no effect other
+ than setting the lhs, try to implement it using an internal function
+ instead. */
+ decl = gimple_call_fndecl (stmt);
+ if (gimple_call_lhs (stmt)
+ && !gimple_has_side_effects (stmt)
+ && (optimize || (decl && called_as_built_in (decl))))
+ {
+ internal_fn ifn = replacement_internal_fn (stmt);
+ if (ifn != IFN_LAST)
+ {
+ expand_internal_call (ifn, stmt);
+ return;
+ }
+ }
+
exp = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3);
CALL_EXPR_FN (exp) = gimple_call_fn (stmt);
- decl = gimple_call_fndecl (stmt);
builtin_p = decl && DECL_BUILT_IN (decl);
/* If this is not a builtin function, the function type through which the