[Bug target/64348] [5 Regression] Case scal-to-vec1.c failed on arm-linux-gnueabi with -fPIC

amker at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Dec 20 09:21:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64348

--- Comment #1 from amker at gcc dot gnu.org ---
IRA made below decision:

;; a299(r989,l0) conflicts: a57(r1696,l0) a177(r130,l0) a221(r131,l0)
a63(r1714,l0) a178(r822,l0) a224(r823,l0) a69(r1713,l0) a180(r815,l0)
a227(r816,l0) a75(r1712,l0) a182(r808,l0) a230(r809,l0) a81(r1711,l0)
a184(r801,l0) a233(r802,l0) a87(r1710,l0) a186(r794,l0) a236(r795,l0)
a93(r1709,l0) a188(r787,l0) a239(r788,l0) a100(r1708,l0) a190(r128,l0)
a191(r780,l0) a247(r781,l0) a284(r126,l0) a175(r125,l0) a14(r1706,l0)
a138(r141,l0) a139(r742,l0) a141(r737,l0) a143(r732,l0) a145(r727,l0)
a147(r722,l0) a149(r717,l0) a151(r139,l0) a152(r712,l0) a105(r1695,l0)
a291(r992,l0)
;;     total conflict hard regs: 0 1 12 14
;;     conflict hard regs: 0 1 12 14

Spilling a100r1708 for a299r989
Assigning 2 to a299r989

With ira dump like below:
  430: [sfp:SI-0x30]=r989:TI#0
  432: [r1706:SI+0x4]=r989:TI#4
  434: [r1706:SI+0x8]=r989:TI#8
  436: [r1706:SI+0xc]=r989:TI#12
  441: r0:DI=call [`__aeabi_idivmod'] argc:0
      REG_UNUSED r0:SI
      REG_CALL_DECL `__aeabi_idivmod'
      REG_EH_REGION 0xffffffff80000000
  437: r1007:SI=sign_extend(r989:TI#0)
      REG_DEAD r989:TI

lra needs to split r989 between 436 and 437 with call_save_p holds.  Since r989
is a register in TImode, the save/restore requires more than 2 instructions,
code in split_reg has:
  if (NEXT_INSN (save) != NULL_RTX)
    {
      lra_assert (! call_save_p);
      if (lra_dump_file != NULL)
    {
      fprintf
        (lra_dump_file,
         "      Rejecting split %d->%d resulting in > 2 %s save insns:\n",
         original_regno, REGNO (new_reg), call_save_p ? "call" : "");
      dump_rtl_slim (lra_dump_file, save, NULL, -1, 0);
      fprintf (lra_dump_file,
           "    ))))))))))))))))))))))))))))))))))))))))))))))))\n");
    }
      return false;
    }
  restore = emit_spill_move (false, new_reg, original_reg);
  if (NEXT_INSN (restore) != NULL_RTX)
    {
      lra_assert (! call_save_p);
      if (lra_dump_file != NULL)
    {
      fprintf (lra_dump_file,
           "    Rejecting split %d->%d "
           "resulting in > 2 %s restore insns:\n",
           original_regno, REGNO (new_reg), call_save_p ? "call" : "");
      dump_rtl_slim (lra_dump_file, restore, NULL, -1, 0);
      fprintf (lra_dump_file,
           "    ))))))))))))))))))))))))))))))))))))))))))))))))\n");
    }
      return false;
    }

It assumes that number of save/restore instructions for call_save_p registers
isn't larger than 2, which apparently no true in this case for r989:TI.

This can be fixed by splitting call_save_p register even it results in more
instruction, but I am not sure if it should be fixed before this code.

Also, we don't need to save/resotre all 16 bytes of r989 here, because only 4
bytes of them is live across the call.  Maybe lra can be improved for this
case, but that's another optimization issue.



More information about the Gcc-bugs mailing list