On Sat, Nov 21, 2020 at 01:09:50PM -0800, Linus Torvalds wrote: > On Sat, Nov 21, 2020 at 12:54 PM Luc Van Oostenryck > <luc.vanoostenryck@xxxxxxxxx> wrote: > > > > This series contains some simplification of computed gotos with > > 1 or 2 possible target as well as a new instruction which now > > really allows the CSE of 'labels-as-values'. > > Looks sane, but where did you actually find cases of this in real life? > > I think we have one computed goto in the kernel, that does an array > label load. They are very rare, and when they are used, that tends to > be the normal pattern. > Bah, they're not really from real life. When IR and optimizations are concerned, I'm using code from some testsuites (GCC, LLVM, some benchmarks, code I've generated myself) to check for anything abnormal and sometimes when inspecting the results I fall on some testcases that doesn't make sense. Sometimes it's because of some errors from my part but it also happens it's one of these silly/exotic transformations. So, yes, I'm fully aware that these patches (and some other 'optimizations' I'm sometimes adding) have practically no values but they just make things easier for me when comparing results. > Just about the only place I've ever seen them are in that kind of > interpreter loops for instruction dispatch tables. Yes. They were also fundamental to a prolog-to-C compiler I wrote many years ago. This maybe explains some fondness I've for them. -- Luc