[llvm] [NVPTX] Handle unreachable default in llvm::SwitchIns. (PR #72641)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 12:07:52 PST 2024


Artem-B wrote:

If you could also point at the source code that resulted in generating the switch that may help, too. 

AFAICT, the unreachable->exit change did not cause any obvious performance regressions on our benchmarks, so the regression may be specific to your tests. 
The fact that compiler decided to keep the unreachable/exit around may indicate that it could not rule out other values. 
It may be possible to give compiler an explicit hint which would allow elimination of the unreachable branch. 

I'm really reluctant risking resurrection of a nasty miscompilation bug for the sake of a minor performance gain on a niche benchmark. The bar here is relatively high. It would either have to be a widespread regression with no workaround, or the patch would need to have a strong guarantee that it it can never break structured control flow (and I'm not quite sure how to do that. We'll need someone with more expertise than myself. @arsenm, @maleadt  any suggestions? ).


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


More information about the llvm-commits mailing list