This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug jit/64722] On 2nd time libgccjit is run in-process on i686, generated code clobbers %ebx register
- From: "enkovich.gnu at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 22 Jan 2015 15:45:36 +0000
- Subject: [Bug jit/64722] On 2nd time libgccjit is run in-process on i686, generated code clobbers %ebx register
- Auto-submitted: auto-generated
- References: <bug-64722-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64722
--- Comment #11 from Ilya Enkovich <enkovich.gnu at gmail dot com> ---
(In reply to David Malcolm from comment #10)
> which led to investigating this code in ix86_conditional_register_usage:
> 4394 j = PIC_OFFSET_TABLE_REGNUM;
> 4395 if (j != INVALID_REGNUM)
> 4396 fixed_regs[j] = call_used_regs[j] = 1;
> and line 4396 is bizarrely only called on the 2nd iteration, not the 1st,
> which led me to investigate "PIC_OFFSET_TABLE_REGNUM", and discover what
> appears to be the root cause, as described in comment #1.
Now I see. The problem also is in ix86_conditional_register_usage that relies
on pic_offset_table_rtx value. As I said EBX value is used only to estimate
costs for middle-end. Thus we shouldn't fix reg here if pseudo pic register is
used and correct code would be:
@@ -4388,7 +4388,7 @@ ix86_conditional_register_usage (void)
/* The PIC register, if it exists, is fixed. */
j = PIC_OFFSET_TABLE_REGNUM;
- if (j != INVALID_REGNUM)
+ if (j != INVALID_REGNUM && !ix86_use_pseudo_pic_reg ())
fixed_regs[j] = call_used_regs[j] = 1;
/* For 32-bit targets, squash the REX registers. */