public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8472] bpf: add constant pointer to helper-skb-ancestor-cgroup-id.c test
@ 2024-01-27 19:10 Jose E. Marchesi
  0 siblings, 0 replies; only message in thread
From: Jose E. Marchesi @ 2024-01-27 19:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f64448f4ff1c671778a1d7d7678a281c6bc6450e

commit r14-8472-gf64448f4ff1c671778a1d7d7678a281c6bc6450e
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date:   Sat Jan 27 20:08:12 2024 +0100

    bpf: add constant pointer to helper-skb-ancestor-cgroup-id.c test
    
    The purpose of this test is to make sure that constant propagation is
    achieved with the proper optimization level, so a BPF call instruction
    to a kernel helper is generated.  This patch updates the patch so it
    also covers kernel helpers defined with constant static pointers.
    
    The motivation for this patch is:
    
      https://lore.kernel.org/bpf/20240127185031.29854-1-jose.marchesi@oracle.com/T/#u
    
    Tested in bpf-unknown-none target x86_64-linux-gnu host.
    
    gcc/testsuite/ChangeLog
    
            * gcc.target/bpf/helper-skb-ancestor-cgroup-id.c: Add constant
            version of kernel helper static pointer.

Diff:
---
 gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c b/gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c
index 693f390b9bba..075dbe6f852d 100644
--- a/gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c
+++ b/gcc/testsuite/gcc.target/bpf/helper-skb-ancestor-cgroup-id.c
@@ -5,6 +5,7 @@
 
 struct __sk_buff;
 static uint64_t (*bpf_skb_ancestor_cgroup_id)(struct __sk_buff *skb, int ancestor_level) = (void *) 83;
+static uint64_t (* const const_bpf_skb_ancestor_cgroup_id)(struct __sk_buff *skb, int ancestor_level) = (void *) 84;
 
 void
 foo ()
@@ -13,7 +14,9 @@ foo ()
   void *skb;
   int ancestor_level;
 
-  ret = bpf_skb_ancestor_cgroup_id (skb, ancestor_level);
+  ret = bpf_skb_ancestor_cgroup_id (skb, ancestor_level)
+    + const_bpf_skb_ancestor_cgroup_id (skb, ancestor_level);
 }
 
 /* { dg-final { scan-assembler "call\t83" } } */
+/* { dg-final { scan-assembler "call\t84" } } */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-27 19:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-27 19:10 [gcc r14-8472] bpf: add constant pointer to helper-skb-ancestor-cgroup-id.c test Jose E. Marchesi

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).