aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-20 14:48:03 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-20 19:46:35 +0100
commita034cca0a222598cb42302c059262b654685ff19 (patch)
tree76d8109b1fe8828171e307bb92dd4895165c933e /gcc/cp
parent53ba8d669550d3a1f809048428b97ca607f95cf5 (diff)
downloadgcc-a034cca0a222598cb42302c059262b654685ff19.zip
gcc-a034cca0a222598cb42302c059262b654685ff19.tar.gz
gcc-a034cca0a222598cb42302c059262b654685ff19.tar.bz2
gcov: Use unshare_expr() in gen_counter_update()
This fixes issues like this: gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c: In function 'main': gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c:19:1: error: incorrect sharing of tree nodes __gcov0.main[0] # .MEM_12 = VDEF <.MEM_9> __gcov0.main[0] = PROF_edge_counter_4; during IPA pass: profile gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c:19:1: internal compiler error: verify_gimple failed Unshare the counter expression in the second gimple_build_assign() in gen_counter_update(). This is similar to the original gimple_gen_edge_profiler() for "ref": void gimple_gen_edge_profiler (int edgeno, edge e) { tree one; one = build_int_cst (gcov_type_node, 1); if (flag_profile_update == PROFILE_UPDATE_ATOMIC) [...] else { tree ref = tree_coverage_counter_ref (GCOV_COUNTER_ARCS, edgeno); tree gcov_type_tmp_var = make_temp_ssa_name (gcov_type_node, NULL, "PROF_edge_counter"); gassign *stmt1 = gimple_build_assign (gcov_type_tmp_var, ref); gcov_type_tmp_var = make_temp_ssa_name (gcov_type_node, NULL, "PROF_edge_counter"); gassign *stmt2 = gimple_build_assign (gcov_type_tmp_var, PLUS_EXPR, gimple_assign_lhs (stmt1), one); gassign *stmt3 = gimple_build_assign (unshare_expr (ref), gimple_assign_lhs (stmt2)); gsi_insert_on_edge (e, stmt1); gsi_insert_on_edge (e, stmt2); gsi_insert_on_edge (e, stmt3); } } However, the orignal gimple_gen_time_profiler() did not use unshare_expr() for the counter expression (tree_time_profiler_counter): void gimple_gen_time_profiler (unsigned tag) { [...] /* Emit: counters[0] = ++__gcov_time_profiler_counter. */ if (flag_profile_update == PROFILE_UPDATE_ATOMIC) [...] else { tree tmp = make_temp_ssa_name (type, NULL, "PROF_time_profile"); gassign *assign = gimple_build_assign (tmp, tree_time_profiler_counter); gsi_insert_before (&gsi, assign, GSI_NEW_STMT); tmp = make_temp_ssa_name (type, NULL, "PROF_time_profile"); assign = gimple_build_assign (tmp, PLUS_EXPR, gimple_assign_lhs (assign), one); gsi_insert_after (&gsi, assign, GSI_NEW_STMT); assign = gimple_build_assign (original_ref, tmp); gsi_insert_after (&gsi, assign, GSI_NEW_STMT); assign = gimple_build_assign (tree_time_profiler_counter, tmp); gsi_insert_after (&gsi, assign, GSI_NEW_STMT); } } gcc/ChangeLog: * tree-profile.cc (gen_counter_update): Use unshare_expr() for the counter expression in the second gimple_build_assign().
Diffstat (limited to 'gcc/cp')
0 files changed, 0 insertions, 0 deletions