Skip to content

Commit b70e0e1

Browse files
committed
Fix a RTL bug for libgccjit which fixes a 'unrecognizable insn' error when generating some code using target-specific builtins
1 parent 73a2882 commit b70e0e1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

gcc/emit-rtl.cc

+7-2
Original file line numberDiff line numberDiff line change
@@ -6191,8 +6191,13 @@ init_emit_once (void)
61916191
/* Don't use gen_rtx_CONST_INT here since gen_rtx_CONST_INT in this case
61926192
tries to use these variables. */
61936193
for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++)
6194-
const_int_rtx[i + MAX_SAVED_CONST_INT] =
6195-
gen_rtx_raw_CONST_INT (VOIDmode, (HOST_WIDE_INT) i);
6194+
{
6195+
// Do not initialize twice the constants because there are used elsewhere
6196+
// and libgccjit execute this function twice.
6197+
if (const_int_rtx[i + MAX_SAVED_CONST_INT] == NULL)
6198+
const_int_rtx[i + MAX_SAVED_CONST_INT] =
6199+
gen_rtx_raw_CONST_INT (VOIDmode, (HOST_WIDE_INT) i);
6200+
}
61966201

61976202
if (STORE_FLAG_VALUE >= - MAX_SAVED_CONST_INT
61986203
&& STORE_FLAG_VALUE <= MAX_SAVED_CONST_INT)

0 commit comments

Comments
 (0)