Open fhahn opened 5 years ago
If we can incrementally update the merge sets based on DT updates, this should fix PR 16756. Daniel Berlin indicated something like that a while ago https://reviews.llvm.org/D44282#1032242
And there is already a patch to add a merge set implementation: https://reviews.llvm.org/D57123
Other places where this potentially could help is LCSSA & MemorySSA, at least to limit worst case compile time
assigned to @fhahn
Extended Description
Currently LLVM does not do SSA renaming as efficiently as it could do. In some places, like Mem2Reg, we use custom renaming implementations and at other places we use SSAUpdater, which has to traverse the CFG for each renamed variable, to decide where to place PHIs.
For bulk updates, like in Mem2Reg, we could use merge sets as described in Das and Ramakrishna's paper (Dibyendu Das and U. Ramakrishna. 2005. A practical and fast iterative algorithm for φ-function computation using DJ graphs) to efficiently find the points where PHI nodes are needed, rather than using IDF, which potentially has to traverse the full CFG for each variable.
This can be combined with a renamer similar to the one in PredicateInfo, which does renaming in O(log(Uses to rename)).
The related PRs will be sped up by this infrastructure.