<div dir="ltr">Hi Krzysztof,<div><br></div><div>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.<br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">+    // Verify that this slot is valid for this register.<br>
+    int FI = Scavenged[I].FrameIndex;<br>
+    unsigned S = MFI.getObjectSize(FI);<br>
+    unsigned A = MFI.getObjectAlignment(FI);<br>
+    if (NeedSize > S || NeedAlign > A)<br>
+      continue;<br></blockquote><div><br></div><div>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.</div><div><br></div><div>I have fixed this in my tree by adding</div><div><br></div><div>if (FI < 0)</div><div>  continue;</div><div><br></div><div>before the the call to MFI.getObjectSize(FI) in the code above, see the attached patch, but there may be a cleaner/better solution.</div><div><br></div><div>Jordy</div></div></div></div></div>