public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug tree-optimization/50385] New: missed-optimization: jump to __builtin_unreachable() not removed @ 2011-09-13 15:21 wouter.vermaelen at scarlet dot be 2011-11-11 1:39 ` [Bug middle-end/50385] " pinskia at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: wouter.vermaelen at scarlet dot be @ 2011-09-13 15:21 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50385 Bug #: 50385 Summary: missed-optimization: jump to __builtin_unreachable() not removed Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: wouter.vermaelen@scarlet.be I'm not sure, but this issue might be the same as bug 49054 (if so, feel free to delete this one). #include <vector> struct S { int a, b; }; std::vector<S> v; int search_1(int a) { for (auto it = v.begin(); /**/; ++it) if (it->a == a) return it->b; } int search_2(int a) { for (auto& e : v) if (e.a == a) return e.b; __builtin_unreachable(); } I expected to see the same generated code for both functions. Instead the 2nd one still contains some useless comparisons and jumps past the end of the function. Since such a (conditional) jump is anyway undefined behavior it can as well be removed (including the instructions required to calculate the condition). Tested with SVN revision 178775 (20110912) on Linux x86_64. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/50385] missed-optimization: jump to __builtin_unreachable() not removed 2011-09-13 15:21 [Bug tree-optimization/50385] New: missed-optimization: jump to __builtin_unreachable() not removed wouter.vermaelen at scarlet dot be @ 2011-11-11 1:39 ` pinskia at gcc dot gnu.org 2013-09-08 8:10 ` glisse at gcc dot gnu.org 2015-02-24 20:54 ` law at redhat dot com 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2011-11-11 1:39 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50385 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2011-11-11 Component|tree-optimization |middle-end Ever Confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-11-11 00:39:55 UTC --- Confirmed with a much simpler testcase: int f (int i) { if (i <= 1) return 1; __builtin_unreachable(); } --- CUT --- I found this while adding a basic block reordering pass to the tree level and I got a failure with builtin-unreachable-2.c . ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/50385] missed-optimization: jump to __builtin_unreachable() not removed 2011-09-13 15:21 [Bug tree-optimization/50385] New: missed-optimization: jump to __builtin_unreachable() not removed wouter.vermaelen at scarlet dot be 2011-11-11 1:39 ` [Bug middle-end/50385] " pinskia at gcc dot gnu.org @ 2013-09-08 8:10 ` glisse at gcc dot gnu.org 2015-02-24 20:54 ` law at redhat dot com 2 siblings, 0 replies; 4+ messages in thread From: glisse at gcc dot gnu.org @ 2013-09-08 8:10 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50385 --- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> --- This seems to work on current trunk. Can you confirm, and if so close the PR? (well, we may want to add the testcases) ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug middle-end/50385] missed-optimization: jump to __builtin_unreachable() not removed 2011-09-13 15:21 [Bug tree-optimization/50385] New: missed-optimization: jump to __builtin_unreachable() not removed wouter.vermaelen at scarlet dot be 2011-11-11 1:39 ` [Bug middle-end/50385] " pinskia at gcc dot gnu.org 2013-09-08 8:10 ` glisse at gcc dot gnu.org @ 2015-02-24 20:54 ` law at redhat dot com 2 siblings, 0 replies; 4+ messages in thread From: law at redhat dot com @ 2015-02-24 20:54 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50385 Jeffrey A. Law <law at redhat dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |law at redhat dot com Resolution|--- |FIXED --- Comment #3 from Jeffrey A. Law <law at redhat dot com> --- Trunk produces the desired code. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-24 19:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-09-13 15:21 [Bug tree-optimization/50385] New: missed-optimization: jump to __builtin_unreachable() not removed wouter.vermaelen at scarlet dot be 2011-11-11 1:39 ` [Bug middle-end/50385] " pinskia at gcc dot gnu.org 2013-09-08 8:10 ` glisse at gcc dot gnu.org 2015-02-24 20:54 ` law at redhat dot com
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).