Skip to content

Commit 25a5500

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 9f46c20 commit 25a5500

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
@@ -6187,8 +6187,13 @@ init_emit_once (void)
61876187
/* Don't use gen_rtx_CONST_INT here since gen_rtx_CONST_INT in this case
61886188
tries to use these variables. */
61896189
for (i = - MAX_SAVED_CONST_INT; i <= MAX_SAVED_CONST_INT; i++)
6190-
const_int_rtx[i + MAX_SAVED_CONST_INT] =
6191-
gen_rtx_raw_CONST_INT (VOIDmode, (HOST_WIDE_INT) i);
6190+
{
6191+
// Do not initialize twice the constants because there are used elsewhere
6192+
// and libgccjit execute this function twice.
6193+
if (const_int_rtx[i + MAX_SAVED_CONST_INT] == NULL)
6194+
const_int_rtx[i + MAX_SAVED_CONST_INT] =
6195+
gen_rtx_raw_CONST_INT (VOIDmode, (HOST_WIDE_INT) i);
6196+
}
61926197

61936198
if (STORE_FLAG_VALUE >= - MAX_SAVED_CONST_INT
61946199
&& STORE_FLAG_VALUE <= MAX_SAVED_CONST_INT)

0 commit comments

Comments
 (0)