[llvm] Don't rely on undefined behavior to store how a `User` object's allocation is laid out (PR #105714)

Daniel Paoliello via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 9 13:49:41 PDT 2024


dpaoliello wrote:

> I've been reviewing the Use system code, and we already pass in a dead `Use*` parameter to the `User` ctor. Every User subclass already knows if it uses fixed, variadic, or hung off operands. I think we can just feed that same data up the inherited constructor call graph, or rely on OperandTraits<decltype(*this)> to figure it out, or something. We really just need to pass in two bits: 1. if the uses are hung off (allocated separately) 2. if there is a descriptor
> 
> All the fixed operand call sites can pass the false / zero / no-op-flag values to an updated User constructor, and while we're at it, we can drop the dead Use operand list pointer.

Done - please let me know if you like the approach, I was trying to make it easy to get "correct" (i.e., avoiding folks from having to know exactly what specific arguments to pass to the constructor).

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


More information about the llvm-commits mailing list