[llvm] [IR] Don't store switch case values as operands (PR #170984)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 23:36:53 PST 2025
nikic wrote:
> > only changing the order to make the blocks and cases contiguous rather than interleaved.
>
> The big problem is that it would make addCase/removeCase much more expensive, which would need to move all existing case values by one slot to make space for a new block (or vice versa if case values come first). O(n^2) for adding n cases is not feasible. Having null/empty operand slots is also a bad idea (no precedent and probably much more breakage). A new addCases could be added, but it would require lots of effort to port all users... especially given that addCase is right now the "only" way to add cases.
Oh right, that makes sense. I'd add that to the PR description to make the motivation clearer.
https://github.com/llvm/llvm-project/pull/170984
More information about the llvm-commits
mailing list