[llvm] [Analysis] Enhance alignment propagation in computeKnownBits. (PR #171828)
Shamshura Egor via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 12 10:38:51 PST 2025
egorshamshura wrote:
> I'm not sure it makes sense to extend InferAlign beyond what it handles now. Once we go beyond ptrtoint + and, there's a lot of possible patterns to handle, and hardcoding them all is not scalable.
>
>
>
> On the other hand, doing this in ValueTracking in a way that has little compile-time impact will also be unreliable, as we'll have to severely restrict the number of visited uses.
>
>
>
> Probably the ideal solution here is to have something like `align` attribute/metadata on `ptrtoint` so we can infer that once and then computeKnownBits can use the computed value. But that's a more complex change...
In InferAlignment we update alignment for load and store operations. So maybe we can update alignment not for instructions but for pointer? (however idk if we can set alignment for any pointer)
I think if it is impossible then I can try to add attribute/metadata on 'ptrtoint'
https://github.com/llvm/llvm-project/pull/171828
More information about the llvm-commits
mailing list