> I'm working on a fix along this line, it needs some tweaks elsewhere.
Indeed, here's what I needed to bootstrap on x86-64/Linux.
* cfgexpand.c (expand_call_stmt): Rematerialize original function type.
* config/i386/i386.c (ix86_expand_builtin): Use get_callee_fndecl.
--
Eric Botcazou
Index: cfgexpand.c
===================================================================
--- cfgexpand.c (revision 172371)
+++ cfgexpand.c (working copy)
@@ -1844,7 +1844,10 @@ expand_call_stmt (gimple stmt)
exp = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3);
- CALL_EXPR_FN (exp) = gimple_call_fn (stmt);
+ CALL_EXPR_FN (exp)
+ = fold_build1 (NOP_EXPR, build_pointer_type (gimple_call_fntype (stmt)),
+ gimple_call_fn (stmt));
+
decl = gimple_call_fndecl (stmt);
builtin_p = decl && DECL_BUILT_IN (decl);
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 172371)
+++ config/i386/i386.c (working copy)
@@ -27399,7 +27399,7 @@ ix86_expand_builtin (tree exp, rtx targe
const struct builtin_description *d;
size_t i;
enum insn_code icode;
- tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0);
+ tree fndecl = get_callee_fndecl (exp);
tree arg0, arg1, arg2;
rtx op0, op1, op2, pat;
enum machine_mode mode0, mode1, mode2;