public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/97445] New: Some fonctions marked static inline in Linux kernel are not inlined
@ 2020-10-15 13:41 christophe.leroy at csgroup dot eu
  2020-10-15 13:46 ` [Bug c/97445] " jakub at gcc dot gnu.org
                   ` (55 more replies)
  0 siblings, 56 replies; 62+ messages in thread
From: christophe.leroy at csgroup dot eu @ 2020-10-15 13:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97445

            Bug ID: 97445
           Summary: Some fonctions marked static inline in Linux kernel
                    are not inlined
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: christophe.leroy at csgroup dot eu
  Target Milestone: ---

Some functions declared 'static inline' in Linux kernel sources are not inlined
and are seen multiple times in the vmlinux binary.

Two exemple: get_order() and csum_partial():

static inline __attribute_const__ int get_order(unsigned long size)
{
        if (__builtin_constant_p(size)) {
                if (!size)
                        return BITS_PER_LONG - PAGE_SHIFT;

                if (size < (1UL << PAGE_SHIFT))
                        return 0;

                return ilog2((size) - 1) - PAGE_SHIFT + 1;
        }

        size--;
        size >>= PAGE_SHIFT;
#if BITS_PER_LONG == 32
        return fls(size);
#else
        return fls64(size);
#endif
}

I get 75 times the following code:

c0016790 <get_order>:
c0016790:       38 63 ff ff     addi    r3,r3,-1
c0016794:       54 63 a3 3e     rlwinm  r3,r3,20,12,31
c0016798:       7c 63 00 34     cntlzw  r3,r3
c001679c:       20 63 00 20     subfic  r3,r3,32
c00167a0:       4e 80 00 20     blr



static inline __wsum csum_partial(const void *buff, int len, __wsum sum)
{
        if (__builtin_constant_p(len) && len <= 16 && (len & 1) == 0) {
                if (len == 2)
                        sum = csum_add(sum, (__force __wsum)*(const u16
*)buff);
                if (len >= 4)
                        sum = csum_add(sum, (__force __wsum)*(const u32
*)buff);
                if (len == 6)
                        sum = csum_add(sum, (__force __wsum)
                                            *(const u16 *)(buff + 4));
                if (len >= 8)
                        sum = csum_add(sum, (__force __wsum)
                                            *(const u32 *)(buff + 4));
                if (len == 10)
                        sum = csum_add(sum, (__force __wsum)
                                            *(const u16 *)(buff + 8));
                if (len >= 12)
                        sum = csum_add(sum, (__force __wsum)
                                            *(const u32 *)(buff + 8));
                if (len == 14)
                        sum = csum_add(sum, (__force __wsum)
                                            *(const u16 *)(buff + 12));
                if (len >= 16)
                        sum = csum_add(sum, (__force __wsum)
                                            *(const u32 *)(buff + 12));
        } else if (__builtin_constant_p(len) && (len & 3) == 0) {
                sum = csum_add(sum, ip_fast_csum_nofold(buff, len >> 2));
        } else {
                sum = __csum_partial(buff, len, sum);
        }
        return sum;
}

        ppc-linux-objdump -d vmlinux | grep -e "<csum_partial>" -e
"<__csum_partial>"

With gcc9 I get:

        c0017ef8 <__csum_partial>:
        c00182fc:       4b ff fb fd     bl      c0017ef8 <__csum_partial>
        c0018478:       4b ff fa 80     b       c0017ef8 <__csum_partial>
        c03e8458:       4b c2 fa a0     b       c0017ef8 <__csum_partial>
        c03e8518:       4b c2 f9 e1     bl      c0017ef8 <__csum_partial>
        c03ef410:       4b c2 8a e9     bl      c0017ef8 <__csum_partial>
        c03f0b24:       4b c2 73 d5     bl      c0017ef8 <__csum_partial>
        c04279a4:       4b bf 05 55     bl      c0017ef8 <__csum_partial>
        c0429820:       4b be e6 d9     bl      c0017ef8 <__csum_partial>
        c0429944:       4b be e5 b5     bl      c0017ef8 <__csum_partial>
        c042b478:       4b be ca 81     bl      c0017ef8 <__csum_partial>
        c042b554:       4b be c9 a5     bl      c0017ef8 <__csum_partial>
        c045f15c:       4b bb 8d 9d     bl      c0017ef8 <__csum_partial>
        c0492190:       4b b8 5d 69     bl      c0017ef8 <__csum_partial>
        c0492310:       4b b8 5b e9     bl      c0017ef8 <__csum_partial>
        c0495594:       4b b8 29 65     bl      c0017ef8 <__csum_partial>
        c049c420:       4b b7 ba d9     bl      c0017ef8 <__csum_partial>
        c049c870:       4b b7 b6 89     bl      c0017ef8 <__csum_partial>
        c049c930:       4b b7 b5 c9     bl      c0017ef8 <__csum_partial>
        c04a9ca0:       4b b6 e2 59     bl      c0017ef8 <__csum_partial>
        c04bdde4:       4b b5 a1 15     bl      c0017ef8 <__csum_partial>
        c04be480:       4b b5 9a 79     bl      c0017ef8 <__csum_partial>
        c04be710:       4b b5 97 e9     bl      c0017ef8 <__csum_partial>
        c04c969c:       4b b4 e8 5d     bl      c0017ef8 <__csum_partial>
        c04ca2fc:       4b b4 db fd     bl      c0017ef8 <__csum_partial>
        c04cf5bc:       4b b4 89 3d     bl      c0017ef8 <__csum_partial>
        c04d0440:       4b b4 7a b9     bl      c0017ef8 <__csum_partial>

