[Here go the bits by Richi, tested on x86-64 Linux, and ongoing tests on aarch64 and ppc64le.] There is a lot of fall-out from this patch, as there were many threading tests that assumed the restrictions introduced by this patch were valid. Some tests have merely shifted the threading to after loop optimizations, but others ended up with no threading opportunities at all. Surprisingly some tests ended up with more total threads. It was a crapshoot all around. On a postive note, there are 6 tests that no longer XFAIL, and one guality test which now passes. I would appreciate someone reviewing the test changes. I am unsure whether some of the tests should be removed, XFAILed, or some other thing. I felt a bit queasy about such a fundamental change wrt threading, so I ran it through my callgrind test harness (.ii files from a bootstrap). There was no change in overall compilation, DOM, or the VRP threaders. However, there was a slight increase of 1.63% in the backward threader. I'm pretty sure we could reduce this if we incorporated the restrictions into their profitability code. This way we could stop the search when we ran into one of these restrictions. Not sure it's worth it at this point. Note, that this ad-hoc testing is not meant to replace a more thorough SPEC, etc test. Tested on x86-64 Linux. OK pending tests on aarch64 and ppc64le? Co-authored-by: Richard Biener