diff options
Diffstat (limited to 'gcc')
34 files changed, 833 insertions, 137 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8091f67..afd76cc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,48 @@ +2025-11-04 Uros Bizjak <ubizjak@gmail.com> + + PR target/122390 + * config/i386/i386.md (*add<mode>3_carry_2): New insn pattern. + (*add<mode>3_carry_0_cc): Ditto. + (*add<mode>3_carry_0r_cc): Ditto. + (*sub<mode>3_carry_2): Ditto. + (*sub<mode>3_carry_0_cc): Ditto. + (*sub<mode>3_carry_0r_cc): Ditt. + +2025-11-04 Kees Cook <kees@kernel.org> + + * config/arc/builtins.def: Add ATTRS parameter to DEF_BUILTIN + macro calls. Mark mathematical builtins (FFS, FLS, NORM, NORMW, + SWAP) with attr_const, leave others as NULL_TREE. + * config/arc/arc.cc: Add support for builtin function attributes. + Create attr_const using tree_cons. Update DEF_BUILTIN macro to + pass ATTRS parameter to add_builtin_function. + +2025-11-04 Pan Li <pan2.li@intel.com> + + * match.pd: Add usmul_widen_mult helper and referenced by + min based unsigned SAT_MUL pattern. + +2025-11-04 Siddhesh Poyarekar <siddhesh@gotplt.org> + + PR lto/122515 + * lto-wrapper.cc (debug_objcopy): Set type of INOFF to int64_t. + (run_gcc): Set type of FILE_OFFSET to int64_t. + +2025-11-04 Kishan Parmar <kishan@linux.ibm.com> + + PR rtl-optimization/93738 + * simplify-rtx.cc (simplify_binary_operation_1): Canonicalize + SUBREG(LSHIFTRT) into LSHIFTRT(SUBREG) when valid. + +2025-11-04 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/122544 + * diagnostics/paths.cc (event::meaning::maybe_get_verb_str): + Handle the new verbs. + * diagnostics/paths.h (event::meaning::verb): Add new values + for special control flow operations. + (event::meaning::meaning): Add ctor taking just a verb. + 2025-11-03 Uros Bizjak <ubizjak@gmail.com> PR target/122534 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 23733dc..7b0f631 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20251104 +20251105 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c99021a..1232383 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,20 @@ +2025-11-04 Eric Botcazou <ebotcazou@adacore.com> + + * sem_ch3.adb (Analyze_Subtype_Declaration) <Concurrent_Kind>: + Propagate the Uses_Lock_Free flag for protected types. + +2025-11-04 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/18453 + * sem_ch12.adb (Find_Actual_Type): Add Typ_Ref parameter and + perform a standard resolution on it in the fallback case. + Call Get_Instance_Of if the type is declared in a formal of + the child unit. + (Instantiate_Type.Validate_Access_Type_Instance): Adjust call + to Find_Actual_Type. + (Instantiate_Type.Validate_Array_Type_Instance): Likewise and + streamline the check for matching component subtypes. + 2025-11-03 Eric Botcazou <ebotcazou@adacore.com> PR ada/78175 diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 233f823..ba0af27 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -6145,6 +6145,10 @@ package body Sem_Ch3 is Set_Is_Tagged_Type (Id, Is_Tagged_Type (T)); Set_Last_Entity (Id, Last_Entity (T)); + if Is_Protected_Type (T) then + Set_Uses_Lock_Free (Id, Uses_Lock_Free (T)); + end if; + if Is_Tagged_Type (T) then Set_No_Tagged_Streams_Pragma (Id, No_Tagged_Streams_Pragma (T)); diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index bf9d5e1..301894b 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -658,6 +658,24 @@ package body Sem_Res is P : Node_Id; D : Node_Id; + procedure Check_Legality_In_Constraint (Alone : Boolean); + -- RM 3.8(12/3): Check that the discriminant mentioned in a constraint + -- appears alone as a direct name. + + ---------------------------------- + -- Check_Legality_In_Constraint -- + ---------------------------------- + + procedure Check_Legality_In_Constraint (Alone : Boolean) is + begin + if not Alone then + Error_Msg_N ("discriminant in constraint must appear alone", N); + + elsif Nkind (N) = N_Expanded_Name and then Comes_From_Source (N) then + Error_Msg_N ("discriminant must appear alone as a direct name", N); + end if; + end Check_Legality_In_Constraint; + begin -- Any use in a spec-expression is legal @@ -694,19 +712,11 @@ package body Sem_Res is -- processing for records). See Sem_Ch3.Build_Derived_Record_Type -- for more info. - if Ekind (Current_Scope) = E_Record_Type - and then Scope (Disc) = Current_Scope - and then not - (Nkind (Parent (P)) = N_Subtype_Indication - and then - Nkind (Parent (Parent (P))) in N_Component_Definition - | N_Subtype_Declaration - and then Paren_Count (N) = 0) - then - Error_Msg_N - ("discriminant must appear alone in component constraint", N); - return; - end if; + Check_Legality_In_Constraint + (Nkind (Parent (P)) = N_Subtype_Indication + and then Nkind (Parent (Parent (P))) in N_Component_Definition + | N_Subtype_Declaration + and then Paren_Count (N) = 0); -- Detect a common error: @@ -817,18 +827,7 @@ package body Sem_Res is elsif Nkind (PN) in N_Index_Or_Discriminant_Constraint | N_Discriminant_Association then - if Paren_Count (N) > 0 then - Error_Msg_N - ("discriminant in constraint must appear alone", N); - - elsif Nkind (N) = N_Expanded_Name - and then Comes_From_Source (N) - then - Error_Msg_N - ("discriminant must appear alone as a direct name", N); - end if; - - return; + Check_Legality_In_Constraint (Paren_Count (N) = 0); -- Otherwise, context is an expression. It should not be within (i.e. a -- subexpression of) a constraint for a component. @@ -863,8 +862,7 @@ package body Sem_Res is or else Nkind (P) = N_Entry_Declaration or else Nkind (D) = N_Defining_Identifier then - Error_Msg_N - ("discriminant in constraint must appear alone", N); + Check_Legality_In_Constraint (False); end if; end if; end Check_Discriminant_Use; diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index 3de38b2..f774184 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,17 @@ +2025-11-04 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/122544 + * checker-event.cc (catch_cfg_edge_event::get_meaning): New. + (setjmp_event::get_meaning): New. + (rewind_event::get_meaning): New. + (throw_event::get_meaning): New. + (unwind_event::get_meaning): New. + * checker-event.h (catch_cfg_edge_event::get_meaning): New decl. + (setjmp_event::get_meaning): New decl. + (rewind_event::get_meaning): New decl. + (throw_event::get_meaning): New decl. + (unwind_event::get_meaning): New decl. + 2025-10-16 David Malcolm <dmalcolm@redhat.com> * ana-state-to-diagnostic-state.cc: Reimplement throughout to use diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index d4982eb..985b018 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,14 @@ +2025-11-04 Alejandro Colomar <alx@kernel.org> + + * c-warn.cc (warn_parms_array_mismatch): Fix typos in comment. + +2025-11-04 Alejandro Colomar <alx@kernel.org> + + * c-common.h (warn_parm_array_mismatch): + Rename warn_parm_array_mismatch => warn_parms_array_mismatch. + * c-warn.cc (warn_parm_array_mismatch): + Rename warn_parm_array_mismatch => warn_parms_array_mismatch. + 2025-10-30 Qing Zhao <qing.zhao@oracle.com> * c-attribs.cc (handle_counted_by_attribute): Allow counted_by for diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 23cc53a..7894b76 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2025-11-04 Alejandro Colomar <alx@kernel.org> + + * c-decl.cc (start_function): + Rename warn_parm_array_mismatch => warn_parms_array_mismatch. + * c-parser.cc (c_parser_declaration_or_fndef): + Rename warn_parm_array_mismatch => warn_parms_array_mismatch. + 2025-11-01 Martin Uecker <uecker@tugraz.at> * c-decl.cc (build_compound_literal): Add error. diff --git a/gcc/config/loongarch/loongarch.md b/gcc/config/loongarch/loongarch.md index 2f4817d..ba66888 100644 --- a/gcc/config/loongarch/loongarch.md +++ b/gcc/config/loongarch/loongarch.md @@ -1773,21 +1773,23 @@ ;; This attribute used for get connection of scalar mode and corresponding ;; vector mode. -(define_mode_attr cntmap [(SI "v4si") (DI "v2di")]) +(define_mode_attr cntmap [(SI "V4SI") (DI "V2DI")]) -(define_expand "popcount<mode>2" - [(set (match_operand:GPR 0 "register_operand") - (popcount:GPR (match_operand:GPR 1 "register_operand")))] +(define_insn_and_split "popcount<mode>2" + [(set (match_operand:GPR 0 "register_operand" "=f") + (popcount:GPR (match_operand:GPR 1 "register_operand" "f")))] "ISA_HAS_LSX" + "#" + ;; Do the split very lately to work around init-regs unneeded zero- + ;; initialization from init-regs. See PR61810 and all the referenced + ;; issues. + "&& reload_completed" + [(set (match_operand:<cntmap> 0 "register_operand" "=f") + (popcount:<cntmap> + (match_operand:<cntmap> 1 "register_operand" "f")))] { - rtx in = operands[1]; - rtx out = operands[0]; - rtx vreg = <MODE>mode == SImode ? gen_reg_rtx (V4SImode) : - gen_reg_rtx (V2DImode); - emit_insn (gen_lsx_vinsgr2vr_<size> (vreg, in, vreg, GEN_INT (1))); - emit_insn (gen_popcount<cntmap>2 (vreg, vreg)); - emit_insn (gen_lsx_vpickve2gr_<size> (out, vreg, GEN_INT (0))); - DONE; + operands[0] = gen_rtx_REG (<cntmap>mode, REGNO (operands[0])); + operands[1] = gen_rtx_REG (<cntmap>mode, REGNO (operands[1])); }) ;; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9a8c394..36c0b42 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,16 @@ +2025-11-04 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/122253 + * decl2.cc (min_vis_expr_r): Don't mark no-linkage declarations + as VISIBILITY_ANON. + +2025-11-04 David Malcolm <dmalcolm@redhat.com> + + * parser.cc (enum non_integral_constant): Fix typo + "an decrement" -> "a decrement" in comment. + (cp_parser_non_integral_constant_expression): Likewise in error + message. + 2025-11-03 Jason Merrill <jason@redhat.com> * name-lookup.cc (name_lookup::adl_class_fns): Include all diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ffaf520..bee1d2b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,24 @@ +2025-11-04 Harald Anlauf <anlauf@gmx.de> + + PR fortran/122564 + * resolve.cc (resolve_locality_spec): Delete temporary hash_set. + +2025-11-04 Paul-Antoine Arras <parras@baylibre.com> + + PR fortran/122369 + PR fortran/122508 + * gfortran.h (gfc_rebind_label): Declare new function. + * parse.cc (parse_omp_metadirective_body): Rebind labels to the outer + region. Maintain a vector of metadirective regions. + (gfc_parse_file): Initialise it. + * parse.h (GFC_PARSE_H): Declare it. + * symbol.cc (gfc_get_st_label): Look for existing labels in outer + metadirective regions. + (gfc_rebind_label): Define new function. + (gfc_define_st_label): Accept duplicate labels in metadirective body. + (gfc_reference_st_label): Accept shared DO termination labels in + metadirective body. + 2025-11-03 Steve Kargl <kargls@comcast.net> PR fortran/122513 diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index 5b222cd..96ee6bf 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -4191,30 +4191,36 @@ gfc_get_pdt_instance (gfc_actual_arglist *param_list, gfc_symbol **sym, to obtain the instance of the extended type. */ if (gfc_current_state () != COMP_DERIVED && c1 == pdt->components - && (c1->ts.type == BT_DERIVED || c1->ts.type == BT_CLASS) - && c1->ts.u.derived && c1->ts.u.derived->attr.pdt_template + && c1->ts.type == BT_DERIVED + && c1->ts.u.derived && gfc_get_derived_super_type (*sym) == c2->ts.u.derived) { - gfc_formal_arglist *f; + if (c1->ts.u.derived->attr.pdt_template) + { + gfc_formal_arglist *f; - old_param_spec_list = type_param_spec_list; + old_param_spec_list = type_param_spec_list; - /* Obtain a spec list appropriate to the extended type..*/ - actual_param = gfc_copy_actual_arglist (type_param_spec_list); - type_param_spec_list = actual_param; - for (f = c1->ts.u.derived->formal; f && f->next; f = f->next) - actual_param = actual_param->next; - if (actual_param) - { - gfc_free_actual_arglist (actual_param->next); - actual_param->next = NULL; - } + /* Obtain a spec list appropriate to the extended type..*/ + actual_param = gfc_copy_actual_arglist (type_param_spec_list); + type_param_spec_list = actual_param; + for (f = c1->ts.u.derived->formal; f && f->next; f = f->next) + actual_param = actual_param->next; + if (actual_param) + { + gfc_free_actual_arglist (actual_param->next); + actual_param->next = NULL; + } - /* Now obtain the PDT instance for the extended type. */ - c2->param_list = type_param_spec_list; - m = gfc_get_pdt_instance (type_param_spec_list, &c2->ts.u.derived, - &c2->param_list); - type_param_spec_list = old_param_spec_list; + /* Now obtain the PDT instance for the extended type. */ + c2->param_list = type_param_spec_list; + m = gfc_get_pdt_instance (type_param_spec_list, + &c2->ts.u.derived, + &c2->param_list); + type_param_spec_list = old_param_spec_list; + } + else + c2->ts = c1->ts; c2->ts.u.derived->refs++; gfc_set_sym_referenced (c2->ts.u.derived); diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index f5db9a8..770bc5b 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -12320,6 +12320,7 @@ static void resolve_omp_metadirective (gfc_code *code, gfc_namespace *ns) { gfc_omp_variant *variant = code->ext.omp_variants; + gfc_omp_variant *prev_variant = variant; while (variant) { @@ -12333,15 +12334,19 @@ resolve_omp_metadirective (gfc_code *code, gfc_namespace *ns) as the 'otherwise' clause should always match. */ if (variant == code->ext.omp_variants && !variant->next) break; - if (variant == code->ext.omp_variants) - code->ext.omp_variants = variant->next; gfc_omp_variant *tmp = variant; - variant = variant->next; + if (variant == code->ext.omp_variants) + variant = prev_variant = code->ext.omp_variants = variant->next; + else + variant = prev_variant->next = variant->next; gfc_free_omp_set_selector_list (tmp->selectors); free (tmp); } else - variant = variant->next; + { + prev_variant = variant; + variant = variant->next; + } } /* Replace metadirective by its body if only 'nothing' remains. */ if (!code->ext.omp_variants->next && code->ext.omp_variants->stmt == ST_NONE) diff --git a/gcc/fortran/primary.cc b/gcc/fortran/primary.cc index 1dcb1c3..496ee45 100644 --- a/gcc/fortran/primary.cc +++ b/gcc/fortran/primary.cc @@ -3543,7 +3543,7 @@ gfc_convert_to_structure_constructor (gfc_expr *e, gfc_symbol *sym, gfc_expr **c } /* Find the current component in the structure definition and check - its access is not private. */ + its access is not private. */ if (comp) this_comp = gfc_find_component (sym, comp->name, false, false, NULL); else @@ -3836,8 +3836,6 @@ gfc_match_rvalue (gfc_expr **result) bool implicit_char; gfc_ref *ref; gfc_symtree *pdt_st; - gfc_symbol *found_specific = NULL; - m = gfc_match ("%%loc"); if (m == MATCH_YES) @@ -4085,29 +4083,21 @@ gfc_match_rvalue (gfc_expr **result) break; } - gfc_gobble_whitespace (); - found_specific = NULL; - - /* Even if 'name' is that of a PDT template, priority has to be given to - possible specific procedures in the generic interface. */ - gfc_find_sym_tree (gfc_dt_upper_string (name), NULL, 1, &pdt_st); - if (sym->generic && sym->generic->next - && gfc_peek_ascii_char() != '(') - { - gfc_actual_arglist *arg = actual_arglist; - for (; arg && pdt_st; arg = arg->next) - gfc_resolve_expr (arg->expr); - found_specific = gfc_search_interface (sym->generic, 0, - &actual_arglist); - } - /* Check to see if this is a PDT constructor. The format of these constructors is rather unusual: name [(type_params)](component_values) where, component_values excludes the type_params. With the present gfortran representation this is rather awkward because the two are not - distinguished, other than by their attributes. */ - if (sym->attr.generic && pdt_st != NULL && found_specific == NULL) + distinguished, other than by their attributes. + + Even if 'name' is that of a PDT template, priority has to be given to + specific procedures, other than the constructor, in the generic + interface. */ + + gfc_gobble_whitespace (); + gfc_find_sym_tree (gfc_dt_upper_string (name), NULL, 1, &pdt_st); + if (sym->attr.generic && pdt_st != NULL + && !(sym->generic->next && gfc_peek_ascii_char() != '(')) { gfc_symbol *pdt_sym; gfc_actual_arglist *ctr_arglist = NULL, *tmp; @@ -4172,12 +4162,8 @@ gfc_match_rvalue (gfc_expr **result) tmp = tmp->next; } - if (found_specific) - gfc_find_sym_tree (found_specific->name, - NULL, 1, &symtree); - else - gfc_find_sym_tree (gfc_dt_lower_string (pdt_sym->name), - NULL, 1, &symtree); + gfc_find_sym_tree (gfc_dt_lower_string (pdt_sym->name), + NULL, 1, &symtree); if (!symtree) { gfc_get_ha_sym_tree (gfc_dt_lower_string (pdt_sym->name) , diff --git a/gcc/gimple-ssa-isolate-paths.cc b/gcc/gimple-ssa-isolate-paths.cc index ca1daf1..ffa04d1 100644 --- a/gcc/gimple-ssa-isolate-paths.cc +++ b/gcc/gimple-ssa-isolate-paths.cc @@ -56,7 +56,7 @@ check_loadstore (gimple *stmt, tree op, tree, void *data) { TREE_THIS_VOLATILE (op) = 1; TREE_SIDE_EFFECTS (op) = 1; - update_stmt (stmt); + gimple_set_has_volatile_ops (stmt, true); return true; } return false; @@ -762,6 +762,7 @@ find_implicit_erroneous_behavior (void) /* We've got a NULL PHI argument. Now see if the PHI's result is dereferenced within BB. */ + auto_vec <gimple *, 4> uses_in_bb; FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs) { /* We only care about uses in BB. Catching cases in @@ -774,18 +775,23 @@ find_implicit_erroneous_behavior (void) ? gimple_location (use_stmt) : phi_arg_loc; - if (stmt_uses_name_in_undefined_way (use_stmt, lhs, loc) - && (duplicate || can_duplicate_block_p (bb))) + if (stmt_uses_name_in_undefined_way (use_stmt, lhs, loc)) { - duplicate = isolate_path (bb, duplicate, e, - use_stmt, lhs, false); - - /* When we remove an incoming edge, we need to - reprocess the Ith element. */ - next_i = i; - cfg_altered = true; + if (!can_duplicate_block_p (bb)) + break; + uses_in_bb.safe_push (use_stmt); } } + for (gimple *use_stmt : uses_in_bb) + { + duplicate = isolate_path (bb, duplicate, e, + use_stmt, lhs, false); + + /* When we remove an incoming edge, we need to + reprocess the Ith element. */ + next_i = i; + cfg_altered = true; + } } } } diff --git a/gcc/gimple.h b/gcc/gimple.h index 0356bc5..9bd3f8c 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -250,8 +250,8 @@ struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"), /* Nonzero if this statement contains volatile operands. */ unsigned has_volatile_ops : 1; - /* Padding to get subcode to 16 bit alignment. */ - unsigned pad : 1; + /* Infrastructure local flag. Always clear. */ + unsigned ilf : 1; /* The SUBCODE field can be used for tuple-specific flags for tuples that do not require subcodes. Note that SUBCODE should be at diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index c059e06..c3c37f6 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,11 @@ +2025-11-04 Siddhesh Poyarekar <siddhesh@gotplt.org> + + PR lto/122515 + * lto.h (lto_section_slot): Set type of START to off_t. + * lto-common.cc (lto_read_section_data): Adjust. + * lto-object.cc (lto_obj_file_open): Set type of OFFSET to + int64_t. + 2025-10-30 Michal Jires <mjires@suse.cz> * lto.cc (stream_out_partitions): Remove asm_nodes_out. diff --git a/gcc/ssa-iterators.h b/gcc/ssa-iterators.h index 0822a98..d6bd15c 100644 --- a/gcc/ssa-iterators.h +++ b/gcc/ssa-iterators.h @@ -114,6 +114,11 @@ struct auto_end_imm_use_stmt_traverse (void) ((DEST) = next_imm_use_on_stmt (&(ITER)))) +/* Use this to get a vector of all gimple stmts using SSAVAR without + duplicates. It's cheaper than FOR_EACH_IMM_USE_STMT and has no + constraints on what you are allowed to do inside an iteration + over the vector. */ +extern auto_vec<gimple *, 2> gather_imm_use_stmts (tree ssavar); extern bool single_imm_use_1 (const ssa_use_operand_t *head, use_operand_p *use_p, gimple **stmt); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a2f15e..25324e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,84 @@ +2025-11-04 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/protected_subtype1.adb: New test. + +2025-11-04 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/specs/generic_inst9.ads: New test. + * gnat.dg/specs/generic_inst9_pkg1.ads: New helper. + * gnat.dg/specs/generic_inst9_pkg2.ads: Likewise. + * gnat.dg/specs/generic_inst9_pkg2-g.ads: Likewise. + +2025-11-04 Uros Bizjak <ubizjak@gmail.com> + + PR target/122390 + * gcc.target/i386/pr122390.c: New test. + * gcc.target/i386/pr122390-1.c: New test. + +2025-11-04 Kees Cook <kees@kernel.org> + + * gcc.target/arc/builtin_fls_const.c: New test. Verify that + const attribute enables CSE optimization for mathematical ARC + builtins by checking that duplicate calls are eliminated and + results are optimized to shift operations. + +2025-11-04 Paul-Antoine Arras <parras@baylibre.com> + + PR fortran/122369 + PR fortran/122508 + * gfortran.dg/gomp/pr122369-1.f90: New test. + * gfortran.dg/gomp/pr122369-2.f90: New test. + * gfortran.dg/gomp/pr122369-3.f90: New test. + * gfortran.dg/gomp/pr122369-4.f90: New test. + * gfortran.dg/gomp/pr122508-1.f90: New test. + * gfortran.dg/gomp/pr122508-2.f90: New test. + +2025-11-04 Siddhesh Poyarekar <siddhesh@gotplt.org> + + PR lto/122515 + * lib/lto.exp (lto-build-archive): New procedure. + (lto-execute-1): Use it. + (lto-link-and-maybe-run, lto-get-options-main): Handle ar-link. + * gcc.dg/lto/pr122515_0.c: New test case. + * gcc.dg/lto/pr122515_1.c: New file. + * gcc.dg/lto/pr122515_2.c: Likewise. + * gcc.dg/lto/pr122515_3.c: Likewise. + * gcc.dg/lto/pr122515_4.c: Likewise. + * gcc.dg/lto/pr122515_5.c: Likewise. + * gcc.dg/lto/pr122515_6.c: Likewise. + * gcc.dg/lto/pr122515_7.c: Likewise. + * gcc.dg/lto/pr122515_8.c: Likewise. + * gcc.dg/lto/pr122515_9.c: Likewise. + +2025-11-04 Nathaniel Shead <nathanieloshead@gmail.com> + + PR c++/122253 + * g++.dg/modules/internal-16.C: New test. + +2025-11-04 Tobias Burnus <tburnus@baylibre.com> + + PR fortran/122513 + * gfortran.dg/pr122513-2.f90: New test. + +2025-11-04 Kishan Parmar <kishan@linux.ibm.com> + + PR rtl-optimization/93738 + * gcc.target/powerpc/rlwimi-2.c: Update expected rldicl count. + +2025-11-04 David Malcolm <dmalcolm@redhat.com> + + PR analyzer/122544 + * g++.dg/analyzer/exception-path-1-sarif.py: New test script. + * g++.dg/analyzer/exception-path-1.C: Add SARIF output, and use + the above to check it. + * g++.dg/analyzer/exception-path-unwind-multiple-2-sarif.py: New + test script. + * g++.dg/analyzer/exception-path-unwind-multiple-2.C: Add SARIF + output, and use the above to check it. + * gcc.dg/analyzer/setjmp-3-sarif.py: New test script. + * gcc.dg/analyzer/setjmp-3.c: Add SARIF output, and use + the above to check it. + 2025-11-03 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/generic_inst15.adb: New test. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-43.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-43.c new file mode 100644 index 0000000..f0f6170 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-43.c @@ -0,0 +1,169 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-forwprop1" } */ +/* { dg-additional-options "-fgimple" } */ + +#include <stdint.h> + +typedef int32_t int32x4_t __attribute__((vector_size(16))); +typedef int32_t int32x2_t __attribute__((vector_size(8))); +typedef int32_t int32x1_t __attribute__((vector_size(4))); + +int32x4_t __GIMPLE (ssa) +foo (int32x4_t x) +{ + int32x2_t _1; + int32x2_t _2; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64); + _2 = __BIT_FIELD_REF <int32x2_t> (x, 64, 0); + _6 = _Literal (int32x4_t) { _1, _2 }; + return _6; +} + +int32x4_t __GIMPLE (ssa) +foo2 (int32x4_t x) +{ + int32x1_t _1; + int32x1_t _2; + int32x1_t _3; + int32x1_t _4; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x1_t> (x, 32, 64); + _2 = __BIT_FIELD_REF <int32x1_t> (x, 32, 96); + _3 = __BIT_FIELD_REF <int32x1_t> (x, 32, 0); + _4 = __BIT_FIELD_REF <int32x1_t> (x, 32, 32); + _6 = _Literal (int32x4_t) { _1, _2, _3, _4 }; + return _6; +} + +int32x4_t __GIMPLE (ssa) +foo3 (int32x4_t x, int32x4_t y) +{ + int32x2_t _1; + int32x2_t _2; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64); + _2 = __BIT_FIELD_REF <int32x2_t> (y, 64, 0); + _6 = _Literal (int32x4_t) { _1, _2 }; + return _6; +} + +int32x4_t __GIMPLE (ssa) +foo4 (int32x4_t x, int32x4_t y) +{ + int32x1_t _1; + int32x1_t _2; + int32x1_t _3; + int32x1_t _4; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x1_t> (x, 32, 64); + _2 = __BIT_FIELD_REF <int32x1_t> (y, 32, 96); + _3 = __BIT_FIELD_REF <int32x1_t> (x, 32, 0); + _4 = __BIT_FIELD_REF <int32x1_t> (y, 32, 32); + _6 = _Literal (int32x4_t) { _1, _2, _3, _4 }; + return _6; +} + +int32x4_t __GIMPLE (ssa) +foo5 (int32x4_t x) +{ + int32x2_t _1; + int32x2_t _2; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64); + _2 = _Literal (int32x2_t) { 1, 2 }; + _6 = _Literal (int32x4_t) { _1, _2 }; + return _6; +} + +int32x4_t __GIMPLE (ssa) +foo6 (int32x4_t x, int32_t y) +{ + int32x2_t _1; + int32x2_t _2; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64); + _2 = _Literal (int32x2_t) { y, y }; + _6 = _Literal (int32x4_t) { _1, _2 }; + return _6; +} + +int32x4_t __GIMPLE (ssa) +foo7 (int32x4_t x) +{ + int32x2_t _1; + int32x2_t _2; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64); + _2 = _Literal (int32x2_t) { 1, 2 }; + _6 = _Literal (int32x4_t) { _2, _1 }; + return _6; +} + +int32x4_t __GIMPLE (ssa) +foo8 (int32x4_t x, int32_t y) +{ + int32x2_t _1; + int32x2_t _2; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x2_t> (x, 64, 64); + _2 = _Literal (int32x2_t) { y, y }; + _6 = _Literal (int32x4_t) { _2, _1 }; + return _6; +} + +int32x4_t __GIMPLE (ssa) +foo9 (int32x4_t x) +{ + int32x1_t _1; + int32x1_t _2; + int32x1_t _3; + int32x1_t _4; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x1_t> (x, 32, 96); + _2 = __BIT_FIELD_REF <int32x1_t> (x, 32, 64); + _3 = _Literal (int32x1_t) { 1 }; + _4 = _Literal (int32x1_t) { 1 }; + _6 = _Literal (int32x4_t) { _3, _4, _1, _2 }; + return _6; +} + +int32x4_t __GIMPLE (ssa) +foo10 (int32x4_t x, int32_t y) +{ + int32x1_t _1; + int32x1_t _2; + int32x1_t _3; + int32x1_t _4; + int32x4_t _6; + +__BB(2): + _1 = __BIT_FIELD_REF <int32x1_t> (x, 32, 96); + _2 = __BIT_FIELD_REF <int32x1_t> (x, 32, 64); + _3 = _Literal (int32x1_t) { y }; + _4 = _Literal (int32x1_t) { y }; + _6 = _Literal (int32x4_t) { _3, _4, _1, _2 }; + + return _6; +} + + +/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 10 "forwprop1" } } */ diff --git a/gcc/testsuite/gcc.target/aarch64/simd/combine_ext.c b/gcc/testsuite/gcc.target/aarch64/simd/combine_ext.c new file mode 100644 index 0000000..f10a2c6 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/simd/combine_ext.c @@ -0,0 +1,46 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ + +#include <arm_neon.h> + +#ifndef TEST_COMBINE_HIGH_LOW_1 +#define TEST_COMBINE_HIGH_LOW_1(TYPE, SUFF) \ + TYPE rev_##TYPE##_1 (TYPE x) \ + { \ + return vcombine_##SUFF (vget_high_##SUFF (x), vget_low_##SUFF (x)); \ + } +#endif + +#ifndef TEST_COMBINE_HIGH_LOW_2 +#define TEST_COMBINE_HIGH_LOW_2(TYPE, SUFF) \ + TYPE rev_##TYPE##_2 (TYPE x, TYPE y) \ + { \ + return vcombine_##SUFF (vget_high_##SUFF (x), vget_low_##SUFF (y)); \ + } +#endif + +TEST_COMBINE_HIGH_LOW_1 (int8x16_t, s8) +TEST_COMBINE_HIGH_LOW_1 (int16x8_t, s16) +TEST_COMBINE_HIGH_LOW_1 (int32x4_t, s32) +TEST_COMBINE_HIGH_LOW_1 (int64x2_t, s64) +TEST_COMBINE_HIGH_LOW_1 (uint8x16_t, u8) +TEST_COMBINE_HIGH_LOW_1 (uint16x8_t, u16) +TEST_COMBINE_HIGH_LOW_1 (uint32x4_t, u32) +TEST_COMBINE_HIGH_LOW_1 (uint64x2_t, u64) +TEST_COMBINE_HIGH_LOW_1 (float16x8_t, f16) +TEST_COMBINE_HIGH_LOW_1 (float32x4_t, f32) + +TEST_COMBINE_HIGH_LOW_2 (int8x16_t, s8) +TEST_COMBINE_HIGH_LOW_2 (int16x8_t, s16) +TEST_COMBINE_HIGH_LOW_2 (int32x4_t, s32) +TEST_COMBINE_HIGH_LOW_2 (int64x2_t, s64) +TEST_COMBINE_HIGH_LOW_2 (uint8x16_t, u8) +TEST_COMBINE_HIGH_LOW_2 (uint16x8_t, u16) +TEST_COMBINE_HIGH_LOW_2 (uint32x4_t, u32) +TEST_COMBINE_HIGH_LOW_2 (uint64x2_t, u64) +TEST_COMBINE_HIGH_LOW_2 (float16x8_t, f16) +TEST_COMBINE_HIGH_LOW_2 (float32x4_t, f32) + +/* { dg-final { scan-tree-dump-times "VEC_PERM_EXPR" 20 "optimized" } } */ +/* { dg-final { scan-assembler-times {ext\tv0.16b, v0.16b, v0.16b, #8} 10 } } */ +/* { dg-final { scan-assembler-times {ext\tv0.16b, v0.16b, v1.16b, #8} 10 } } */ diff --git a/gcc/testsuite/gcc.target/loongarch/widen-mul-rtx-cost-signed.c b/gcc/testsuite/gcc.target/loongarch/widen-mul-rtx-cost-signed.c index 1e1e75f..61d21a8 100644 --- a/gcc/testsuite/gcc.target/loongarch/widen-mul-rtx-cost-signed.c +++ b/gcc/testsuite/gcc.target/loongarch/widen-mul-rtx-cost-signed.c @@ -9,5 +9,4 @@ test (int a) return a / 3; } -/* { dg-final { scan-assembler {\tmulw.d.w\t} } } */ /* { dg-final { scan-assembler-not {\tdiv.w\t} } } */ diff --git a/gcc/testsuite/gfortran.dg/gomp/pr122570.f b/gcc/testsuite/gfortran.dg/gomp/pr122570.f new file mode 100644 index 0000000..9897cc6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr122570.f @@ -0,0 +1,29 @@ +! { dg-do compile } +! { dg-additional-options "-Wall" } + +! PR fortran/122570 + + SUBROUTINE INITAL + implicit none (type, external) + integer :: j, n + n = 5 +!$omp metadirective & +!$omp& when(user={condition(.true.)}: target teams & +!$omp& distribute parallel do) & +!$omp& when(user={condition(.false.)}: target teams & +!$omp& distribute parallel do) + DO J=1,N + END DO + END SUBROUTINE + + SUBROUTINE CALC3 + implicit none (type, external) + integer :: i, m + m = 99 +!$omp metadirective +!$omp& when(user={condition(.false.)}: +!$omp& simd) + DO 301 I=1,M + 301 CONTINUE + 300 CONTINUE ! { dg-warning "Label 300 at .1. defined but not used \\\[-Wunused-label\\\]" } + END SUBROUTINE diff --git a/gcc/testsuite/gfortran.dg/pdt_66.f03 b/gcc/testsuite/gfortran.dg/pdt_66.f03 new file mode 100644 index 0000000..269f6b4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_66.f03 @@ -0,0 +1,54 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! +! Check the fix for PR122501. +! +! Contributed by Damian Rouson <damian@archaeologic.codes> +! +module tensor_m + implicit none + + type tensor_t(k) + integer, kind :: k = kind(1.) + real(k), allocatable, private :: values_(:) + contains + procedure default_real_values + end type + + interface tensor_t + type(tensor_t) module function construct_default_real(values) + implicit none + real values(:) + end function + end interface + + interface + module function default_real_values(self) result(tensor_values) + implicit none + class(tensor_t) self + real, allocatable :: tensor_values(:) + end function + end interface +end module + + use tensor_m + implicit none +contains + function copy(tensor) + type(tensor_t) tensor, copy, norm_copy + associate(tensor_values => tensor%default_real_values()) + +! This gave: "Component ‘values_’ at (1) is a PRIVATE component of ‘tensor_t’" + copy = tensor_t(tensor_values) + + end associate + +! Make sure that the fix really works :-) + associate(f => tensor%default_real_values()) + associate(tensor_values => tensor%default_real_values()) + norm_copy = tensor_t(tensor_values/maxval(f)) + end associate + end associate + end function +end +! { dg-final { scan-tree-dump-times "default_real_values" 3 "original" } } diff --git a/gcc/testsuite/gfortran.dg/pdt_67.f03 b/gcc/testsuite/gfortran.dg/pdt_67.f03 new file mode 100644 index 0000000..b59d201 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_67.f03 @@ -0,0 +1,36 @@ +! { dg-do compile } +! +! Check the fix for PR122524. +! +! Contributed by Damian Rouson <damian@archaeologic.codes> +! +module tensor_map_m + implicit none + + type tensor_t(k) + integer, kind :: k = kind(1.) + real(k), allocatable :: values_(:) + end type + + interface tensor_t + module function tensor(values) + implicit none + double precision values(:) + type(tensor_t(kind(0D0))) tensor + end function + end interface + + type tensor_map_t(k) + integer, kind :: k = kind(1.) + real(k) slope_ + end type + +contains + function unnormalized_tensor(self, tensor) + type(tensor_map_t(kind(0D0))) self + type(tensor_t(kind(0D0))) tensor, unnormalized_tensor + associate(unnormalized_values => tensor%values_*self%slope_) + unnormalized_tensor = tensor_t(unnormalized_values) ! Caused an ICE. + end associate + end function +end module diff --git a/gcc/testsuite/gfortran.dg/pdt_68.f03 b/gcc/testsuite/gfortran.dg/pdt_68.f03 new file mode 100644 index 0000000..b3493b1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pdt_68.f03 @@ -0,0 +1,34 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! +! Check the fix for PR122566. +! +! Contributed by Damian Rouson <damian@archaeologic.codes> +! +module double_precision_file_m + implicit none + + type file_t + integer :: i + end type + + type, extends(file_t) :: double_precision_file_t + end type + + type, extends(double_precision_file_t) :: training_configuration_t(m) + integer, kind :: m = kind(1.) + end type + +contains + pure module function training_configuration() + type(training_configuration_t) training_configuration + training_configuration%file_t = file_t(42) ! Needed parent type to be introduced explicitly + end function +end module + + use double_precision_file_m + type(training_configuration_t) :: x + x = training_configuration () + if (x%i /= 42) stop 1 +end +! { dg-final { scan-tree-dump-times "double_precision_file_t.file_t" 2 "original" } } diff --git a/gcc/testsuite/gnat.dg/protected_subtype1.adb b/gcc/testsuite/gnat.dg/protected_subtype1.adb new file mode 100644 index 0000000..cb003c8 --- /dev/null +++ b/gcc/testsuite/gnat.dg/protected_subtype1.adb @@ -0,0 +1,26 @@ +-- { dg-do compile } + +procedure Protected_Subtype1 is + + protected type Object with Lock_Free => True is + end Object; + + protected body Object is + end Object; + + A : Object; + + subtype Object_Subtype is Object; + + B : Object_Subtype; + + type Rec is record + A : Object; + B : Object_Subtype; + end record; + + C : Rec; + +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/specs/discr8.ads b/gcc/testsuite/gnat.dg/specs/discr8.ads new file mode 100644 index 0000000..889d37a --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/discr8.ads @@ -0,0 +1,14 @@ +-- { dg-do compile } + +package Discr8 is + + type T1 (N : Natural) is null record; + + type T2 (N : Natural) is record + C1 : string (1 .. T2.n); -- { dg-error "alone as a direct name" } + C2 : string (1 .. n); + C3 : T1 (T2.n); -- { dg-error "alone as a direct name" } + C4 : T1 (n); + end record; + +end Discr8; diff --git a/gcc/tree-ssa-forwprop.cc b/gcc/tree-ssa-forwprop.cc index 9a993ab..ae7f0e7 100644 --- a/gcc/tree-ssa-forwprop.cc +++ b/gcc/tree-ssa-forwprop.cc @@ -925,12 +925,10 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, static bool forward_propagate_addr_expr (tree name, tree rhs, bool parent_single_use_p) { - imm_use_iterator iter; - gimple *use_stmt; bool all = true; bool single_use_p = parent_single_use_p && has_single_use (name); - FOR_EACH_IMM_USE_STMT (use_stmt, iter, name) + for (gimple *use_stmt : gather_imm_use_stmts (name)) { bool result; tree use_rhs; @@ -3809,13 +3807,16 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) bool maybe_blend[2] = { true, true }; tree one_constant = NULL_TREE; tree one_nonconstant = NULL_TREE; + tree subelt; auto_vec<tree> constants; constants.safe_grow_cleared (nelts, true); auto_vec<std::pair<unsigned, unsigned>, 64> elts; + unsigned int tsubelts = 0; FOR_EACH_VEC_SAFE_ELT (CONSTRUCTOR_ELTS (op), i, elt) { tree ref, op1; - unsigned int elem; + unsigned int elem, src_elem_size; + unsigned HOST_WIDE_INT nsubelts = 1; if (i >= nelts) return false; @@ -3826,10 +3827,16 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) if (op1 && TREE_CODE ((ref = TREE_OPERAND (op1, 0))) == SSA_NAME && VECTOR_TYPE_P (TREE_TYPE (ref)) - && useless_type_conversion_p (TREE_TYPE (op1), + && (useless_type_conversion_p (TREE_TYPE (op1), TREE_TYPE (TREE_TYPE (ref))) - && constant_multiple_p (bit_field_offset (op1), - bit_field_size (op1), &elem) + || (VECTOR_TYPE_P (TREE_TYPE (op1)) + && useless_type_conversion_p (TREE_TYPE (TREE_TYPE (op1)), + TREE_TYPE (TREE_TYPE (ref))) + && TYPE_VECTOR_SUBPARTS (TREE_TYPE (op1)) + .is_constant (&nsubelts))) + && constant_multiple_p (bit_field_size (op1), nsubelts, + &src_elem_size) + && constant_multiple_p (bit_field_offset (op1), src_elem_size, &elem) && TYPE_VECTOR_SUBPARTS (TREE_TYPE (ref)).is_constant (&refnelts)) { unsigned int j; @@ -3853,7 +3860,9 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) maybe_ident = false; if (elem != i) maybe_blend[j] = false; - elts.safe_push (std::make_pair (j, elem)); + for (unsigned int k = 0; k < nsubelts; ++k) + elts.safe_push (std::make_pair (j, elem + k)); + tsubelts += nsubelts; continue; } /* Else fallthru. */ @@ -3865,27 +3874,47 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) && orig[1] != error_mark_node) return false; orig[1] = error_mark_node; + if (VECTOR_TYPE_P (TREE_TYPE (elt->value)) + && !TYPE_VECTOR_SUBPARTS (TREE_TYPE (elt->value)) + .is_constant (&nsubelts)) + return false; if (CONSTANT_CLASS_P (elt->value)) { if (one_nonconstant) return false; if (!one_constant) - one_constant = elt->value; - constants[i] = elt->value; + one_constant = TREE_CODE (elt->value) == VECTOR_CST + ? VECTOR_CST_ELT (elt->value, 0) + : elt->value; + if (TREE_CODE (elt->value) == VECTOR_CST) + { + for (unsigned int k = 0; k < nsubelts; k++) + constants[tsubelts + k] = VECTOR_CST_ELT (elt->value, k); + } + else + constants[tsubelts] = elt->value; } else { if (one_constant) return false; + subelt = VECTOR_TYPE_P (TREE_TYPE (elt->value)) + ? ssa_uniform_vector_p (elt->value) + : elt->value; + if (!subelt) + return false; if (!one_nonconstant) - one_nonconstant = elt->value; - else if (!operand_equal_p (one_nonconstant, elt->value, 0)) + one_nonconstant = subelt; + else if (!operand_equal_p (one_nonconstant, subelt, 0)) return false; } - elts.safe_push (std::make_pair (1, i)); + for (unsigned int k = 0; k < nsubelts; ++k) + elts.safe_push (std::make_pair (1, tsubelts + k)); + tsubelts += nsubelts; maybe_ident = false; } - if (i < nelts) + + if (elts.length () < nelts) return false; if (! orig[0] diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc index cc76383..5e35a59 100644 --- a/gcc/tree-ssa-loop-niter.cc +++ b/gcc/tree-ssa-loop-niter.cc @@ -1752,16 +1752,23 @@ dump_affine_iv (FILE *file, affine_iv *iv) if (!integer_zerop (iv->step)) fprintf (file, "["); - print_generic_expr (dump_file, iv->base, TDF_SLIM); + print_generic_expr (file, iv->base, TDF_SLIM); if (!integer_zerop (iv->step)) { fprintf (file, ", + , "); - print_generic_expr (dump_file, iv->step, TDF_SLIM); + print_generic_expr (file, iv->step, TDF_SLIM); fprintf (file, "]%s", iv->no_overflow ? "(no_overflow)" : ""); } } +DEBUG_FUNCTION void +debug (affine_iv *iv) +{ + dump_affine_iv (stderr, iv); + fputc ('\n', stderr); +} + /* Determine the number of iterations according to condition (for staying inside loop) which compares two induction variables using comparison operator CODE. The induction variable on left side of the comparison diff --git a/gcc/tree-ssa-operands.cc b/gcc/tree-ssa-operands.cc index a5970ac..c32cb36 100644 --- a/gcc/tree-ssa-operands.cc +++ b/gcc/tree-ssa-operands.cc @@ -1416,3 +1416,23 @@ single_imm_use_1 (const ssa_use_operand_t *head, return single_use; } +/* Gather all stmts SSAVAR is used on, eliminating duplicates. */ + +auto_vec<gimple *, 2> +gather_imm_use_stmts (tree ssavar) +{ + auto_vec<gimple *, 2> stmts; + imm_use_iterator iter; + use_operand_p use_p; + FOR_EACH_IMM_USE_FAST (use_p, iter, ssavar) + { + gimple *use_stmt = USE_STMT (use_p); + if (use_stmt->ilf) + continue; + use_stmt->ilf = 1; + stmts.safe_push (use_stmt); + } + for (gimple *use_stmt : stmts) + use_stmt->ilf = 0; + return stmts; +} diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc index b8e6a71..29d97cf 100644 --- a/gcc/tree-vect-generic.cc +++ b/gcc/tree-vect-generic.cc @@ -1619,24 +1619,6 @@ lower_vec_perm (gimple_stmt_iterator *gsi) update_stmt (gsi_stmt (*gsi)); } -/* If OP is a uniform vector return the element it is a splat from. */ - -static tree -ssa_uniform_vector_p (tree op) -{ - if (TREE_CODE (op) == VECTOR_CST - || TREE_CODE (op) == VEC_DUPLICATE_EXPR - || TREE_CODE (op) == CONSTRUCTOR) - return uniform_vector_p (op); - if (TREE_CODE (op) == SSA_NAME) - { - gimple *def_stmt = SSA_NAME_DEF_STMT (op); - if (gimple_assign_single_p (def_stmt)) - return uniform_vector_p (gimple_assign_rhs1 (def_stmt)); - } - return NULL_TREE; -} - /* Return the type that should be used to implement OP on type TYPE. This is TYPE itself if the target can do the operation directly, otherwise it is a scalar type or a smaller vector type. */ diff --git a/gcc/tree.cc b/gcc/tree.cc index 446261a..298784e 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -10823,6 +10823,24 @@ uniform_vector_p (const_tree vec) return NULL_TREE; } +/* If OP is a uniform vector return the element it is a splat from. */ + +tree +ssa_uniform_vector_p (tree op) +{ + if (TREE_CODE (op) == VECTOR_CST + || TREE_CODE (op) == VEC_DUPLICATE_EXPR + || TREE_CODE (op) == CONSTRUCTOR) + return uniform_vector_p (op); + if (TREE_CODE (op) == SSA_NAME) + { + gimple *def_stmt = SSA_NAME_DEF_STMT (op); + if (gimple_assign_single_p (def_stmt)) + return uniform_vector_p (gimple_assign_rhs1 (def_stmt)); + } + return NULL_TREE; +} + /* If the argument is INTEGER_CST, return it. If the argument is vector with all elements the same INTEGER_CST, return that INTEGER_CST. Otherwise return NULL_TREE. @@ -5303,6 +5303,10 @@ extern tree vector_cst_elt (const_tree, unsigned int); extern tree uniform_vector_p (const_tree); +/* Same as above, but if VEC is an SSA_NAME, inspect its definition. */ + +extern tree ssa_uniform_vector_p (tree); + /* If the argument is INTEGER_CST, return it. If the argument is vector with all elements the same INTEGER_CST, return that INTEGER_CST. Otherwise return NULL_TREE. */ |
