https://gcc.gnu.org/g:fff417c3428ecd3c953cd796bda128fc13758dc5
commit r17-6119-gfff417c3428ecd3c953cd796bda128fc13758dc5 Author: Andrew MacLeod <[email protected]> Date: Fri Nov 6 13:37:34 2026 -0500 Remove alignment fields Alignment is maintained in the bitmask now, so there is no need for the two alignment fields. Also rename ptr_info_alignment functions to ssa_name_alignment, removing the last reference to ptr_info. get_ptr_info_alignment -> get_ssa_name_alignment mark_ptr_info_alignment_unknown -> mark_ssa_name_alignment_unknown set_ptr_info_alignment -> set_ssa_name_alignment * builtins.cc (get_pointer_alignment_1): Use renamed routines. * gimple-low.cc (lower_builtin_assume_aligned): Likewise. * gimple-pretty-print.cc (dump_ssaname_info): Likewise. * tree-ssa-pre.cc (create_expression_by_pieces): Likewise. * tree-ssanames.cc (range_info_set_range): Remove alignment field references. (get_ssa_name_alignment): Rename and remove alignment fields. (mark_ssa_name_alignment_unknown): Likewise. (set_ssa_name_alignment): Likewise. (duplicate_ssa_name_range_info): Remove alignment fields. * tree-ssanames.h (get_ssa_name_alignment): Renamed prototype. (mark_ssa_name_alignment): Likewise. (set_ssa_name_alignment): Likewise. * tree-vect-stmts.cc (create_array_ref): Use renamed routines. (vectorizable_store): Likewise. (vectorizable_load): Likewise. * value-range-storage.cc (prange_storage::prange_storage): Remove alignment fields. * value-range-storage.h (prange_storage::align): Remove. (prange_storage::misalign): Remove. Diff: --- gcc/builtins.cc | 2 +- gcc/gimple-low.cc | 2 +- gcc/gimple-pretty-print.cc | 2 +- gcc/tree-ssa-pre.cc | 2 +- gcc/tree-ssanames.cc | 52 +++++++++------------------------------------- gcc/tree-ssanames.h | 6 +++--- gcc/tree-vect-stmts.cc | 6 +++--- gcc/value-range-storage.cc | 2 -- gcc/value-range-storage.h | 6 ------ 9 files changed, 20 insertions(+), 60 deletions(-) diff --git a/gcc/builtins.cc b/gcc/builtins.cc index b640a8776495..128a12a898fc 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -455,7 +455,7 @@ get_pointer_alignment_1 (tree exp, unsigned int *alignp, { unsigned int ptr_align, ptr_misalign; - if (get_ptr_info_alignment (exp, &ptr_align, &ptr_misalign)) + if (get_ssa_name_alignment (exp, &ptr_align, &ptr_misalign)) { *bitposp = ptr_misalign * BITS_PER_UNIT; *alignp = ptr_align * BITS_PER_UNIT; diff --git a/gcc/gimple-low.cc b/gcc/gimple-low.cc index 7c8055076c3b..a022022e7908 100644 --- a/gcc/gimple-low.cc +++ b/gcc/gimple-low.cc @@ -1421,7 +1421,7 @@ lower_builtin_assume_aligned (gimple_stmt_iterator *gsi) /* For lowering we simply transfer alignment information to the result and leave the call otherwise unchanged, it will be elided at RTL expansion time. */ - set_ptr_info_alignment (lhs, aligni, misaligni); + set_ssa_name_alignment (lhs, aligni, misaligni); } diff --git a/gcc/gimple-pretty-print.cc b/gcc/gimple-pretty-print.cc index e9c2586f26d0..23ef1e49eb9f 100644 --- a/gcc/gimple-pretty-print.cc +++ b/gcc/gimple-pretty-print.cc @@ -2407,7 +2407,7 @@ dump_ssaname_info (pretty_printer *pp, tree node, int spc) } unsigned int align, misalign; - if (get_ptr_info_alignment (node, &align, &misalign)) + if (get_ssa_name_alignment (node, &align, &misalign)) { pp_printf (pp, "# ALIGN = %u, MISALIGN = %u", align, misalign); newline_and_indent (pp, spc); diff --git a/gcc/tree-ssa-pre.cc b/gcc/tree-ssa-pre.cc index 5d50e92a1d34..cd3f07b2cb77 100644 --- a/gcc/tree-ssa-pre.cc +++ b/gcc/tree-ssa-pre.cc @@ -3169,7 +3169,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr, if ((halign & (halign - 1)) == 0 && (hmisalign & ~(halign - 1)) == 0 && (unsigned int)halign != 0) - set_ptr_info_alignment (forcedname, halign, hmisalign); + set_ssa_name_alignment (forcedname, halign, hmisalign); } gimple_set_vuse (call, BB_LIVE_VOP_ON_EXIT (block)); gimple_seq_add_stmt_without_update (&forced_stmts, call); diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc index 77d8a9af6010..937cd53f03c6 100644 --- a/gcc/tree-ssanames.cc +++ b/gcc/tree-ssanames.cc @@ -153,26 +153,19 @@ range_info_set_range (tree name, const vrange &r) { if (!SSA_NAME_RANGE_INFO (name) || !range_info_fits_p (name, r)) { - // Preserve SSA-owned points-to and alignment information when the + // Preserve SSA-owned points-to information when the // variable-sized range storage must grow. pt_solution *pt = NULL; - unsigned int align = 0, misalign = 0; if (prange_storage *old = ssa_name_prange_info (name)) - { - pt = old->pt; - align = old->align; - misalign = old->misalign; - } + pt = old->pt; if (SSA_NAME_RANGE_INFO (name)) range_info_free (name); vrange_storage *mem = range_info_alloc (name, r); - if (mem && (pt || align)) + if (mem && pt) { prange_storage *s = mem->dyn_prange (); s->pt = pt; - s->align = align; - s->misalign = misalign; } return mem != NULL; } @@ -850,7 +843,7 @@ bitmask_to_alignment (const irange_bitmask &bm, unsigned int *alignp, false if no alignment beyond byte alignment is known. */ bool -get_ptr_info_alignment (const_tree name, unsigned int *alignp, +get_ssa_name_alignment (const_tree name, unsigned int *alignp, unsigned int *misalignp) { if (!POINTER_TYPE_P (TREE_TYPE (name)) || !SSA_NAME_RANGE_INFO (name)) @@ -860,30 +853,15 @@ get_ptr_info_alignment (const_tree name, unsigned int *alignp, if (!s) return false; - bool known = bitmask_to_alignment (s->get_bitmask (TREE_TYPE (name)), - alignp, misalignp); - - /* Legacy fields may know less, but useful alignment must be implied - by the bitmask. Alignment one carries no information. */ - gcc_checking_assert (s->align <= 1 - || (known && *alignp >= s->align - && (*misalignp & (s->align - 1)) == s->misalign)); - return known; + return bitmask_to_alignment (s->get_bitmask (TREE_TYPE (name)), + alignp, misalignp); } /* Clear NAME's known bits independently of the legacy alignment fields. */ void -mark_ptr_info_alignment_unknown (tree name) +mark_ssa_name_alignment_unknown (tree name) { - prange_storage *pi = ssa_name_prange_info (name); - - if (pi) - { - pi->align = 0; - pi->misalign = 0; - } - if (!SSA_NAME_RANGE_INFO (name)) return; @@ -902,7 +880,7 @@ mark_ptr_info_alignment_unknown (tree name) information if the requested alignment conflicts with known bits. */ void -set_ptr_info_alignment (tree name, unsigned int align, unsigned int misalign) +set_ssa_name_alignment (tree name, unsigned int align, unsigned int misalign) { gcc_checking_assert (align != 0); gcc_assert ((align & (align - 1)) == 0); @@ -925,14 +903,8 @@ set_ptr_info_alignment (tree name, unsigned int align, unsigned int misalign) return; r.update_bitmask (cur); - if (r.undefined_p () || !range_info_set_range (name, r)) - return; - - /* Transitional fields are updated only after the range accepts the - refinement. Reacquire storage since the update may reallocate it. */ - prange_storage *s = ssa_name_prange_info (name); - s->align = align; - s->misalign = misalign; + if (!r.undefined_p ()) + range_info_set_range (name, r); } @@ -1007,10 +979,6 @@ duplicate_ssa_name_range_info (tree name, tree src, bool remove_local_addr) if (remove_local_addr && is_a <prange> (src_range)) as_a <prange> (src_range).clear_function_local_addr (); range_info_set_range (name, src_range); - - unsigned align, misalign; - if (get_ptr_info_alignment (src, &align, &misalign)) - set_ptr_info_alignment (name, align, misalign); } /* For a SSA copy DEST = SRC duplicate SSA info present on DEST to SRC diff --git a/gcc/tree-ssanames.h b/gcc/tree-ssanames.h index 7f0b2f1f6574..7cba26b5a651 100644 --- a/gcc/tree-ssanames.h +++ b/gcc/tree-ssanames.h @@ -77,10 +77,10 @@ extern tree make_ssa_name_fn (struct function *, tree, gimple *, unsigned int version = 0); extern void init_ssa_name_imm_use (tree); extern void release_ssa_name_fn (struct function *, tree); -extern bool get_ptr_info_alignment (const_tree, unsigned int *, +extern bool get_ssa_name_alignment (const_tree, unsigned int *, unsigned int *); -extern void mark_ptr_info_alignment_unknown (tree); -extern void set_ptr_info_alignment (tree, unsigned int, unsigned int); +extern void mark_ssa_name_alignment_unknown (tree); +extern void set_ssa_name_alignment (tree, unsigned int, unsigned int); extern void set_ptr_nonnull (tree); extern bool ptr_nonnull_p (tree); diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 24c2969c2107..7f5c17ccc57d 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -227,7 +227,7 @@ create_array_ref (tree type, tree ptr, tree alias_ptr_type) mem_ref = build2 (MEM_REF, type, ptr, build_int_cst (alias_ptr_type, 0)); /* Arrays have the same alignment as their type. */ - set_ptr_info_alignment (ptr, TYPE_ALIGN_UNIT (type), 0); + set_ssa_name_alignment (ptr, TYPE_ALIGN_UNIT (type), 0); return mem_ref; } @@ -9497,7 +9497,7 @@ vectorizable_store (vec_info *vinfo, misalign = misalignment; if (dataref_offset == NULL_TREE && TREE_CODE (dataref_ptr) == SSA_NAME) - set_ptr_info_alignment (dataref_ptr, align, misalign); + set_ssa_name_alignment (dataref_ptr, align, misalign); align = least_bit_hwi (misalign | align); /* Compute IFN when LOOP_LENS or final_mask valid. */ @@ -11563,7 +11563,7 @@ vectorizable_load (vec_info *vinfo, misalign = misalignment; if (dataref_offset == NULL_TREE && TREE_CODE (dataref_ptr) == SSA_NAME) - set_ptr_info_alignment (dataref_ptr, align, misalign); + set_ssa_name_alignment (dataref_ptr, align, misalign); align = least_bit_hwi (misalign | align); /* Compute IFN when LOOP_LENS or final_mask valid. */ diff --git a/gcc/value-range-storage.cc b/gcc/value-range-storage.cc index ce203e67c36c..7de6654b598a 100644 --- a/gcc/value-range-storage.cc +++ b/gcc/value-range-storage.cc @@ -611,8 +611,6 @@ prange_storage::prange_storage (const prange &r) : vrange_storage (VR_PRANGE) // Only the accessors in tree-ssanames.cc ever make them non-zero, and // range_info_set_range carries them across a reallocation. pt = NULL; - align = 0; - misalign = 0; unsigned num_words; enum prange_kind kind = prange_format (r, num_words); diff --git a/gcc/value-range-storage.h b/gcc/value-range-storage.h index a33054b805c6..0823f41e3645 100644 --- a/gcc/value-range-storage.h +++ b/gcc/value-range-storage.h @@ -147,12 +147,6 @@ public: // reached only through ssa_name_pt_solution. struct pt_solution *pt; - // Alignment and misalignment of the pointer in bytes. Together - // align and misalign specify low known bits of the pointer. - // ptr & (align - 1) == misalign. - unsigned int align; - unsigned int misalign; - private: DISABLE_COPY_AND_ASSIGN (prange_storage); prange_storage (const prange &r);
