Jonas Paulsson via llvm-dev
2019-Sep-16 08:53 UTC
[llvm-dev] MachineBasicBlock asserts in erase() and move()
Hi, It has been discovered that SystemZTargetLowering::emitSelect() calls erase() on a range of instructions on the wrong MBB, without any assert triggering with seemingly correct behaviour (!). StartMBB->erase() should be JoinMBB->erase() since that's where the SelectPseudo(s) will reside. I am not sure why this "works" at the moment, or why there is not an assert checking for this. I made a patch to add asserts in erase() and remove() methods (attached), but found no other cases, though. Is there a reason this is not asserted in ilist? /Jonas -------------- next part -------------- A non-text attachment was scrubbed... Name: latest.patch Type: text/x-patch Size: 2351 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190916/489c4a8e/attachment.bin>
David Blaikie via llvm-dev
2019-Sep-16 20:11 UTC
[llvm-dev] MachineBasicBlock asserts in erase() and move()
Probably works because a linked list doesn't necessarily need to consult the list object itself when doing operations on subranges of it - it can manipulate the nodes directly so it doesn't tend to matter what list those nodes belong to. & if it doesn't fail, inevitably someone'll accidentally rely on it. An assert wouldn't be a bad thing, I think. On Mon, Sep 16, 2019 at 1:53 AM Jonas Paulsson via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > It has been discovered that SystemZTargetLowering::emitSelect() calls > erase() on a range of instructions on the wrong MBB, without any assert > triggering with seemingly correct behaviour (!). StartMBB->erase() > should be JoinMBB->erase() since that's where the SelectPseudo(s) will > reside. > > I am not sure why this "works" at the moment, or why there is not an > assert checking for this. I made a patch to add asserts in erase() and > remove() methods (attached), but found no other cases, though. > > Is there a reason this is not asserted in ilist? > > /Jonas > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190916/2b6ac77d/attachment.html>