[llvm] [CodeGen] Search predecessors from the back in removePredecessor() (PR #206070)
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 26 21:27:30 PDT 2026
rnk wrote:
The core issue is that removing a predecessor is still `O(#preds)`, and we normally think of RAUW as `O(#uses)`, and that's usually close to `O(1)`. We don't have the same problem in IR because we can swap out a switch label operand directly through the uselist.
A better data structure here might be a `SmallSetVector`, but supposedly that has `O(n)` removal. This is an application where tombstoning might be a better choice.
In the meantime, I think trying to optimize pop-back access patterns is fragile, but reasonable.
https://github.com/llvm/llvm-project/pull/206070
More information about the llvm-commits
mailing list