Skip to content

Commit 185865b

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 928fc24 commit 185865b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

gcc/emit-rtl.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6189,8 +6189,13 @@ init_emit_once (void)
61896189
/* Don't use gen_rtx_CONST_INT here since gen_rtx_CONST_INT in this case
61906190
tries to use these variables. */
61916191
for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++)
6192-
const_int_rtx[i + MAX_SAVED_CONST_INT] =
6193-
gen_rtx_raw_CONST_INT (VOIDmode, (HOST_WIDE_INT) i);
6192+
{
6193+
// Do not initialize twice the constants because there are used elsewhere
6194+
// and libgccjit execute this function twice.
6195+
if (const_int_rtx[i + MAX_SAVED_CONST_INT] == NULL)
6196+
const_int_rtx[i + MAX_SAVED_CONST_INT] =
6197+
gen_rtx_raw_CONST_INT (VOIDmode, (HOST_WIDE_INT) i);
6198+
}
61946199

61956200
if (STORE_FLAG_VALUE >= - MAX_SAVED_CONST_INT
61966201
&& STORE_FLAG_VALUE <= MAX_SAVED_CONST_INT)

0 commit comments

Comments
 (0)