This patch produces an edge-based interface in AAIsDead.
By this, we can query a set of basic blocks that are directly reachable from a given basic block.
This is specifically useful for implementation of AAReachability.
Details
Diff Detail
Event Timeline
llvm/include/llvm/Transforms/IPO/Attributor.h | ||
---|---|---|
2654 | This will create (and below copy) these vectors all the time, that should be avoided. Can we instead make this a wrapper around succ_begin, e.g., you ask for a successor iterator only for live edges, and you can use it with succ_end. Basically, return an iterator that skips dead edges. |
- change interface to return an iterator corresponds to the next live successor
- make cache for edges in AAIsDeadFunction
llvm/lib/Transforms/IPO/AttributorAttributes.cpp | ||
---|---|---|
3196 | Given that a block has usually 1 or 2 successors we should consider a different data structure here. I would initially think a Set<std::pair<BasicBlock*,BasicBlock*>> is adequate, so we collect edges that are assumed live in there. |
LGTM, one nit
llvm/lib/Transforms/IPO/AttributorAttributes.cpp | ||
---|---|---|
3369 | Move this into the else case below. Only if I is a terminator we need to do this and then we know it is an edge. This actually doesn't catch self loops, so move the insert into the else and remove the condition. |
This will create (and below copy) these vectors all the time, that should be avoided. Can we instead make this a wrapper around succ_begin, e.g., you ask for a successor iterator only for live edges, and you can use it with succ_end. Basically, return an iterator that skips dead edges.