This adjusts gimple_could_trap_p to not consider internal function
calls to trap compared to indirect calls or calls to weak functions.
2021-07-12 Richard Biener <rguenther@suse.de>
PR middle-end/101423
* gimple.c (gimple_could_trap_p_1): Internal function calls
do not trap.
* tree-eh.c (tree_could_trap_p): Likewise.
return gimple_asm_volatile_p (as_a <gasm *> (s));
case GIMPLE_CALL:
+ if (gimple_call_internal_p (s))
+ return false;
t = gimple_call_fndecl (s);
- /* Assume that calls to weak functions may trap. */
+ /* Assume that indirect and calls to weak functions may trap. */
if (!t || !DECL_P (t) || DECL_WEAK (t))
return true;
return false;
return TREE_THIS_VOLATILE (expr);
case CALL_EXPR:
+ /* Internal function calls do not trap. */
+ if (CALL_EXPR_FN (expr) == NULL_TREE)
+ return false;
t = get_callee_fndecl (expr);
- /* Assume that calls to weak functions may trap. */
+ /* Assume that indirect and calls to weak functions may trap. */
if (!t || !DECL_P (t))
return true;
if (DECL_WEAK (t))