This patch preserve dereferenceable, nonnull and alignment from loads and stores.
I love the progress :) Some comments below.
|35 ↗||(On Diff #252521)|
Feel free to commit this as NFC right away.
Let's make this a member function like addCall. We should also merge this with existing logic and put it as a helper somewhere. Given an instruction, and potentially a set of attributes as filter, determine all attributes we can derive from the instruction. I might look into this as the attributor should use that as well to cut down on duplication.
I'd switch on the opcodes, use if-else-if, or early returns.
I agree we should try to prevent duplication but we will need to be careful not to be too restrictive about the representation the caller can use such that it can be used widely.
an issue which is hopefully going to get resolved soon. i think this API should reside in Analysis and there are some issues with dependencies for KnowledgeRetention see D76149#inline-701084 for details.
I only have coding style comments left. Providing the logic in a more general way will be future work.
The above two lines is T, isn't it?
Style: TBH, I'm not necessarily a fan of the overloading via lambda idea. Couldn't we pass all necessary information to addLoadOrStore. I mean, we make it addAccessedPtr(Instruction &Inst, Value &Ptr, Type &AccTy, MaybeAlign Alignment)
i have not seen an example where DerefSize is 0 but since we obtain a minimum size it wouldn't surprise me if it did exist.