From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7824) id 380113858C78; Mon, 7 Nov 2022 22:42:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 380113858C78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667860921; bh=sLHz63YPPImne9gOEbVGPA5NZwDve3j55FnQwXXICy0=; h=From:To:Subject:Date:From; b=oxH4LthkQJYL9AzptOGWdsxVur7Wo3rfEs9jyXkuZTfHD6/kq86QMyeuTOCSWX6y+ GURGZMtjIWo5iurp8BmorEP3fS9xEX2LBX9DTjt6L7bG1OJf5lFRhDfrAsasQlc5Z0 cIiszrXPxtssEMw7U6BWTwn+TNJYs+rNGM5N/jnw= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: David Faust To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3762] bpf: cleanup missed refactor X-Act-Checkin: gcc X-Git-Author: David Faust X-Git-Refname: refs/heads/master X-Git-Oldrev: a239a63f868e29e9276088e7c0fb00804c2903ba X-Git-Newrev: 93ab7d03dfbdd096c1d3c83e92d794bf4eed18df Message-Id: <20221107224201.380113858C78@sourceware.org> Date: Mon, 7 Nov 2022 22:42:01 +0000 (GMT) List-Id: https://gcc.gnu.org/g:93ab7d03dfbdd096c1d3c83e92d794bf4eed18df commit r13-3762-g93ab7d03dfbdd096c1d3c83e92d794bf4eed18df Author: David Faust Date: Mon Nov 7 10:30:52 2022 -0800 bpf: cleanup missed refactor Commit 068baae1864 "bpf: add preserve_field_info builtin" factored out some repeated code to a new function maybe_make_core_relo (), but missed using it in one place. Clean that up. gcc/ * config/bpf/bpf.cc (handle_attr_preserve): Use maybe_make_core_relo(). Diff: --- gcc/config/bpf/bpf.cc | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc index ea8ca64d1d6..fd4003c2bfc 100644 --- a/gcc/config/bpf/bpf.cc +++ b/gcc/config/bpf/bpf.cc @@ -1731,7 +1731,6 @@ handle_attr_preserve (function *fn) { basic_block bb; rtx_insn *insn; - rtx_code_label *label; FOR_EACH_BB_FN (bb, fn) { FOR_BB_INSNS (bb, insn) @@ -1762,28 +1761,7 @@ handle_attr_preserve (function *fn) } if (is_attr_preserve_access (expr)) - { - auto_vec accessors; - tree container = bpf_core_compute (expr, &accessors); - if (accessors.length () < 1) - continue; - accessors.reverse (); - - container = TREE_TYPE (container); - const char * section_name; - if (DECL_SECTION_NAME (fn->decl)) - section_name = DECL_SECTION_NAME (fn->decl); - else - section_name = ".text"; - - label = gen_label_rtx (); - LABEL_PRESERVE_P (label) = 1; - emit_label (label); - - /* Add the CO-RE relocation information to the BTF container. */ - bpf_core_reloc_add (container, section_name, &accessors, label, - BPF_RELO_FIELD_BYTE_OFFSET); - } + maybe_make_core_relo (expr, BPF_RELO_FIELD_BYTE_OFFSET); } } rtx_insn *seq = get_insns ();