https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88271
--- Comment #10 from Daniel Fruzynski <bugzi...@poradnik-webmastera.com> --- Here is possible code transformation to equivalent form, where this optimization can be simply applied. This change also has a bit surprising side effect, second nested while loop is unrolled. [code] void test2() { int level = 0; int val = 1; while (1) { while(1) { val = data[level] << 1; ++level; if (val) continue; else break; } while(1) { --level; val = data[level]; if (!val) continue; else break; } } } [/code]