Please review this patch. Regression test is ok. I will do more application testing to make sure the check is not too strict (filtering out legal ic targets). Thanks, David 2011-04-07 Xinliang David Li * value-profile.c (function_decl_num_args): New function. (check_ic_target): New function. (gimple_ic_transform): Sanity check indirect call target. * gimple-low.c (gimple_check_call_args): Interface change. (gimple_check_call_matching_types): New function. * tree-inline.c (tree_can_inline_p): Call new function. On Fri, Apr 8, 2011 at 2:27 AM, Richard Guenther wrote: > On Fri, Apr 8, 2011 at 8:06 AM, Xinliang David Li wrote: >> Hi, due to race conditions, it is common that the value profile >> information for an indirect call site is 'corrupted' -- resulting in >> false target function to be recorded. The value profile transformation >> won't cause runtime problem as the path will never be executed, >> however it may cause compile time ICE because of the incompatible >> signature of the callee target. The attached patch does minimal sanity >> check to make compiler happy in such cases. The fix was tested with >> lots of MT programs and works really well in practice. >> >> Ok for trunk after testing? > > Please instead refactor and re-use gimple_check_call_args (). > Also look at tree_can_inline_p () which has code to deal with > result mismatches. > > Richard. > >> Thanks, >> >> David >> >> 2011-04-07  Xinliang David Li   >> >>        * value-profile.c (function_decl_num_args): New function. >>        (check_ic_target): New function. >>        (gimple_ic_transform): Sanity check indirect call target. >> >