[PATCH] GVN: Don't crash on an unreachable predecessor

Rafael EspĂ­ndola rafael.espindola at gmail.com
Sat Nov 29 08:11:21 PST 2014


On 29 November 2014 at 10:14, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> Unfortunately it would still crash on the original testcase :-(
>
> It now reduces to
>
> define i32 @f(i32 **%f) {
> bb0:
>   %bar = load i32** %f
>   br label %bb2
> bb1:
>   %zed = load i32** %f
>   br i1 false, label %bb2, label %bb1
> bb2:
>   %foo = phi i32* [ null, %bb0 ], [ %zed, %bb1 ]
>   %storemerge = load i32* %foo, align 4
>   ret i32 %storemerge
> }
>
> So the assert fails since bb1 has a predecessor: itself.
>
> That can be avoided with the attached patch (which would still need
> the stronger test added). It fixes the original test is the bug report
> and the clang-interpreter link where I first hit the crash.
>
> I am currently testing a full bootstrap.

The 3 stage lto bootstrap finished fine.

The attached patch includes the modified testcase. Is it OK? I am no
gvn expert either, but it looks like we are better with it than
without :-)

Cheers,
Rafael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.patch
Type: text/x-patch
Size: 1403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141129/fc8ced7c/attachment.bin>


More information about the llvm-commits mailing list