[Bug c/110249] __builtin_unreachable helps optimisation at -O1 but not at -O2

2023-06-14 Thread david at westcontrol dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110249 --- Comment #4 from David Brown --- Yes, __builtin_assume_aligned is the best way to write things in this particular case (and optimises fine for -O1 and -O2). It is also clearer in the source code (IMHO), as it shows the programmer's

[Bug c/110249] __builtin_unreachable helps optimisation at -O1 but not at -O2

2023-06-14 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110249 --- Comment #3 from Richard Biener --- We could pattern-match this to p = __builtin_assume_aligned (p, 8); which is btw the better way to write this.

[Bug c/110249] __builtin_unreachable helps optimisation at -O1 but not at -O2

2023-06-14 Thread david at westcontrol dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110249 --- Comment #2 from David Brown --- My apologies - it does not optimise the code to a single aligned load at -O1 (at least, not with the combinations I have now tried). The code was originally C++, with a reference, which /does/ exhibit this

[Bug c/110249] __builtin_unreachable helps optimisation at -O1 but not at -O2

2023-06-14 Thread amonakov at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110249 Alexander Monakov changed: What|Removed |Added CC||amonakov at gcc dot gnu.org ---