This patch add the definition for a maxobjsize attribute that keeps
track of the maximum size of the object corresponding to the pointer
value. This should help with Alias Analysis by using this as an upper
bound and dereferenceable as a lower bound on the object size, and if two
object sizes don't overlap, they cannot alias.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I think you should split this in two patches. One that introduces the IR attribite and one for attributor deduction.
llvm/lib/IR/Value.cpp | ||
---|---|---|
724 | Can you use llvm::getObjectSize here, instead of rolling your own version that has bugs? |
llvm/lib/IR/Value.cpp | ||
---|---|---|
724 | I don't think we can, this check here is trying to offload the actual max object size calculation to the Attributor, while getObjectSize doesn't take the attributes into account at all (from what I can tell). |
llvm/lib/IR/Value.cpp | ||
---|---|---|
724 | I mean specifically for the cases where there aren't relevant attributes, like AllocaInst and GlobalVariable. |
llvm/lib/IR/Value.cpp | ||
---|---|---|
724 | What @efriedma means is that you should not do the DL.getXXXXXSize lookup but instead do getObjSize which knows about corner cases. This is the place where we only look at the IR and report properties. No analyses connections, just pure information retrieval from the IR, the "base case" for an analysis if you want. |
I have raised concerns with the way this is specified, and in particular, the interactions with dereferenceable on the llvm-dev thread. I am marking the review as "Request Changes" to ensure these comments are not lost and the patch isn't accidentally landed without addressing same.
Can you use llvm::getObjectSize here, instead of rolling your own version that has bugs?