[llvm-dev] Issue with shrink wrapping

Momchil Velikov via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 11 00:17:10 PDT 2018


On Tue, Apr 10, 2018 at 11:39 AM, Francis Visoiu Mistrih <
francisvm at yahoo.com> wrote:

>
> I've "fixed" this by modifying `ShrinkWrap::useOrDefCSROrFI` to explicitly
> check
> for the stack pointer register (using
> `TLI.getStackPointerRegisterToSaveRestore`)
>
>
> This part sounds ok to me. Can you put up a patch please?
>

​Yes, working on it...​


> and also to ignore tall call
> instructions (`isCall() && isReturn()`), since they implictly use SP (for
> AArch{32,64} at least).
>
>
> Calls are handled through the regmask check, and return blocks should be
> handled by the common-dominator call. Did you run into any issues with
> this? Marking blocks containing `isReturn` instructions as used will
> basically make shrink-wrapping to fail all the time.
>

​Actually, I do just the opposite, make sure tail calls do not prevent a
block from being used as a save/restore point, regardless of the fact that
a tail call may use SP.
​

>
>
> Does this look correct? Are there alternatives?
>
>
> Another thing we could do is to add SP (through TLI.
> getStackPointerRegisterToSaveRestore) to the CurrentCSRs set
> (and probably rename the set).
>

​Right, make sense.

Thanks a lot,
Momchil Velikov​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180411/86640b08/attachment.html>


More information about the llvm-dev mailing list