public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/85747] suboptimal code without constexpr
[not found] <bug-85747-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-27 4:09 ` pinskia at gcc dot gnu.org
2021-12-27 4:11 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-27 4:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85747
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-12-27
Severity|normal |enhancement
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
size: 13-3, last_iteration: 13-3
Loop size: 13
Estimated size after unrolling: 40
Not unrolling loop 1: it is not innermost and code would grow.
There are a few others like this one.
Note LLVM is able even to handle:
template <class It>
constexpr void sort(It first, It last) {
for (;first != last; ++first) {
auto it = first;
++it;
for (; it != last; ++it) {
if (*it < *first) {
auto tmp = *it;
*it = *first;
*first = tmp;
}
}
}
}
static int generate() {
int a[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21};
a[5] = 55;
sort(a + 0, a + 21);
return a[0] + a[6] + a[1] + a[2] + a[3] + a[4];
}
I suspect the cost estimate it does for the loop is the removal of the load of
a[i] knowing that a is fully written to.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/85747] suboptimal code without constexpr
[not found] <bug-85747-4@http.gcc.gnu.org/bugzilla/>
2021-12-27 4:09 ` [Bug c++/85747] suboptimal code without constexpr pinskia at gcc dot gnu.org
@ 2021-12-27 4:11 ` pinskia at gcc dot gnu.org
2021-12-27 4:11 ` pinskia at gcc dot gnu.org
2021-12-27 4:11 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-27 4:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85747
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bmburstein at gmail dot com
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 97077 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/85747] suboptimal code without constexpr
[not found] <bug-85747-4@http.gcc.gnu.org/bugzilla/>
2021-12-27 4:09 ` [Bug c++/85747] suboptimal code without constexpr pinskia at gcc dot gnu.org
2021-12-27 4:11 ` pinskia at gcc dot gnu.org
@ 2021-12-27 4:11 ` pinskia at gcc dot gnu.org
2021-12-27 4:11 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-27 4:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85747
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |eyalroz1 at gmx dot com
--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 87543 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/85747] suboptimal code without constexpr
[not found] <bug-85747-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2021-12-27 4:11 ` pinskia at gcc dot gnu.org
@ 2021-12-27 4:11 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-27 4:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85747
--- Comment #12 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 89922 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-27 4:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-85747-4@http.gcc.gnu.org/bugzilla/>
2021-12-27 4:09 ` [Bug c++/85747] suboptimal code without constexpr pinskia at gcc dot gnu.org
2021-12-27 4:11 ` pinskia at gcc dot gnu.org
2021-12-27 4:11 ` pinskia at gcc dot gnu.org
2021-12-27 4:11 ` pinskia at gcc dot gnu.org
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).