-
- Downloads
ipa: Better value ranges for pointer integer constants
When looking into cases where we know an actual argument of a call is a constant but we don't generate a singleton value-range for the jump function, I found out that the special handling of pointer constants does not work well for constant zero pointer values. In fact the code only attempts to see if it can figure out that an argument is not zero and if it can figure out any alignment information. With this patch, we try to use the value_range that ranger can give us in the jump function if we can and we query ranger for all kinds of arguments, not just SSA_NAMES (and so also pointer integer constants). If we cannot figure out a useful range we fall back again on figuring out non-NULLness with tree_single_nonzero_warnv_p. With this patch, we generate [prange] struct S * [0, 0] MASK 0x0 VALUE 0x0 instead of for example: [prange] struct S * [0, +INF] MASK 0xfffffffffffffff0 VALUE 0x0 for a zero constant passed in a call. If you are wondering why we check whether the value range obtained from range_of_expr can be undefined, even when the function returns true, that is because that can apparently happen fro default-definition SSA_NAMEs. gcc/ChangeLog: 2024-11-15 Martin Jambor <mjambor@suse.cz> * ipa-prop.cc (ipa_compute_jump_functions_for_edge): Try harder to use the value range obtained from ranger for pointer values.
Loading
Please register or sign in to comment