[PATCH] Fix miscompile due to StackColoring incorrectly merging stack slots
Nadav Rotem
nrotem at apple.com
Wed May 15 12:16:11 PDT 2013
Hi Mark,
Thanks for catching this. This change LGTM.
Nadav
On May 15, 2013, at 11:23 AM, Mark Seaborn <mseaborn at chromium.org> wrote:
> Fix miscompile due to StackColoring incorrectly merging stack slots
>
> IR optimisation passes can result in a basic block that contains:
>
> llvm.lifetime.start(%buf)
> ...
> llvm.lifetime.end(%buf)
> ...
> llvm.lifetime.start(%buf)
>
> Before this change, calculateLiveIntervals() was ignoring the second
> lifetime.start() and was regarding %buf as being dead from the
> lifetime.end() through to the end of the basic block. This can cause
> StackColoring to incorrectly merge %buf with another stack slot.
>
> Fix by removing the incorrect Starts[pos].isValid() and
> Finishes[pos].isValid() checks.
>
> Just doing:
> Starts[pos] = Indexes->getMBBStartIdx(MBB);
> Finishes[pos] = Indexes->getMBBEndIdx(MBB);
> unconditionally would be enough to fix the bug, but it causes some
> test failures due to stack slots not being merged when they were
> before. So, in order to keep the existing tests passing, treat LiveIn
> and LiveOut separately rather than approximating the live ranges by
> merging LiveIn and LiveOut.
>
> This fixes PR15707.
>
> <Mail Attachment>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130515/9b04e037/attachment.html>
More information about the llvm-commits
mailing list