[Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79201 --- Comment #8 from Andrew Pinski --- (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.
[Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79201 --- Comment #7 from Raphael C --- As of gcc 8 this returns: f(int): mov eax, 1 ret I think this can be closed as resolved now.
[Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79201 Andrew Pinski changed: What|Removed |Added Status|RESOLVED|NEW Severity|normal |enhancement Resolution|FIXED |--- --- Comment #6 from Andrew Pinski --- So this is actually still broken in the sense if we turn off dominator optimizations (-fno-tree-dominator-opts), the problem with PRE and sink interaction comes into play still. The improvement came in via r8-2694 which in fact added -fno-tree-dominator-opts to gcc.dg/tree-ssa/ssa-sink-16.c . Note DOM actually does the sinking rather than the rotating of the loop. 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; }
[Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79201 --- Comment #5 from Raphael C --- I can confirm you now get f: mov eax, 1 ret with gcc 8 onwards.
[Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79201 Jeffrey A. Law changed: What|Removed |Added Status|ASSIGNED|RESOLVED CC||law at redhat dot com Resolution|--- |FIXED --- Comment #4 from Jeffrey A. Law --- I was trolling through BZs related to an issue I'd recently looked at. I stumbled over this along the way. AFAICT this is fixed on the trunk. In the .optimized dump we get the desired: ;; Function f (f, funcdef_no=0, decl_uid=1908, cgraph_uid=1, symbol_order=0) f (int n) { [local count: 32534378]: return 1; }
[Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79201 --- Comment #3 from Richard Biener --- Ok, so sinking now handles calls but the testcase still isn't fixed because PRE interferes (testsuite disables PRE). Still mine.
[Bug tree-optimization/79201] missed optimization: sinking doesn't handle calls, swap PRE and sinking
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79201 --- Comment #2 from Richard Biener --- Author: rguenth Date: Tue Apr 25 09:26:37 2017 New Revision: 247159 URL: https://gcc.gnu.org/viewcvs?rev=247159=gcc=rev Log: 2017-04-25 Richard BienerPR tree-optimization/79201 * tree-ssa-sink.c (statement_sink_location): Handle calls. * gcc.dg/tree-ssa/ssa-sink-16.c: New testcase. * gcc.target/i386/pr22152.c: Disable sinking. Added: trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-sink-16.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.target/i386/pr22152.c trunk/gcc/tree-ssa-sink.c