Age | Commit message (Collapse) | Author | Files | Lines |
|
This patch both makes GNAT emit warnings on unused assignments where previously
they were suppressed for obscure reasons and synchronizes routine
Get_Enclosing_Object with a similar routine in GNATprove (which differs in
handling of explicit dereferences).
gcc/ada/ChangeLog:
* sem_util.adb (Get_Enclosing_Object): Traverse unchecked type
conversions since they from the compiler and should be transparent for
semantic reasoning.
|
|
Add to the previous fix for this issue to better handle cases where
GNATProve calls Einfo.Utils.Predicate_Function, passing in an Itype.
gcc/ada/ChangeLog:
* einfo-utils.adb (Predicate_Function): Look through an Itype if
that takes us to another subtype of the same type.
|
|
The initial set of changes for doing proper mapping of calls to primitive
functions in Pre/Post'Class aspects inherited by derived types was not
handling some cases (such as when formals are referenced as part of
dereferences, certain aspects such as 'Old and 'Access, and conditional
and declare expressions), and mishandling other cases (such as nested
function calls).
This set of changes attempts to properly address those cases. It also
includes a change to suppress unneeded (and sometimes wrong) accessibility
checks on conversions of actual parameters of a derived type to the parent
type when passing them on calls to parent primitives (encountered while
developing these changes).
gcc/ada/ChangeLog:
* exp_util.adb (Must_Map_Call_To_Parent_Primitive): Change function
name (was Call_To_Parent_Dispatching_Op_Must_Be_Mapped). Move logic
for attributes and dereferences, plus testing for controlled formals,
into new function Expr_Has_Ctrl_Formal_Ref. Add handling for
access attributes, multiple levels of attributes/dereferences,
conditional_expressions, and declare_expressions. Properly account
for function calls with multiple operands and enclosing calls.
(Expr_Has_Ctrl_Formal_Ref): New function to determine whether
an expression is a reference to a controlling formal or has
a prefix that is such a reference.
(Is_Controlling_Formal_Ref): New function in Expr_Has_Ctrl_Formal_Ref
to determine if a node is a direct reference to a controlling formal.
* freeze.adb (Build_DTW_Body): Create an unchecked conversion instead
of a regular type conversion for converting actuals in calls to parent
inherited primitives that are wrapped for inherited pre/postconditions.
Avoids generating unnecessary checks (such as accessibility checks on
conversions for anonymous access formals).
|
|
Detection of ghost entities work similarly for names of objects (in assignment
statements) and for names of subprograms (in subprogram calls). Tune routine
name and its comment to match this similarity.
gcc/ada/ChangeLog:
* sem_util.ads (Get_Enclosing_Ghost_Entity): Rename spec.
* sem_util.adb (Get_Enclosing_Ghost_Object): Rename body; reorder
alphabetically; adapt recursive call.
* ghost.adb: Adapt calls to Get_Enclosing_Ghost_Object.
|
|
When name of a called procedure involves unusual constructs, e.g. type
conversions (like in "Typ (Obj).all"), we must look at the outermost construct
to decide whether the name denotes a ghost entity.
gcc/ada/ChangeLog:
* ghost.adb (Ghost_Entity): Remove; use Get_Enclosing_Ghost_Object
instead; adapt callers.
|
|
This happens when the record type has an incomplete declaration before its
full declaration and is fixed by calling Find_Type appropriately.
gcc/ada/ChangeLog:
* sem_prag.adb (Analyze_Pragma) <Pragma_No_Component_Reordering>:
Call Find_Type on the first argument of the pragma.
|
|
gcc/ada/ChangeLog:
* gnatls.adb: remove -l switch
|
|
Update GNAT RM documentation of the Size'Class aspect.
gcc/ada/ChangeLog:
* doc/gnat_rm/gnat_language_extensions.rst: Update documentation for
mutably tagged types and the Size'Class aspect.
* gnat_rm.texi: Regenerate.
|
|
Remove duplicated and inconsistent code for detecting ghost objects on the
left-hand side of assignment statements. Fix detection in the presence of
attribute references (e.g. "X'Access.all"), function calls (e.g. "F.all"),
qualified expressions (e.g. "T'(new Integer'(0)).all") and unchecked type
conversions (which come from expansion).
gcc/ada/ChangeLog:
* ghost.adb
(Whole_Object_Ref): Remove; use Get_Enclosing_Ghost_Object instead.
(Is_Ghost_Assignment): Handle more than object identifiers.
(Mark_And_Set_Ghost_Assignment): Likewise.
* sem_util.adb (Get_Enclosing_Ghost_Object): Detect more expressions
as ghost references; rename to better match the intended meaning.
* sem_util.ads (Get_Enclosing_Ghost_Object): Rename; adjust comment.
|
|
It exposed a small loophole in the Backend_Processing_Possible predicate.
gcc/ada/ChangeLog:
* exp_aggr.adb (Backend_Processing_Possible.Component_Check): Return
False for delayed conditional expressions.
|
|
...in aggregates. This prevents a temporary from being created on the
primary stack to hold the result of the function calls before it is copied
to the component of the aggregate in the nonlimited by-reference case.
This requires a small tweak to Check_Function_Writable_Actuals to avoid
giving a spurious error in a specific case.
gcc/ada/ChangeLog:
* exp_aggr.ads (Parent_Is_Regular_Aggregate): New predicate.
* exp_aggr.adb (In_Place_Assign_OK.Safe_Component): Implement more
accurate criterion for function calls.
(Convert_To_Assignments): Use Parent_Is_Regular_Aggregate predicate.
(Expand_Array_Aggregate): Likewise. Remove obsolete comment.
(Initialize_Component): Do not adjust when the expression is a naked
function call and Back_End_Return_Slot is True.
(Parent_Is_Regular_Aggregate): New predicate.
* exp_ch3.adb (Build_Record_Init_Proc.Build_Assignment): Add test of
Back_End_Return_Slot in conjunction with a function call.
* exp_ch4.adb (Expand_Allocator_Expression): Likewise. Use the
Is_Container_Aggregate predicate to detect container aggregates.
(Expand_N_Case_Expression): Delay the expansion if the parent is a
regular aggregate and the type should not be copied.
(Expand_N_If_Expression): Likewise.
(New_Assign_Copy): New function.
* exp_ch6.adb (Expand_Ctrl_Function_Call): Bail out when the parent
is a regular aggregate.
* sem_util.adb (Check_Function_Writable_Actuals): Do not take into
account attribute references created by the compiler.
|
|
GCC 14 is stricter about type conversions. Taking the address of an
array and decaying the array to a pointer to its first element yield
the same address, but the types are no longer considered compatible.
The socket data structures want decayed pointers rather than addresses
of arrays, so drop the '&'s.
gcc/ada/ChangeLog:
* socket.c [__vxworks]
(__gnat_gethostbyname): Drop excess '&'.
(__gnat_gethostbyaddr): Likewise.
|
|
A vxworks-specific part of adaint.c calls isalpha without including
ctype.h. gcc-14 rejects calls of undeclared functions. Include the
required header file when compiling for vxworks.
gcc/ada/ChangeLog:
* adaint.c [__vxworks]: Include ctype.h.
|
|
If a type T has a partial view with a known_discriminant_part and no
user-specified Put_Image aspect specification, then the output generated
by T'Put_Image would incorrectly omit the discriminant values.
gcc/ada/ChangeLog:
* exp_put_image.adb (Build_Record_Put_Image_Procedure): If
Discriminant_Specifications takes us from the full view of a type
to an (intentionally) unanalyzed subtree, then instead find
discriminant entities by calling Discriminant_Specifications on
the partial view of the type.
|
|
This patch fixes a crash on some subprograms with anonymous
access-to-subprogram parameters by removing delayed freezing of
subprograms in some cases where it wasn't necessary. The -gnatD output
for itypes is also improved.
gcc/ada/ChangeLog:
* sem_ch6.adb (Check_Delayed_Subprogram, Possible_Freeze): Restrict
cases where freezing is delayed.
* sem_ch6.ads (Check_Delayed_Subprogram): Improve documentation
comment.
* sprint.adb (Write_Itype): Improve output.
|
|
The second condition of the conjunction is redundant with the first.
gcc/ada/ChangeLog:
* libgnat/s-valrea.adb (Integer_to_Real): Rename to...
(Integer_To_Real): ...this. Remove the second condition of the
conjunction in the test for the zero value.
(Scan_Real): Adjust to above renaming.
(Value_Real): Likewise.
* libgnat/s-valuer.ads (Scan_Raw_Real): Add note about Val.
|
|
gcc/ada/ChangeLog:
* doc/gnat_ugn/gnat_and_program_execution.rst: Fix a
couple of minor formatting issues.
* gnat_ugn.texi: Regenerate.
|
|
This patchs adds two pn-like subprograms that print entity chains.
gcc/ada/ChangeLog:
* treepr.ads (Print_Entity_Chain, pec, rpec): New subprograms.
* treepr.adb (Print_Entity_Chain, pec, rpec): Likewise.
|
|
gcc/ada/ChangeLog:
* atree.ads (Parent_Or_List_Containing): Fix typo.
|
|
Before this patch, Print_Node failed to honor its Prefix_Char formal
parameter when printing the Parent field. This had no consequences
because Prefix_Char was only used to print members of Nlists, and those
don't have a parent in the tree. But this patch fixes it anyway in
preparation for new debug printing features.
gcc/ada/ChangeLog:
* treepr.adb (Print_Node): Tweak Parent field printing.
|
|
gcc/ada/ChangeLog:
* doc/gnat_ugn/gnat_and_program_execution.rst: Add the
documentation about using sanitizers with Ada code.
* gnat_ugn.texi: Regenerate.
|
|
gcc/ada/ChangeLog:
* doc/gnat_ugn/gnat_and_program_execution.rst: Add the
documentation about using sanitizers with Ada code.
* gnat_ugn.texi: Regenerate.
|
|
The dead branch in routine Get_Enclosing_Object was most likely some
experiment from the early days of GNATprove. This routine is meant
to be called with the LHS of an assignment statement where an implicit
dereference is always rewritten into explicit one, regardless if code
is generated.
gcc/ada/ChangeLog:
* sem_util.adb (Get_Enclosing_Object): Remove dead code.
|
|
Clean up problematic interactions between Itype subtypes and predicates,
which were causing required predicate checks to be (incorrectly) omitted.
gcc/ada/ChangeLog:
* einfo-utils.adb (Predicate_Function): Improve handling of a case
where a predicate specified for a subtype of a partial view of a
type was incorrectly ignored.
(Set_Predicate_Function): If the attribute has already been set to
the same value, then do nothing (instead of raising P_E).
* sem_ch13.adb (Build_Predicate_Function): Add new function
Has_Source_Predicate. If a subtype inherits a predicate but also
has its own explicitly specified predicate, then avoid
misinterpreting the presence of the function built for the
inherited predicate to mean that no additional predicate function
is needed.
* sem_util.adb (Build_Subtype): In the case where we are given a
constrained record or array subtype and we need to construct a
different subtype, subject to a different constraint, the
subtype_mark of the constructed subtype needs to reference an
unconstrained subtype (because a new constraint is going to be
imposed). If the Predicated_Parent attribute of the given subtype
is present and refers to a suitable unconstrained subtype, then
use that subtype instead of setting the Predicated_Parent
attribute on a new node (and performing the associated attribute
copying).
|
|
That's a regression introduced by the rewrite of the finalization machinery,
in the form of dangling references to Master_Node entities remaining in the
tree after the removal of the ignored Ghost code.
gcc/ada/ChangeLog:
* exp_ch7.adb (Process_Transient_In_Scope): Bail out if the object
is an ignored ghost entity.
|
|
This happens for the default expression of a controlled component when an
aggregate is used for the record type, because of a freeze node generated
for the expression within an artificial block that is needed to implement
the cleanup actions attached to the assignment of the component.
This is fixed by extending the special treatment applied to freeze nodes
by Insert_Actions, in the case of loops generated for aggregates, to the
case of blocks generated for aggregates.
gcc/ada/ChangeLog:
* exp_util.adb (Insert_Actions): Extend special treatment applied
to freeze nodes to the case of blocks generated for aggregates.
|
|
The Ada coding style requires the use of short circuit forms in
if-statements. Use this form consistently for all if-statements.
gcc/ada/ChangeLog:
* libgnat/s-valuer.adb: Switch missing if-statements to
short-circuit form.
* libgnat/i-cpoint.adb: Ditto.
|
|
PR109116 reveals missed optimizations when using unspecs to extract
vector components from opaque-mode variables. Since RTL optimizers do
not understand unspecs, this leads to redundant register copies. Replace
unspecs with subregs, which are well understood by RTL passes, allowing
optimizations to take place.
2025-06-30 Peter Bergner <bergner@linux.ibm.com>
gcc/
PR target/109116
* config/rs6000/mma.md (unspec): Delete UNSPEC_MMA_EXTRACT.
(vsx_disassemble_pair): Expand into a vector register sized subreg.
(mma_disassemble_acc): Likewise.
(*vsx_disassemble_pair): Delete.
(*mma_disassemble_acc): Likewise.
|
|
Most testcase in rvv folder already ignore -Oz, but some of them
are not. This patch makes them consistent.
gcc/testsuite/ChangeLog.
* gcc.target/riscv/rvv/vsetvl/avl_single-21.c: Ignore -Oz.
* gcc.target/riscv/rvv/vsetvl/avl_single-26.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-36.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-39.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/avl_single-41.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvl-22.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-15.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-2.c: Ditto.
* gcc.target/riscv/rvv/vsetvl/vsetvlmax-4.c: Ditto.
|
|
This commit introduces a primary vector pipeline model for the SiFive 7
series, that pipeline model is kind of simplified version, it only
defined vector command queue, arithmetic unit, and vector load store
unit.
The latency of real hardware is LMUL-aware, but I realize that will
complicate the model a lots, so I just use a simplified version, which
all LMUL use same latency, we may improve it later once we have found
meaningful performance difference.
gcc/ChangeLog:
* config/riscv/sifive-7.md: Add primary vector pipeline model
for SiFive 7 series.
|
|
pipeline model [PR120659]
gcc/ChangeLog:
PR target/120659
* config/riscv/sifive-7.md: Add B extension, fp16 and missing
scalar instruction type for sifive-7 pipeline model.
gcc/testsuite/ChangeLog:
PR target/120659
* gcc.target/riscv/pr120659.c: New test.
|
|
The following adds SLP build operand swapping for .FMA which is
a ternary operator and a call. The current code only handles
binary operators in assignments, thus the patch extends this to
handle both calls and assignments as well as binary and ternary
operators.
* tree-vect-slp.cc (vect_build_slp_2): Handle ternary
and call operators when swapping operands.
* gcc.target/i386/vect-pr82426.c: Pass explicit -ffp-contract=fast.
* gcc.target/i386/vect-pr82426-2.c: New testcase variant with
-ffp-contract=on.
|
|
This pattern enables the combine pass (or late-combine, depending on the case)
to merge a vec_duplicate into a (possibly negated) minus-mult RTL instruction.
Before this patch, we have two instructions, e.g.:
vfmv.v.f v6,fa0
vfnmacc.vv v2,v6,v4
After, we get only one:
vfnmacc.vf v2,fa0,v4
PR target/119100
gcc/ChangeLog:
* config/riscv/autovec-opt.md (*vfnmsub_<mode>,*vfnmadd_<mode>): Handle
both add and acc variants.
* config/riscv/vector.md (*pred_mul_neg_<optab><mode>_scalar_undef): New
pattern.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f16.c: Add vfnmacc and
vfnmsac.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-1-f64.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-2-f64.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-3-f64.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f16.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f32.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf-4-f64.c: Likewise.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_mulop.h (DEF_VF_MULOP_CASE_1):
Fix return type.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmacc-run-1-f16.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmacc-run-1-f32.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmacc-run-1-f64.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsac-run-1-f16.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsac-run-1-f32.c: New test.
* gcc.target/riscv/rvv/autovec/vx_vf/vf_vfnmsac-run-1-f64.c: New test.
|
|
This adds support for -mcpu=gb10. This is a big.LITTLE configuration
involving Cortex-X925 and Cortex-A725 cores. The appropriate MIDR numbers
are added to detect them in -mcpu=native. We did not add an
-mcpu=cortex-x925.cortex-a725 option because GB10 does include the crypto
instructions which we want on by default, and the current convention is to not
enable such extensions for Arm Cortex cores in -mcpu where they are optional
in the IP.
Bootstrapped and tested on aarch64-none-linux-gnu.
Signed-off-by: Kyrylo Tkachov <ktkachov@nvidia.com>
gcc/
* config/aarch64/aarch64-cores.def (gb10): New entry.
* config/aarch64/aarch64-tune.md: Regenerate.
* doc/invoke.texi (AArch64 Options): Document the above.
|
|
C2Y voted in the
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3466.pdf
paper, which clarifies some of the conditional nonnull cases.
For strncat/__strncat_chk no changes are necessary, we already
use __attribute__((nonnull (1), nonnull_if_nonzero (2, 3))) attributes
on the builtin and glibc can do the same too, meaning that first
argument must be nonnull always and second must be nonnull if
the third one is nonzero.
The problem is with the fread/fwrite changes, where the paper adds:
If size or nmemb is zero,
+ptr may be a null pointer,
fread returns zero and the contents of the array and the state of
the stream remain unchanged.
and ditto for fwrite, so the two argument nonnull_if_nonzero attribute
isn't usable to express that, because whether the pointer can be null
depends on 2 integral arguments rather than one.
The following patch extends the nonnull_if_nonzero attribute, so that
instead of requiring 2 arguments it allows 2 or 3, the first one
is still the pointer argument index which sometimes must not be null
and the other one or two are integral arguments, if there are 2, the
invalid case is only if pointer is null and both the integral arguments
are nonzero.
2025-06-30 Jakub Jelinek <jakub@redhat.com>
PR c/120520
PR c/117023
gcc/
* builtin-attrs.def (DEF_LIST_INT_INT_INT): Define it and
use for 1,2,3.
(ATTR_NONNULL_IF123_LIST): New DEF_ATTR_TREE_LIST.
(ATTR_NONNULL_4_IF123_LIST): Likewise.
* builtins.def (BUILT_IN_FWRITE): Use ATTR_NONNULL_4_IF123_LIST
instead of ATTR_NONNULL_LIST.
(BUILT_IN_FWRITE_UNLOCKED): Likewise.
* gimple.h (infer_nonnull_range_by_attribute): Add another optional
tree * argument defaulted to NULL.
* gimple.cc (infer_nonnull_range_by_attribute): Add OP3 argument,
handle 3 argument nonnull_if_nonzero attribute.
* builtins.cc (validate_arglist): Handle 3 argument nonnull_if_nonzero
attribute.
* tree-ssa-ccp.cc (pass_post_ipa_warn::execute): Likewise.
* ubsan.cc (instrument_nonnull_arg): Adjust
infer_nonnull_range_by_attribute caller, handle 3 argument
nonnull_if_nonzero attribute.
* gimple-range-infer.cc (gimple_infer_range::gimple_infer_range):
Handle 3 argument nonnull_if_nonzero attribute.
* doc/extend.texi (nonnull_if_nonzero): Document 3 argument version
of the attribute.
gcc/c-family/
* c-attribs.cc (c_common_gnu_attributes): Allow 2 or 3 arguments for
nonnull_if_nonzero attribute instead of only 2.
(handle_nonnull_if_nonzero_attribute): Handle 3 argument
nonnull_if_nonzero.
* c-common.cc (struct nonnull_arg_ctx): Rename other member to other1,
add other2 member.
(check_function_nonnull): Clear a if nonnull attribute has an
argument. Adjust for nonnull_arg_ctx changes. Handle 3 argument
nonnull_if_nonzero attribute.
(check_nonnull_arg): Adjust for nonnull_arg_ctx changes, emit different
diagnostics for 3 argument nonnull_if_nonzero attributes.
(check_function_arguments): Adjust ctx var initialization.
gcc/analyzer/
* sm-malloc.cc (malloc_state_machine::on_stmt): Handle 3 argument
nonnull_if_nonzero attribute.
gcc/testsuite/
* gcc.dg/nonnull-9.c: Tweak for 3 argument nonnull_if_nonzero
attribute support, add further tests.
* gcc.dg/nonnull-12.c: New test.
* gcc.dg/nonnull-13.c: New test.
* gcc.dg/nonnull-14.c: New test.
* c-c++-common/ubsan/nonnull-8.c: New test.
* c-c++-common/ubsan/nonnull-9.c: New test.
|
|
lra-eliminations.cc:move_plus_up tries to:
Transform (subreg (plus reg const)) to (plus (subreg reg) const)
when it is possible.
Most of it is heavily conditional:
if (!paradoxical_subreg_p (x)
&& GET_CODE (subreg_reg) == PLUS
&& CONSTANT_P (XEXP (subreg_reg, 1))
&& GET_MODE_CLASS (x_mode) == MODE_INT
&& GET_MODE_CLASS (subreg_reg_mode) == MODE_INT)
{
rtx cst = simplify_subreg (x_mode, XEXP (subreg_reg, 1), subreg_reg_mode,
subreg_lowpart_offset (x_mode,
subreg_reg_mode));
if (cst && CONSTANT_P (cst))
but the final:
return gen_rtx_PLUS (x_mode, lowpart_subreg (x_mode,
XEXP (subreg_reg, 0),
subreg_reg_mode), cst);
assumed without checking that lowpart_subreg succeeded. In the PR,
this led to creating a PLUS with a null operand.
In more detail, the testcase had:
(var_location a (plus:SI (subreg:SI (reg/f:DI 64 sfp) 0)
(const_int -4 [0xfffffffffffffffc])))
with sfp being eliminated to (plus:DI (reg:DI sp) (const_int 16)).
Initially, during the !subst_p phase, lra_eliminate_regs_1 sees
the PLUS and recurses into each operand. The recursive call sees
the SUBREG and recurses into the SUBREG_REG. Since !subst_p,
this final recursive call replaces (reg:DI sfp) with:
(plus:DI (reg:DI sfp) (const_int 16))
(i.e. keeping the base register the same). So the SUBREG is
eliminated to:
(subreg:SI (plus:DI (reg:DI sfp) (const_int 16)) 0)
The PLUS handling in lra_eliminate_regs_1 then passes this to
move_plus_up, which tries to push the SUBREG into the PLUS.
This means trying to create:
(plus:SI (simplify_gen_subreg:SI (reg:DI sfp) 0) (const_int 16))
The simplify_gen_subreg then returns null, because simplify_subreg_regno
fails both with allow_stack_regs==false (when trying to simplify the
SUBREG to a REG) and with allow_stack_regs=true (when validating
whether the SUBREG can be generated). And that in turn happens
because aarch64 refuses to allow SImode to be stored in sfp:
if (regno == SP_REGNUM)
/* The purpose of comparing with ptr_mode is to support the
global register variable associated with the stack pointer
register via the syntax of asm ("wsp") in ILP32. */
return mode == Pmode || mode == ptr_mode;
if (regno == FRAME_POINTER_REGNUM || regno == ARG_POINTER_REGNUM)
return mode == Pmode;
This seems dubious. If the frame pointer can hold a DImode value then it
can also hold an SImode value. There might be limited cases when the low
32 bits of the frame pointer are useful, but aarch64_hard_regno_mode_ok
doesn't have the context to second-guess things like that. It seemed
from a quick scan of other targets that they behave more as I'd expect.
So there might be a target bug here too. But it seemed worth fixing the
unchecked use of lowpart_subreg independently of that.
The patch fixes an existing ICE in gcc.c-torture/compile/pass.c.
gcc/
PR rtl-optimization/120733
* lra-eliminations.cc (move_plus_up): Check whether lowpart_subreg
returns null.
|
|
This patch re-adds logic to increase counts of annotated basic blocks if otherwise
the Kirhoff law can not be solved. This is done only in easy cases where total
count of in or out edges is smaller than the count of BB or when BB has single
exit which is annotated by small count.
This helps to solve problems seen i.e. in parest where header of loops gets too
low count because vectorizer replaced the IV condiitonal and did not preserved
debug info. We should solve the debug info issues as well, and simiar problems
can now be tracked by in afdo debug dumps.
gcc/ChangeLog:
* auto-profile.cc (autofdo_source_profile::offline_external_functions):
Add missing newline in dump.
(afdo_propagate_edge): If annotated BB or edge has too small count
bump it up to mitigate profile imprecisions caused by vectorizer.
(afdo_propagate): Increase number of iteraitons and fix dump
|
|
We are missing discriminator info in auto-profiles, for example in exchange2.
I am not sure why, since I see the info still present in dwarf2out, so it may
be bug at create_gcov side.
This patch makes the workaround to ouptput better diagnostics (to actually show
the soruce location). This needs promotion of location info through the inline
stack API, so I turned it from pair to actual structure. Overall I think pairs
are overused in this source and makes it harder to read.
Bootstrapped/regtested x86_64-linux, comitted.
gcc/ChangeLog:
* auto-profile.cc (struct decl_lineno): Turn to structure; add
location.
(dump_inline_stack): Update.
(get_inline_stack): Update.
(get_relative_location_for_locus): Fixup formating.
(function_instance::get_function_instance_by_decl): Add
LOCATION parameter; improve dumping.
(autofdo_source_profile::get_callsite_total_count): Improve dumping;
update.
(walk_block): Update.
(autofdo_source_profile::offline_unrealized_inlines): Update.
(autofdo_source_profile::get_count_info): Update.
|
|
Update functions with no_callee_saved_registers/preserve_none attribute
to preserve frame pointer since caller may use it to save the current
stack:
pushq %rbp
movq %rsp, %rbp
...
call function
...
leave
ret
If callee changes frame pointer without restoring it, caller will fail
to restore its stack after callee returns as LEAVE does
mov %rbp, %rsp
pop %rbp
The corrupted frame pointer will corrupt stack pointer in caller.
There are no regressions on Linux/x86-64. Also tested with
https://github.com/python/cpython
configured with "./configure --with-tail-call-interp".
gcc/
PR target/120840
* config/i386/i386-expand.cc (ix86_expand_call): Don't mark
hard frame pointer as clobber.
* config/i386/i386-options.cc (ix86_set_func_type): Use
TYPE_NO_CALLEE_SAVED_REGISTERS instead of
TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP.
* config/i386/i386.cc (ix86_function_ok_for_sibcall): Remove the
TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP check.
(ix86_save_reg): Merge TYPE_NO_CALLEE_SAVED_REGISTERS and
TYPE_PRESERVE_NONE with TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP.
* config/i386/i386.h (call_saved_registers_type): Remove
TYPE_NO_CALLEE_SAVED_REGISTERS_EXCEPT_BP.
* doc/extend.texi: Update no_callee_saved_registers documentation.
gcc/testsuite/
PR target/120840
* gcc.target/i386/no-callee-saved-1.c: Updated.
* gcc.target/i386/no-callee-saved-2.c: Likewise.
* gcc.target/i386/no-callee-saved-7.c: Likewise.
* gcc.target/i386/no-callee-saved-8.c: Likewise.
* gcc.target/i386/no-callee-saved-9.c: Likewise.
* gcc.target/i386/no-callee-saved-10.c: Likewise.
* gcc.target/i386/no-callee-saved-18.c: Likewise.
* gcc.target/i386/no-callee-saved-19a.c: Likewise.
* gcc.target/i386/no-callee-saved-19c.c: Likewise.
* gcc.target/i386/no-callee-saved-19d.c: Likewise.
* gcc.target/i386/pr119784a.c: Likewise.
* gcc.target/i386/preserve-none-6.c: Likewise.
* gcc.target/i386/preserve-none-7.c: Likewise.
* gcc.target/i386/preserve-none-12.c: Likewise.
* gcc.target/i386/preserve-none-13.c: Likewise.
* gcc.target/i386/preserve-none-14.c: Likewise.
* gcc.target/i386/preserve-none-15.c: Likewise.
* gcc.target/i386/preserve-none-23.c: Likewise.
* gcc.target/i386/pr120840-1a.c: New test.
* gcc.target/i386/pr120840-1b.c: Likewise.
* gcc.target/i386/pr120840-1c.c: Likewise.
* gcc.target/i386/pr120840-1d.c: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
The current implementation of this function is somewhat difficult to
understand, as it uses a direct break statement within the for loop,
rendering the loop meaningless. Additionally, during the Coverity check
on the for loop, a warning appeared: "unreachable: Since the loop
increment ix++; is unreachable, the loop body will never execute more
than once." Therefore, I have made some simple refactoring to address
these issues.
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc (bitmap_union_of_preds_with_entry):
Refactor.
Signed-off-by: Jin Ma <jinma@linux.alibaba.com>
|
|
Pipeline checker utility for RISC-V architecture that validates processor
pipeline models. This tool analyzes machine description files to ensure all
instruction types are properly handled by pipeline scheduling models.
I write this tool since I am implment vector pipeline stuff for SiFive
core, but it's hard to find which instruction type is not handled by
pipeline scheduling models. This tool will help me to find out which
instruction type is not handled by pipeline scheduling models, so I can
fix them.
And I think it may be useful for other RISC-V core developers, so I
decided to upstream that :)
Usage:
```
./pipeline-checker <your-pipeline-model>
```
Example:
```
$ ./pipeline-checker sifive-7.md
Error: Some types are not consumed by the pipemodel
Missing types:
{'vfclass', 'vimovxv', 'vmov', 'rdfrm', 'wrfrm', 'ghost', 'wrvxrm', 'crypto', 'vwsll', 'vfmovfv', 'vimovvx', 'sf_vc', 'vfmovvf', 'sf_vc_se', 'rdvlenb', 'vbrev', 'vrev8', 'sf_vqmacc', 'sf_vfnrclip', 'vsetvl_pre', 'rdvl', 'vsetvl'}
```
gcc/ChangeLog:
* config/riscv/pipeline-checker: New file.
|
|
|
|
This patch provides GetFileName procedure function for
FIO.File, FileSystem.File and IOChan.ChanId. The
return result from these procedures can be passed into
StringFileSysOp.Unlink to complete the required delete.
gcc/m2/ChangeLog:
PR modula2/117203
* gm2-libs-log/FileSystem.def (GetFileName): New
procedure function.
(WriteString): New procedure.
* gm2-libs-log/FileSystem.mod (GetFileName): New
procedure function.
(WriteString): New procedure.
* gm2-libs/SFIO.def (GetFileName): New procedure function.
* gm2-libs/SFIO.mod (GetFileName): New procedure function.
* gm2-libs-iso/IOChanUtils.def: New file.
* gm2-libs-iso/IOChanUtils.mod: New file.
libgm2/ChangeLog:
PR modula2/117203
* libm2iso/Makefile.am (M2DEFS): Add IOChanUtils.def.
(M2MODS): Add IOChanUtils.mod.
* libm2iso/Makefile.in: Regenerate.
gcc/testsuite/ChangeLog:
PR modula2/117203
* gm2/isolib/run/pass/testdelete2.mod: New test.
* gm2/pimlib/logitech/run/pass/testdelete2.mod: New test.
* gm2/pimlib/run/pass/testdelete.mod: New test.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
|
|
Scan "lea(l|q)", instead of "leaq", to support x32.
* gcc.target/i386/shrink_wrap_separate_check_lea.c: Scan
"lea(l|q)", instead of "leaq".
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
Because COBOL doesn't require function prototypes, it is possible to, for
example,
CALL "getcwd" USING <parameters>
and then later
CALL "getcwd" USING <parameters> RETURNING <alphanumeric>
The second call "knows" that the return value is a char*, but the first one
does not. So, the first one gets a default return value type of SSIZE_t, which
later needs to be replaced with CHAR_P.
These [all too] extensive changes ensure that all references to a particular
function use the same function_decl, and take measures to make sure that one
function_decl is back-modified, if necessary, with the best return value type.
gcc/cobol/ChangeLog:
* Make-lang.in: Incorporate gcobol.clean.
* except.cc (cbl_enabled_exceptions_t::dump): Update debug message.
* genapi.cc (gg_attribute_bit_get): Formatting.
(file_static_variable): Formatting.
(trace1_init): Formatting.
(build_main_that_calls_something): Normalize function_decl use.
(parser_call_target): Likewise.
(set_call_convention): Likewise.
(parser_call_target_convention): Likewise.
(parser_call_targets_dump): Likewise.
(function_handle_from_name): Likewise.
(function_pointer_from_name): Likewise.
(parser_initialize_programs): Likewise.
(parser_statement_begin): Formatting.
(parser_leave_file): Use function_decl FIFO.
(enter_program_common): Normalize function_decl use.
(parser_enter_program): Normalize function_decl use.
(tree_type_from_field_type): Normalize function_decl use.
(is_valuable): Comment.
(pe_stuff): Change name to program_end_stuff.
(program_end_stuff): Likewise.
(parser_exit): Likewise.
(parser_division): Normalize function_decl use.
(create_and_call): Normalize function_decl use.
(parser_call): Normalize function_decl use.
(parser_set_pointers): Normalize function_decl use.
(parser_program_hierarchy): Normalize function_decl use.
(psa_FldLiteralA): Defeat attempt to re-use literals. (Fails on some aarch64).
(parser_symbol_add): Error message formatting.
* genapi.h: Formatting.
* gengen.cc (struct cbl_translation_unit_t): Add function_decl FIFO.
(show_type): Rename to gg_show_type.
(gg_show_type): Correct an error message.
(gg_assign): Formatting; change error handling.
(gg_modify_function_type): Normalize function_decl use.
(gg_define_function_with_no_parameters): Fold into gg_defint_function().
(function_decl_key): Normalize function_decl use.
(gg_peek_fn_decl): Normalize function_decl use.
(gg_build_fn_decl): Normalize function_decl use.
(gg_define_function): Normalize function_decl use.
(gg_tack_on_function_parameters): Remove.
(gg_finalize_function): Normalize function_decl use.
(gg_leaving_the_source_code_file): Normalize function_decl use.
(gg_call_expr_list): Normalize function_decl use.
(gg_trans_unit_var_decl): Normalize function_decl use.
(gg_insert_into_assemblerf): New function; formatting.
* gengen.h (struct gg_function_t): Eliminate "is_truly_nested" flag.
(gg_assign): Incorporate return value.
(gg_define_function): Normalize function_decl use.
(gg_define_function_with_no_parameters): Eliminate.
(gg_build_fn_decl): Normalize function_decl use.
(gg_peek_fn_decl): Normalize function_decl use.
(gg_modify_function_type): Normalize function_decl use.
(gg_call_expr_list): Normalize function_decl use.
(gg_get_function_decl): Normalize function_decl use.
(location_from_lineno): Prefix with "extern".
(gg_open): Likewise.
(gg_close): Likewise.
(gg_get_indirect_reference): Likewise.
(gg_insert_into_assembler): Likewise.
(gg_insert_into_assemblerf): Likewise.
(gg_show_type): New declaration.
(gg_leaving_the_source_code_file): New declaration.
* parse.y: Format debugging message.
* parse_ante.h: Normalize function_decl use.
|
|
|
|
Add "void debug (tree)" to support:
(gdb) call debug (expr)
<parm_decl 0x7fffe9810bb0 f
type <record_type 0x7fffe99cec78 c BLK
size <integer_cst 0x7fffe98242d0 constant 256>
unit-size <integer_cst 0x7fffe98243a8 constant 32>
user align:256 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7fffe99cebd0
fields <field_decl 0x7fffe98318c0 a type <real_type 0x7fffe982a3f0 long double>
XF x.c:2:15
size <integer_cst 0x7fffe9802fa8 constant 128>
unit-size <integer_cst 0x7fffe9802fc0 constant 16>
align:128 warn_if_not_align:0 offset_align 128 decl_not_flexarray: 1
offset <integer_cst 0x7fffe9802f90 constant 0>
bit-offset <integer_cst 0x7fffe9802fd8 constant 0> context <record_type 0x7fffe99cebd0> chain <field_decl 0x7fffe9831960 b>>>
used read BLK x.c:7:6 size <integer_cst 0x7fffe98242d0 256> unit-size <integer_cst 0x7fffe98243a8 32>
align:256 warn_if_not_align:0 context <function_decl 0x7fffe99d2900 e> arg-type <record_type 0x7fffe99cec78 c>>
(gdb)
PR debug/120849
* print-tree.cc (debug): New.
* print-tree.h (debug): Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
This fixes an error recovery issue, whereby the compilation of a string
concatenation with an illegal character constant hangs.
gcc/ada/
PR ada/120854
* sem_eval.adb (Get_String_Val): Be prepared for an integer literal
after a serious error is detected, and raise PE on other nodes.
gcc/testsuite/
* gnat.dg/concat6.adb: New test.
|
|
Modules streaming needs to handle these differently from other unnamed
FIELD_DECLs that are streamed for internal RECORD_DECLs, and there
doesn't seem to be a good way to detect this case otherwise.
This matters only to allow for compiler-generated type definitions that
build FIELD_DECLs with no name, as otherwise they get confused.
Currently the only such types left I hadn't earlier fixed by giving
names to are contextless, for which we have an early check to mark their
fields as MK_unique anyway, but there may be other cases in the future.
gcc/cp/ChangeLog:
* module.cc (trees_out::walking_bit_field_unit): New flag.
(trees_out::trees_out): Initialize it.
(trees_out::core_vals): Set it.
(trees_out::get_merge_kind): Use it, move previous ad-hoc check
into assertion.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|
|
template [PR120644]
We were erroring because the TEMPLATE_DECL of the existing partial
specialisation has an undeduced return type, but the imported
declaration did not.
The root cause is similar to what was fixed in r13-2744-g4fac53d6522189,
where modules streaming code assumes that a TEMPLATE_DECL and its
DECL_TEMPLATE_RESULT will always have the same TREE_TYPE. That commit
fixed the issue by ensuring that when the type of a variable is deduced
the TEMPLATE_DECL is updated as well, but missed handling partial
specialisations. This patch ensures that the same adjustment is made
there as well.
PR c++/120644
gcc/cp/ChangeLog:
* decl.cc (cp_finish_decl): Also propagate type to partial
templates.
* module.cc (trees_out::decl_value): Add assertion that the
TREE_TYPE of a streamed template decl matches its inner.
(trees_in::is_matching_decl): Clarify function return type
deduction should only occur for non-TEMPLATE_DECL.
* pt.cc (template_for_substitution): Handle partial specs.
gcc/testsuite/ChangeLog:
* g++.dg/modules/auto-7.h: New test.
* g++.dg/modules/auto-7_a.H: New test.
* g++.dg/modules/auto-7_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|