[llvm] [IR] Fix User use-after-destroy by zapping in ~User (PR #170575)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 18:03:46 PST 2025


https://github.com/boomanaiden154 commented:

Thank you very much for working on this.

My understanding of why no one has fixed this yet is that the hard part is engineering the fix in such a way that we don't degrade performance. It would be good to get numbers for this specific approach. I would guess that the heap memory usage increase would be non-trivial, and there might be some non-trivial compile time impact too (more d-cache misses). If it's close to free, then we should just go with it. I don't think I have any brilliant ideas on how to do better.

I guess this is another motivation for bumping the minimum C++ standard for LLVM to C++20. C++20 has destroying operator delete, which I think would make this issue pretty easy to fix.

As an aside, #24952 also mentions that MDNode has the same issue. Does anyone know the current status of that?

https://github.com/llvm/llvm-project/pull/170575


More information about the llvm-commits mailing list