This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug jit/64722] On 2nd time libgccjit is run in-process on i686, generated code clobbers %ebx register


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.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]