https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70929
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2016-05-03 Ever confirmed|0 |1 --- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> --- This patch solves the testcase: Index: cgraph.c =================================================================== --- cgraph.c (revision 235839) +++ cgraph.c (working copy) @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. #include "tree-chkp.h" #include "context.h" #include "gimplify.h" +#include "stor-layout.h" /* FIXME: Only for PROP_loops, but cgraph shouldn't have to know about this. */ #include "tree-pass.h" @@ -3673,25 +3674,24 @@ gimple_check_call_args (gimple *stmt, tr { for (i = 0, p = parms; i < nargs; i++, p = TREE_CHAIN (p)) { - tree arg; /* If this is a varargs function defer inlining decision to callee. */ if (!p) break; - arg = gimple_call_arg (stmt, i); + + tree arg = gimple_call_arg (stmt, i); + tree type = TREE_VALUE (p); + if (POINTER_TYPE_P (arg) + && pass_by_reference (NULL, TYPE_MODE (type), type, true)) + type = TREE_TYPE (type); if (TREE_VALUE (p) == error_mark_node || arg == error_mark_node - || TREE_CODE (TREE_VALUE (p)) == VOID_TYPE - || (!types_compatible_p (TREE_VALUE (p), TREE_TYPE (arg)) - && !fold_convertible_p (TREE_VALUE (p), arg))) + || TREE_CODE (type) == VOID_TYPE + || (!types_compatible_p (type, TREE_TYPE (arg)) + && !fold_convertible_p (type, arg))) return false; } } - else - { - if (nargs != 0) - return false; - } return true; } and may be a resonable fix for release branches (where dropping the checks completly seems somewhat risky). This patch turns: function not considered for inlining : 3 calls, 7035 freq, 0 count caller is not optimized : 313 calls, 313000 freq, 0 count function body not available : 169317 calls, 507288718 freq, 0 count function not inlinable : 34230 calls, 14761634 freq, 0 count function body can be overwritten at link time : 5875 calls, 3060659 freq, 0 count --param large-function-growth limit reached : 1310 calls, 4501184 freq, 0 count --param large-stack-frame-growth limit reached : 5369 calls, 6695641 freq, 0 count --param max-inline-insns-single limit reached : 131 calls, 55952 freq, 0 count --param max-inline-insns-auto limit reached : 62265 calls, 69467053 freq, 0 count --param inline-unit-growth limit reached : 39900 calls, 25641347 freq, 0 count recursive inlining : 7 calls, 100428 freq, 0 count call is unlikely and code size would grow : 624745 calls, 748954066 freq, 0 count mismatched arguments : 752 calls, 946732 freq, 0 count mismatched declarations during linktime optimization: 1 calls, 900 freq, 0 count thunk call : 20631 calls, 20631000 freq, 0 count target specific option mismatch : 91 calls, 88969 freq, 0 count optimization level attribute mismatch : 12371 calls, 3153202 freq, 0 count callee refers to comdat-local symbols : 20 calls, 18065 freq, 0 count unreachable : 13241 calls, 0 freq, 0 count to: function not considered for inlining : 3 calls, 7035 freq, 0 count caller is not optimized : 313 calls, 313000 freq, 0 count function body not available : 169708 calls, 507853259 freq, 0 count function not inlinable : 34230 calls, 14761634 freq, 0 count function body can be overwritten at link time : 5875 calls, 3060659 freq, 0 count --param large-function-growth limit reached : 1310 calls, 4501184 freq, 0 count --param large-stack-frame-growth limit reached : 5369 calls, 6695641 freq, 0 count --param max-inline-insns-single limit reached : 131 calls, 55952 freq, 0 count --param max-inline-insns-auto limit reached : 62265 calls, 69467053 freq, 0 count --param inline-unit-growth limit reached : 39900 calls, 25641347 freq, 0 count recursive inlining : 7 calls, 100428 freq, 0 count call is unlikely and code size would grow : 624741 calls, 748933088 freq, 0 count mismatched arguments : 372 calls, 382648 freq, 0 count mismatched declarations during linktime optimization: 1 calls, 900 freq, 0 count thunk call : 20631 calls, 20631000 freq, 0 count target specific option mismatch : 91 calls, 88969 freq, 0 count optimization level attribute mismatch : 12371 calls, 3153202 freq, 0 count callee refers to comdat-local symbols : 20 calls, 18065 freq, 0 count unreachable : 13241 calls, 0 freq, 0 count So there are still about 350 calls that are rules out as uninlinable... Honza