lower-bitint: Add debugging dump of SSA_NAME -> decl mappings
Checks
Commit Message
Hi!
While the SSA coalescing performed by lower bitint prints some information
if -fdump-tree-bitintlower-details, it is really hard to read and doesn't
contain the most important information which one looks for when debugging
bitint lowering issues, namely what VAR_DECLs (or PARM_DECLs/RESULT_DECLs)
each SSA_NAME in large_huge.m_names bitmap maps to.
So, the following patch adds dumping of that, so that we know that say
_3 -> bitint.3
_8 -> bitint.7
_16 -> bitint.7
etc.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2024-01-27 Jakub Jelinek <jakub@redhat.com>
* gimple-lower-bitint.cc (gimple_lower_bitint): For
TDF_DETAILS dump mapping of SSA_NAMEs to decls.
Jakub
Comments
> Am 27.01.2024 um 09:15 schrieb Jakub Jelinek <jakub@redhat.com>:
>
> Hi!
>
> While the SSA coalescing performed by lower bitint prints some information
> if -fdump-tree-bitintlower-details, it is really hard to read and doesn't
> contain the most important information which one looks for when debugging
> bitint lowering issues, namely what VAR_DECLs (or PARM_DECLs/RESULT_DECLs)
> each SSA_NAME in large_huge.m_names bitmap maps to.
>
> So, the following patch adds dumping of that, so that we know that say
> _3 -> bitint.3
> _8 -> bitint.7
> _16 -> bitint.7
> etc.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok
Richard
> 2024-01-27 Jakub Jelinek <jakub@redhat.com>
>
> * gimple-lower-bitint.cc (gimple_lower_bitint): For
> TDF_DETAILS dump mapping of SSA_NAMEs to decls.
>
> --- gcc/gimple-lower-bitint.cc.jj 2024-01-26 00:07:35.629797857 +0100
> +++ gcc/gimple-lower-bitint.cc 2024-01-26 17:40:29.083814064 +0100
> @@ -6344,22 +6344,33 @@ gimple_lower_bitint (void)
> }
> }
> tree atype = NULL_TREE;
> + if (dump_file && (dump_flags & TDF_DETAILS))
> + fprintf (dump_file, "Mapping SSA_NAMEs to decls:\n");
> EXECUTE_IF_SET_IN_BITMAP (large_huge.m_names, 0, i, bi)
> {
> tree s = ssa_name (i);
> int p = var_to_partition (large_huge.m_map, s);
> - if (large_huge.m_vars[p] != NULL_TREE)
> - continue;
> - if (atype == NULL_TREE
> - || !tree_int_cst_equal (TYPE_SIZE (atype),
> - TYPE_SIZE (TREE_TYPE (s))))
> + if (large_huge.m_vars[p] == NULL_TREE)
> {
> - unsigned HOST_WIDE_INT nelts
> - = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (s))) / limb_prec;
> - atype = build_array_type_nelts (large_huge.m_limb_type, nelts);
> + if (atype == NULL_TREE
> + || !tree_int_cst_equal (TYPE_SIZE (atype),
> + TYPE_SIZE (TREE_TYPE (s))))
> + {
> + unsigned HOST_WIDE_INT nelts
> + = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (s))) / limb_prec;
> + atype = build_array_type_nelts (large_huge.m_limb_type,
> + nelts);
> + }
> + large_huge.m_vars[p] = create_tmp_var (atype, "bitint");
> + mark_addressable (large_huge.m_vars[p]);
> + }
> + if (dump_file && (dump_flags & TDF_DETAILS))
> + {
> + print_generic_expr (dump_file, s, TDF_SLIM);
> + fprintf (dump_file, " -> ");
> + print_generic_expr (dump_file, large_huge.m_vars[p], TDF_SLIM);
> + fprintf (dump_file, "\n");
> }
> - large_huge.m_vars[p] = create_tmp_var (atype, "bitint");
> - mark_addressable (large_huge.m_vars[p]);
> }
> }
>
>
> Jakub
>
@@ -6344,22 +6344,33 @@ gimple_lower_bitint (void)
}
}
tree atype = NULL_TREE;
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Mapping SSA_NAMEs to decls:\n");
EXECUTE_IF_SET_IN_BITMAP (large_huge.m_names, 0, i, bi)
{
tree s = ssa_name (i);
int p = var_to_partition (large_huge.m_map, s);
- if (large_huge.m_vars[p] != NULL_TREE)
- continue;
- if (atype == NULL_TREE
- || !tree_int_cst_equal (TYPE_SIZE (atype),
- TYPE_SIZE (TREE_TYPE (s))))
+ if (large_huge.m_vars[p] == NULL_TREE)
{
- unsigned HOST_WIDE_INT nelts
- = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (s))) / limb_prec;
- atype = build_array_type_nelts (large_huge.m_limb_type, nelts);
+ if (atype == NULL_TREE
+ || !tree_int_cst_equal (TYPE_SIZE (atype),
+ TYPE_SIZE (TREE_TYPE (s))))
+ {
+ unsigned HOST_WIDE_INT nelts
+ = tree_to_uhwi (TYPE_SIZE (TREE_TYPE (s))) / limb_prec;
+ atype = build_array_type_nelts (large_huge.m_limb_type,
+ nelts);
+ }
+ large_huge.m_vars[p] = create_tmp_var (atype, "bitint");
+ mark_addressable (large_huge.m_vars[p]);
+ }
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ print_generic_expr (dump_file, s, TDF_SLIM);
+ fprintf (dump_file, " -> ");
+ print_generic_expr (dump_file, large_huge.m_vars[p], TDF_SLIM);
+ fprintf (dump_file, "\n");
}
- large_huge.m_vars[p] = create_tmp_var (atype, "bitint");
- mark_addressable (large_huge.m_vars[p]);
}
}