With gcc10 I get:

        c0018d08 <__csum_partial>:
        c0019020 <csum_partial>:
        c0019020:       4b ff fc e8     b       c0018d08 <__csum_partial>
        c001914c:       4b ff fe d4     b       c0019020 <csum_partial>
        c0019250:       4b ff fd d1     bl      c0019020 <csum_partial>
        c03e404c <csum_partial>:
        c03e404c:       4b c3 4c bc     b       c0018d08 <__csum_partial>
        c03e4050:       4b ff ff fc     b       c03e404c <csum_partial>
        c03e40fc:       4b ff ff 51     bl      c03e404c <csum_partial>
        c03e6680:       4b ff d9 cd     bl      c03e404c <csum_partial>
        c03e68c4:       4b ff d7 89     bl      c03e404c <csum_partial>
        c03e7934:       4b ff c7 19     bl      c03e404c <csum_partial>
        c03e7bf8:       4b ff c4 55     bl      c03e404c <csum_partial>
        c03eb148:       4b ff 8f 05     bl      c03e404c <csum_partial>
        c03ecf68:       4b c2 bd a1     bl      c0018d08 <__csum_partial>
        c04275b8 <csum_partial>:
        c04275b8:       4b bf 17 50     b       c0018d08 <__csum_partial>
        c0427884:       4b ff fd 35     bl      c04275b8 <csum_partial>
        c0427b18:       4b ff fa a1     bl      c04275b8 <csum_partial>
        c0427bd8:       4b ff f9 e1     bl      c04275b8 <csum_partial>
        c0427cd4:       4b ff f8 e5     bl      c04275b8 <csum_partial>
        c0427e34:       4b ff f7 85     bl      c04275b8 <csum_partial>
        c045a1c0:       4b bb eb 49     bl      c0018d08 <__csum_partial>
        c0489464 <csum_partial>:
        c0489464:       4b b8 f8 a4     b       c0018d08 <__csum_partial>
        c04896b0:       4b ff fd b5     bl      c0489464 <csum_partial>
        c048982c:       4b ff fc 39     bl      c0489464 <csum_partial>
        c0490158:       4b b8 8b b1     bl      c0018d08 <__csum_partial>
        c0492f0c <csum_partial>:
        c0492f0c:       4b b8 5d fc     b       c0018d08 <__csum_partial>
        c049326c:       4b ff fc a1     bl      c0492f0c <csum_partial>
        c049333c:       4b ff fb d1     bl      c0492f0c <csum_partial>
        c0493b18:       4b ff f3 f5     bl      c0492f0c <csum_partial>
        c0493f50:       4b ff ef bd     bl      c0492f0c <csum_partial>
        c0493ffc:       4b ff ef 11     bl      c0492f0c <csum_partial>
        c04a0f78:       4b b7 7d 91     bl      c0018d08 <__csum_partial>
        c04b3e3c:       4b b6 4e cd     bl      c0018d08 <__csum_partial>
        c04b40d0 <csum_partial>:
        c04b40d0:       4b b6 4c 38     b       c0018d08 <__csum_partial>
        c04b4448:       4b ff fc 89     bl      c04b40d0 <csum_partial>
        c04b46f4:       4b ff f9 dd     bl      c04b40d0 <csum_partial>
        c04bf448:       4b b5 98 c0     b       c0018d08 <__csum_partial>
        c04c5264:       4b b5 3a a5     bl      c0018d08 <__csum_partial>
        c04c61e4:       4b b5 2b 25     bl      c0018d08 <__csum_partial>

gcc10 defines multiple versions of csum_partial() which are just
an unconditionnal branch to __csum_partial().

