[llvm] [CodeGen][AArch64] Set min jump table entries to 13 for AArch64 targets (PR #71166)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 07:02:39 PST 2023


nikic wrote:

> > How does this affect performance in cases where the last switch case is usually taken?
> 
> If I understand what you are saying, it should generate a tree of branches so the positions of the cases shouldn't matter a huge amount. It can depend on the differences between the cases and the branch targets though, they might not match.
> 
> Let us know if you have reason to think this would be worse in some way, it's not a very easy thing to measure accurately. A load from a constant pool into an indirect jump can be worse than a series of branches that can each be independently branch predicted.

I was mainly just wondering about what the worst case impact here would be for an unlucky switch. If I understand correctly, previously the switch (without jump table) would need at most two branches and now it needs at most four. Does that sound correct? (I was thinking in terms of a linear chain previously -- with a binary tree this doesn't sound so bad.)

https://github.com/llvm/llvm-project/pull/71166


More information about the llvm-commits mailing list