https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79201
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #6) > here is a testcase where DOM does not mess with the loop but we should still > be able to sink the function out and do when adding -fno-tree-pre: > > int f(int n, int t) { > int i,j=0; > if (t >=31 || t < 0) return 100; > > for (i = 0; i < t; i++) { > j = __builtin_ffs(i); > } > return j; > } Note in GCC 12+, you need -fno-tree-vectorize to get the bad behavior back.