[PATCH] Fix a couple of use-after-frees in X86ISelDAGToDAG

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 12 13:46:03 PDT 2016


Ahmed Bougacha <ahmed.bougacha at gmail.com> writes:
> Looks like the only uses are DL/VT; maybe just get those earlier (and
> explain in a comment)?

You're right. The attached works. It's still pretty fragile / easy to
get wrong obviously, but it's a strict improvement for now.

> Also, I thought SelectionDAGISel.cpp had the same issues.  You do
> mention ISD::DELETED_NODE in the PR; I guess you have a plan to get
> rid of that?

The ISD::DELETED_NODE stuff is a little bit more involved, largely since
the use-after-frees are very intentional there. I've been experimenting
with ways to clean that up, but I'm fixing up the other places in LLVM
where we have these problems while I'm at it.

> -Ahmed
>
>
> On Tue, Apr 12, 2016 at 11:14 AM, Justin Bogner <mail at justinbogner.com> wrote:
>> While looking at llvm.org/PR26808 I found a couple of use-after-frees in
>> X86ISelDAGToDAG, where we RAUW a node and then try to keep using it. The
>> attached patch fixes the tests that crash under ASan, but it feels a bit
>> targetted and kludgy. I'm afraid a robust fix would involve a lot of
>> refactoring of how X86ISelDAGToDAG works though, and I certainly won't
>> be able to do that any time soon.
>>
>> Thoughts?
>>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: x86-dag-to-dag-2.patch
Type: text/x-patch
Size: 2385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160412/ab750eef/attachment.bin>


More information about the llvm-commits mailing list