[Bug target/95798] [10/11 Regression] Initialization code --- suboptimal
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jun 22 13:05:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95798
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Partially related, using the following -O2 -fno-ipa-icf:
void
foo (int x, int *p)
{
p[x + 1] = 1;
}
void
bar (int x, int *p)
{
p[x + 1UL] = 1;
}
void
baz (int x, int *p)
{
unsigned long l = x;
l++;
p[l] = 1;
}
void
qux (int x, int *p)
{
unsigned long l = x + 1;
p[l] = 1;
}
we get the same 3 insn functions for the first 3 cases and 4 insn for the last
one. I'm surprised that we treat foo and qux differently, as x + 1 has
undefined overflow, so (unsigned long) (x + 1) can be implemented with x + 1UL
and when used in address arithmetics it should be beneficial like that (so
shall e.g. expansion optimize it, or ivopts, or isel)?
More information about the Gcc-bugs
mailing list