[llvm] [RFC][Attributor] change argument privatization to size-based type selection (PR #181716)

Jameson Nash via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 11 06:47:26 PDT 2026


vtjnash wrote:

As I looked closer into the ABI compatibility issue, I realized there's another problem with this pass, currently as well with this approach, in the case of spreading poison. The introduction of spreading poison was known at the time to make the SROA pass unsound, and any other pass like it which loads from memory. Those issues are supposed to be fixed eventually with the byte type. But until that's implemented, I'm not entirely certain how much can be safely done in making this pass more powerful (and only sized-based).

Perhaps the best option for this pass is going with my original suggested alternative: switch from getAllocatedType to PtrUseVisitor (with a bugfix to actually visit all ptr uses: https://github.com/llvm/llvm-project/pull/179726). That pass can record the known types of all non-splittable stores--and most importantly their strides--so that we won't invent a type for use here which might accidentally spread poison. Additionally, that change would be motivated by rust's compiler, where alloca are already always represented as simple i8 arrays, which can makes this pass unsound with ptr even before the removal of getAllocatedType.

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


More information about the llvm-commits mailing list