https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83356
--- Comment #12 from Arnd Bergmann <arnd at linaro dot org> --- Unfortunately that patch caused a regression (nothing to do with the compiler really, just the way powerpc linux uses some libgcc functions), and I've done some more investigation. The new finding is that selectively turning off '-fcode-hoisting' on gcc-7.2.1 restores the behavior we had on gcc-7.2.1, solving both the stack consumption problem with UBSAN and the performance regression (with and without UBSAN) as described in pr83651, with performance better than my previous workarounds that replaced -O2 with -Os, -O1, or -O2 -fno-tree-sra -fno-tree-pre. I have to do more performance tests to send an updated kernel patch, but maybe this already helps analyze the problem further.