^ permalink raw reply	[flat|nested] 62+ messages in thread

end of thread, other threads:[~2020-10-21 23:42 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 13:41 [Bug c/97445] New: Some fonctions marked static inline in Linux kernel are not inlined christophe.leroy at csgroup dot eu
2020-10-15 13:46 ` [Bug c/97445] " jakub at gcc dot gnu.org
2020-10-15 14:27 ` rguenth at gcc dot gnu.org
2020-10-15 14:49 ` segher at gcc dot gnu.org
2020-10-15 14:52 ` jakub at gcc dot gnu.org
2020-10-15 15:08 ` christophe.leroy at csgroup dot eu
2020-10-15 15:13 ` christophe.leroy at csgroup dot eu
2020-10-17 16:23 ` christophe.leroy at csgroup dot eu
2020-10-17 16:31 ` christophe.leroy at csgroup dot eu
2020-10-19 12:33 ` jakub at gcc dot gnu.org
2020-10-19 12:39 ` christophe.leroy at csgroup dot eu
2020-10-19 12:57 ` christophe.leroy at csgroup dot eu
2020-10-19 12:59 ` christophe.leroy at csgroup dot eu
2020-10-19 13:01 ` christophe.leroy at csgroup dot eu
2020-10-19 15:05 ` marxin at gcc dot gnu.org
2020-10-19 15:06 ` marxin at gcc dot gnu.org
2020-10-19 15:11 ` marxin at gcc dot gnu.org
2020-10-19 15:18 ` hubicka at ucw dot cz
2020-10-19 15:33 ` marxin at gcc dot gnu.org
2020-10-19 16:13 ` hubicka at gcc dot gnu.org
2020-10-19 16:20 ` hubicka at ucw dot cz
2020-10-19 16:52 ` jakub at gcc dot gnu.org
2020-10-19 17:13 ` hubicka at ucw dot cz
2020-10-20  5:19 ` christophe.leroy at csgroup dot eu
2020-10-20  6:44   ` Jan Hubicka
2020-10-20  5:21 ` christophe.leroy at csgroup dot eu
2020-10-20  5:21 ` christophe.leroy at csgroup dot eu
2020-10-20  6:17 ` christophe.leroy at csgroup dot eu
2020-10-20  6:44 ` hubicka at ucw dot cz
2020-10-20  7:09 ` christophe.leroy at csgroup dot eu
2020-10-20  7:10 ` christophe.leroy at csgroup dot eu
2020-10-20  7:10 ` christophe.leroy at csgroup dot eu
2020-10-20  9:55 ` segher at gcc dot gnu.org
2020-10-20 10:16   ` Jan Hubicka
2020-10-20 10:16 ` hubicka at ucw dot cz
2020-10-20 10:40 ` jakub at gcc dot gnu.org
2020-10-20 11:12   ` Jan Hubicka
2020-10-20 11:12 ` hubicka at ucw dot cz
2020-10-20 11:17   ` Jan Hubicka
2020-10-20 13:12     ` Jan Hubicka
2020-10-20 11:17 ` hubicka at ucw dot cz
2020-10-20 11:45 ` hubicka at ucw dot cz
2020-10-20 13:12 ` hubicka at ucw dot cz
2020-10-20 13:28 ` christophe.leroy at csgroup dot eu
2020-10-20 13:31 ` jakub at gcc dot gnu.org
2020-10-20 13:51 ` christophe.leroy at csgroup dot eu
2020-10-20 14:18 ` jakub at gcc dot gnu.org
2020-10-20 14:22 ` christophe.leroy at csgroup dot eu
2020-10-20 14:24 ` christophe.leroy at csgroup dot eu
2020-10-20 14:29 ` jakub at gcc dot gnu.org
2020-10-20 16:58 ` jakub at gcc dot gnu.org
2020-10-20 21:19 ` segher at gcc dot gnu.org
2020-10-21  5:38 ` christophe.leroy at csgroup dot eu
2020-10-21 15:04 ` [Bug ipa/97445] " hubicka at gcc dot gnu.org
2020-10-21 15:16 ` hubicka at gcc dot gnu.org
2020-10-21 18:01 ` cvs-commit at gcc dot gnu.org
2020-10-21 18:21 ` marxin at gcc dot gnu.org
2020-10-21 18:24 ` hubicka at ucw dot cz
2020-10-21 18:25 ` marxin at gcc dot gnu.org
2020-10-21 18:34 ` hubicka at ucw dot cz
2020-10-21 18:38 ` marxin at gcc dot gnu.org
2020-10-21 23:42 ` cvs-commit 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).