[llvm] r269969 - When looking for a spill slot in reg scavenger, find one that matches RC

Jordy Potman via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 05:04:26 PDT 2016


Hi Krzysztof,

I'm seeing an "Invalid Object Idx" assert in the call to
MFI.getObjectSize(FI) in the code below on my out of tree target after this
commit.

+    // Verify that this slot is valid for this register.
> +    int FI = Scavenged[I].FrameIndex;
> +    unsigned S = MFI.getObjectSize(FI);
> +    unsigned A = MFI.getObjectAlignment(FI);
> +    if (NeedSize > S || NeedAlign > A)
> +      continue;
>

The reason for this is that the Scavenged vector may contain a
ScavengedInfo structure with a FrameIndex of -1 after the first call of
scavengeRegister on targets where there is no spill slot but the target
knows how to save/restore the register (using TRI->saveScavengerRegister).
This ScavengedInfo structure with a FrameIndex of -1 is added to the
Scavenged vector by the code on lines 425-429 in the first call of
scavengeRegister.

I have fixed this in my tree by adding

if (FI < 0)
  continue;

before the the call to MFI.getObjectSize(FI) in the code above, see the
attached patch, but there may be a cleaner/better solution.

Jordy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160520/798b0fd2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RegisterScavenging.patch
Type: text/x-patch
Size: 563 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160520/798b0fd2/attachment.bin>


More information about the llvm-commits mailing list