Bug 116537 - integer_three_node looks like it can be removed
Summary: integer_three_node looks like it can be removed
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 15.0
: P3 enhancement
Target Milestone: 15.0
Assignee: Andrew Pinski
URL:
Keywords: internal-improvement
Depends on:
Blocks:
 
Reported: 2024-08-29 17:13 UTC by Andrew Pinski
Modified: 2024-08-30 14:09 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2024-08-29 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2024-08-29 17:13:03 UTC
ChangeLog-2010: (integer_three_node): Add.
ChangeLog-2010: NULL_TREE in build_int_cst calls. Initialize the integer_three_node.
builtins.cc:    arg2 = integer_three_node;
cp/ChangeLog-2010:      * decl.c (integer_three_node): Remove.
cp/ChangeLog-2010:      (cxx_init_decl_processing): Do not initialize the integer_three_node.
cp/ChangeLog-2010:      * cp-tree.h (integer_three_node): Remove.
tree-ssa-loop-prefetch.cc:  local = nontemporal ? integer_zero_node : integer_three_node;
tree.cc:  integer_three_node = build_int_cst (integer_type_node, 3);
tree.h:#define integer_three_node              global_trees[TI_INTEGER_THREE]


Those are the only references to integer_three_node in the whole GCC tree.

The use in builtins.cc is definitely not needed as it just calls expand_normal right afterwards.

The use in tree-ssa-loop-prefetch.cc can just be replaced with `build_int_cst (integer_type_node, 3);` as this is definitely not a hot loop and move over the pass is not enabled for most of the time anyways.
Comment 1 Andrew Pinski 2024-08-29 17:13:11 UTC
.
Comment 3 GCC Commits 2024-08-30 14:09:32 UTC
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:

https://gcc.gnu.org/g:4d2cbe2bbedbdbc609683f7fb491b3e02add15b3

commit r15-3320-g4d2cbe2bbedbdbc609683f7fb491b3e02add15b3
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date:   Thu Aug 29 11:01:56 2024 -0700

    middle-end: Remove integer_three_node [PR116537]
    
    After the small expansion patch for __builtin_prefetch, the
    only use of integer_three_node is inside tree-ssa-loop-prefetch.cc so let's
    remove it as the loop prefetch pass is not enabled these days by default and
    having a tree node around just for that pass is a little wasteful. Integer
    constants are also shared these days so calling build_int_cst will use the cached
    node anyways.
    
    Bootstrapped and tested on x86_64-linux.
    
            PR middle-end/116537
    
    gcc/ChangeLog:
    
            * tree-core.h (enum tree_index): Remove TI_INTEGER_THREE
            * tree-ssa-loop-prefetch.cc (issue_prefetch_ref): Call build_int_cst
            instead of using integer_three_node.
            * tree.cc (build_common_tree_nodes): Remove initialization
            of integer_three_node.
            * tree.h (integer_three_node): Delete.
    
    Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Comment 4 Andrew Pinski 2024-08-30 14:09:56 UTC
Fixed.