https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68122
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'm testing the following which skips internal fns, but I don't know if that's
the right thing for TM. At least it fixes all the ICEs I see.
I can post this to ML if it passes testing and we can discuss there.
--- gcc/trans-mem.c
+++ gcc/trans-mem.c
@@ -649,6 +649,8 @@ diagnose_tm_1 (gimple_stmt_iterator *gsi, bool
*handled_ops_p,
case GIMPLE_CALL:
{
tree fn = gimple_call_fn (stmt);
+ if (fn == NULL_TREE)
+ break;
if ((d->summary_flags & DIAG_TM_OUTER) == 0
&& is_tm_may_cancel_outer (fn))
@@ -4316,6 +4318,8 @@ ipa_tm_scan_irr_block (basic_block bb)
break;
fn = gimple_call_fn (stmt);
+ if (fn == NULL_TREE)
+ break;
/* Functions with the attribute are by definition irrevocable. */
if (is_tm_irrevocable (fn))
@@ -5109,6 +5113,10 @@ ipa_tm_transform_calls_redirect (struct cgraph_node
*node,
struct cgraph_edge *e = node->get_edge (stmt);
tree fndecl = gimple_call_fndecl (stmt);
+ /* Skip internal functions. */
+ if (gimple_call_fn (stmt) == NULL_TREE)
+ return;
+
/* For indirect calls, pass the address through the runtime. */
if (fndecl == NULL)
{