[llvm] [DomTree] Reduce number of hash table lookups (NFC) (PR #73097)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 22 01:24:02 PST 2023
================
@@ -304,8 +306,7 @@ struct SemiNCAInfo {
// Note that the parents were stored in IDoms and later got invalidated
// during path compression in Eval.
for (unsigned i = 2; i < NextDFSNum; ++i) {
- const NodePtr W = NumToNode[i];
- auto &WInfo = NodeToInfo[W];
+ auto &WInfo = *NumToInfo[i];
const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
----------------
nikic wrote:
If you're wondering why I didn't change this to `NumToNode[WInfo.Semi]` as well, the reason is that `WInfo.Semi` can be `0` for PDTs here. Because the PDT virtual root `nullptr` happens to be the same as the `NumToNode` sentinel, this ends up looking up the info for the virtual root.
I could easily work around this here, but I didn't do this because I think this indicates a (probably harmless) bug somewhere else, and Semi is supposed to be 1 (the virtual root) rather than 0 here.
https://github.com/llvm/llvm-project/pull/73097
More information about the llvm-commits
mailing list