[Bug c/99693] -O2 not move 'if' checks on const data outside the loops

2021-03-22 Thread rafal at bursig dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99693 --- Comment #5 from rafal at bursig dot org --- Additional when I use c++ variant of this code and throw exception in else then in -O2 level the 'if' is removed outside loop: typedef struct Update { int m_update; //... } Update; extern

[Bug c/99693] -O2 not move 'if' checks on const data outside the loops

2021-03-22 Thread rafal at bursig dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99693 --- Comment #4 from rafal at bursig dot org --- but using -O2 -funswitch-loops will bring me those problems why this flag is not in default -O2. Which is not a solution. Maybe -O2 may have weaken version of this optimization and will work only i

[Bug c/99693] -O2 not move 'if' checks on const data outside the loops

2021-03-21 Thread rafal at bursig dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99693 --- Comment #1 from rafal at bursig dot org --- I'm not saying that this is a regression because I see proper results on -O3 level but IMHO such results should be available in -O2 level... but to topic: I have such code: typedef struct Update {

[Bug c/99693] New: -O2 not move 'if' checks on const data outside the loops

2021-03-21 Thread rafal at bursig dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99693 Bug ID: 99693 Summary: -O2 not move 'if' checks on const data outside the loops Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Prio