This is the next patch of D76210.
This patch made a map in InformationCache for caching results.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I'm not sold on the liveness check. Do we have users of this function that would even try to call with a dead instruction? Usually, liveness is backed in so deep that all AAs actually see is assumed life.
llvm/include/llvm/Transforms/IPO/Attributor.h | ||
---|---|---|
729 | Please add documentation and consider taking the instructions as references. Nit: Move F after the first check to shorten the lifetime (and avoid confusion). | |
2397 | Style: Most our interfaces take the Attributor first (I think). |
On second thoughts, I think so too about the licenses check.
Could you tell me where you think we can use the liveness information in this comment?
llvm/include/llvm/Transforms/IPO/Attributor.h | ||
---|---|---|
729 | Do you expect that I change interfaces of AAReachability to take instructions as references too? |
Right. What I meant is we should use liveness when computing the entire reachability result, not only the endpoints. We can (reasonably) expect users to do the latter (for now).
If we compute reachability ourselves it is a different story as we can use the liveness of edges (eventually) to improve the result.
llvm/include/llvm/Transforms/IPO/Attributor.h | ||
---|---|---|
729 | Yes, feel free to change the other interface as well. There is no(t much) "functional benefit". In the Attributor we usually use references whenever we cannot pass null and pointers when we might (or have to use pointers). At the end of the day it is just a hint for the user that nullptr is not acceptable. |
fix according to review comments
change the purpose of this patch to caching query results only.
Now that I look at this again, why don't we move everything into AAReachability, the map and such. It is the place we will eventually also compute things. The code looks good otherwise.
I have difficulty in moving into AAReachability because a member should be const function. If the map move in AAReachability, the function that cache query results cannot be const. That's why I put the cache in InformationCache.
Please add documentation and consider taking the instructions as references.
Nit: Move F after the first check to shorten the lifetime (and avoid confusion).