------- Comment #22 from rguenth at gcc dot gnu dot org 2008-01-07 15:56 ------- A histogram over the number of VUSEs/VDEFs that are being sorted by sort_vuses reveals:
180 2 281964 256 1498 4 that is, we call qsort 281964 times with 256 virtual operands in the VEC. Now, curiously(?), virtual operands are sorted already, but after DECL_UID, not SSA_NAME_VERSION (see operand_build_sort_virtual). Adjusting the tree-vn sorting order to that of the operand scanner lets us improve these numbers to 27 2 28665 256 128 4 a reduction of a factor of 10. Profile after that: Each sample counts as 0.01 seconds. % cumulative self self total time seconds seconds calls s/call s/call name 10.37 2.91 2.91 14769893 0.00 0.00 add_vars_for_offset 7.91 5.13 2.22 44264182 0.00 0.00 add_virtual_operand 7.16 7.14 2.01 235231611 0.00 0.00 var_ann 5.24 8.61 1.47 206399974 0.00 0.00 VN_INFO 5.20 10.07 1.46 172 0.01 0.04 DFS 5.17 11.52 1.45 68814811 0.00 0.00 iterative_hash_expr 4.92 12.90 1.38 12610 0.00 0.00 get_call_expr_operands 4.74 14.23 1.33 1439173 0.00 0.00 ggc_alloc_stat 4.63 15.53 1.30 69275355 0.00 0.00 htab_find_with_hash 3.88 16.62 1.09 19029637 0.00 0.00 set_bb_for_stmt 3.56 17.62 1.00 266239 0.00 0.00 valueize_vuses 2.21 18.24 0.62 129473 0.00 0.00 visit_reference_op_store 1.96 18.79 0.55 68703417 0.00 0.00 uid_decl_map_eq 1.92 19.33 0.54 operand_build_cmp -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34683