[llvm] [InlineCost] Consider the default branch when calculating cost (PR #77856)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 10:55:20 PDT 2024


topperc wrote:

Someone just reported to me internally that this caused a benchmark regression in our downstream.

I wonder if the default case was originally missing because it should just be a fallthrough after all the other cases are picked off. It shouldn't have any code. Given N destinations for a switch you only need N-1 compares and branches. Maybe an unreachable default should reduce the number of case clusters since one case cluster check wouldn't be needed? Though I'm not sure exactly what the backend generates.

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


More information about the llvm-commits mailing list