[prange] Avoid looking at type() for undefined ranges

Undefined ranges have no type.  This patch fixes the thinko.

gcc/ChangeLog:

	PR middle-end/115128
	* ipa-cp.cc (ipa_value_range_from_jfunc): Check for undefined_p
	before looking at type.
	(propagate_vr_across_jump_function): Same.

gcc/testsuite/ChangeLog:

	* gcc.dg/tree-ssa/pr115128.c: New test.
pull/91/merge
Aldy Hernandez 2024-05-17 10:30:03 +02:00
parent a5b3721c06
commit bc6e336cb7
2 changed files with 35 additions and 0 deletions

View File

@ -1744,6 +1744,8 @@ ipa_value_range_from_jfunc (vrange &vr,
pointer type to hold the result instead of a boolean
type. Avoid trapping in the sanity check in
fold_range until this is fixed. */
|| srcvr.undefined_p ()
|| op_vr.undefined_p ()
|| !handler.operand_check_p (vr_type, srcvr.type (), op_vr.type ())
|| !handler.fold_range (op_res, vr_type, srcvr, op_vr))
op_res.set_varying (vr_type);
@ -2556,6 +2558,8 @@ propagate_vr_across_jump_function (cgraph_edge *cs, ipa_jump_func *jfunc,
pointer type to hold the result instead of a boolean
type. Avoid trapping in the sanity check in
fold_range until this is fixed. */
|| src_lats->m_value_range.m_vr.undefined_p ()
|| op_vr.undefined_p ()
|| !handler.operand_check_p (operand_type,
src_lats->m_value_range.m_vr.type (),
op_vr.type ())

View File

@ -0,0 +1,31 @@
/* { dg-do compile } */
/* { dg-options "-O3 -w" } */
long XXH3_len_4to8_64b_len, XXH3_len_0to16_64b___trans_tmp_3, XXH3_mix2Accs_acc,
XXH3_64bits_internal___trans_tmp_8;
typedef unsigned long XXH3_hashLong64_f();
void *XXH3_64bits_internal_input;
int XXH3_64bits_internal___trans_tmp_1;
void XXH3_mul128_fold64();
static void XXH3_mergeAccs(unsigned long) {
for (;;)
XXH3_mul128_fold64(XXH3_mix2Accs_acc);
}
static __attribute__((noinline)) unsigned long
XXH3_hashLong_64b_default(void *, unsigned long len) {
XXH3_mergeAccs(len * 7);
}
__attribute__((always_inline)) long
XXH3_64bits_internal(unsigned long len, XXH3_hashLong64_f f_hashLong) {
if (len <= 16) {
long keyed =
XXH3_64bits_internal___trans_tmp_1 ^ XXH3_len_0to16_64b___trans_tmp_3;
XXH3_mul128_fold64(keyed, XXH3_len_4to8_64b_len);
return XXH3_64bits_internal___trans_tmp_8;
}
f_hashLong(XXH3_64bits_internal_input, len);
}
static void XXH_INLINE_XXH3_64bits(unsigned long len) {
XXH3_64bits_internal(len, XXH3_hashLong_64b_default);
}
void __cmplog_rtn_hook() { XXH_INLINE_XXH3_64bits(sizeof(long)); }