Age | Commit message (Collapse) | Author | Files | Lines |
|
When merging 2 groups of PE's, one group was simply being set to the
other instead of properly merging them.
PR tree-optimization/107273
gcc/
* value-relation.cc (equiv_oracle::add_partial_equiv): Merge
instead of copying precison of each member.
gcc/testsuite/
* gcc.dg/tree-ssa/pr107273-1.c: New.
* gcc.dg/tree-ssa/pr107273-2.c: New.
|
|
|
|
This patch actually fixes the bogus RTL seen in PR101697.
Basically we continue to use the insn condition to catch most of the problem
cases related to autoinc addressing modes. This patch adds constraints which
can guide reload (and hopefully LRA) away from doing blind replacements during
register elimination that would ultimately result in bogus RTL. The idea is
from Paul K. who has done something very similar on the pdp11. I guess it
shouldn't be a big surprise that the H8 and pdp11 need the same kind of
handling given some of the similarities in their architectures.
gcc/
PR target/101697
* config/h8300/combiner.md: Replace '<' preincment constraint with
ZA/Z1..ZH/Z7 combinations.
* config/h8300/movepush.md: Similarly
|
|
Continuing the work to add constraints to avoid invalid RTL
with autoinc addressing modes. Specifically this patch adds
the memory constraints similar to the pdp11.
gcc/
* config/h8300/constraints.md (Za..Zh): New constraints for
autoinc addresses using a specific register.
* config/h8300/h8300.cc (pre_incdec_with_reg): New function.
* config/h8300/h8300-protos.h (pre_incdec_with_reg): Add prototype.
|
|
gcc/
* config/i386/cet.c: Remove accidental commit.
* config/i386/driver-mingw32.c: Likewise.
* config/i386/i386-builtins.c: Likewise.
* config/i386/i386-d.c: Likewise.
* config/i386/i386-expand.c: Likewise.
* config/i386/i386-features.c: Likewise.
* config/i386/i386-options.c: Likewise.
* config/i386/t-cet: Likewise.
* config/i386/x86-tune-sched-atom.c: Likewise.
* config/i386/x86-tune-sched-bd.c: Likewise.
* config/i386/x86-tune-sched-core.c: Likewise.
* config/i386/x86-tune-sched.c: Likewise.
|
|
I was looking at H8 assembly code recently and noticed we had unnecessary
extensions. As it turns out we never enabled redundant extension elimination
on the H8. This patch fixes that oversight (and was the trigger for the
failure fixed my the prior patch).
gcc/common
* common/config/h8300/h8300-common.cc (h8300_option_optimization_table):
Enable redundant extension elimination at -O2 and above.
|
|
While testing a minor optimization on the H8 my builds failed due to
failure to split a zero-extended memory load. That particular pattern
is a bit special on the H8 in that it's split at assembly time primarily
to get the length computations correct. Arguably that alternative should
go away completely, but I haven't really looked into that.
Anyway, with the final-asm split we obviously need to match a define_split
somewhere. But none was ever written after adding CCZN optimizations. So
if we had a zero extend of a memory operand and it was used to eliminate
a compare, then we'd abort at final asm time.
Regression tested (in conjunction with various other in-progress patches) on
H8 without regressions.
gcc/
* config/h8300/extensions.md (CCZN setting zero extended load): Add
missing splitter.
|
|
gcc/fortran/ChangeLog:
PR fortran/104330
* simplify.cc (gfc_simplify_image_index): Do not dereference NULL
pointer.
gcc/testsuite/ChangeLog:
PR fortran/104330
* gfortran.dg/pr104330.f90: New test.
|
|
set_global_ranges_from_unreachable_edges.
The problem here is that we're exporting a range for an SSA range that
happens on the other side of a __builtin_unreachable, but the SSA does
not post-dominate the definition point. This is causing ivcanon to
unroll things incorrectly.
This was a snafu when converting the code from evrp.
PR tree-optimization/107293
gcc/ChangeLog:
* tree-ssa-dom.cc
(dom_opt_dom_walker::set_global_ranges_from_unreachable_edges):
Check that condition post-dominates the definition point.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr107293.c: New test.
|
|
gcc/fortran/ChangeLog:
PR fortran/93483
PR fortran/107216
PR fortran/107219
* arith.cc (reduce_unary): Handled expressions are EXP_CONSTANT and
EXPR_ARRAY. Do not attempt to reduce otherwise.
(reduce_binary_ac): Likewise.
(reduce_binary_ca): Likewise.
(reduce_binary_aa): Moved check for EXP_CONSTANT and EXPR_ARRAY
from here ...
(reduce_binary): ... to here.
(eval_intrinsic): Catch failed reductions.
* gfortran.h (GFC_INTRINSIC_OPS): New enum ARITH_NOT_REDUCED to keep
track of expressions that were not reduced by the arithmetic evaluation
code.
gcc/testsuite/ChangeLog:
PR fortran/93483
PR fortran/107216
PR fortran/107219
* gfortran.dg/array_constructor_56.f90: New test.
* gfortran.dg/array_constructor_57.f90: New test.
Co-authored-by: Mikael Morin <mikael@gcc.gnu.org>
|
|
gcc/fortran/ChangeLog:
PR fortran/107272
* arith.cc (gfc_arith_not): Operand must be of type BT_LOGICAL.
(gfc_arith_and): Likewise.
(gfc_arith_or): Likewise.
(gfc_arith_eqv): Likewise.
(gfc_arith_neqv): Likewise.
(gfc_arith_eq): Compare consistency of types of operands.
(gfc_arith_ne): Likewise.
(gfc_arith_gt): Likewise.
(gfc_arith_ge): Likewise.
(gfc_arith_lt): Likewise.
(gfc_arith_le): Likewise.
gcc/testsuite/ChangeLog:
PR fortran/107272
* gfortran.dg/pr107272.f90: New test.
|
|
PR fortran/107266
gcc/fortran/
* trans-expr.cc (gfc_conv_string_parameter): Use passed
type to honor character kind.
* trans-types.cc (gfc_sym_type): Honor character kind.
* trans-decl.cc (gfc_conv_cfi_to_gfc): Fix handling kind=4
character strings.
gcc/testsuite/
* gfortran.dg/char4_decl.f90: New test.
* gfortran.dg/char4_decl-2.f90: New test.
|
|
It looks like we currently avoid streaming the RESULT_DECL and PARM_DECLs
of a constexpr_fundef entry under the assumption that they're just copies
of the DECL_RESULT and DECL_ARGUMENTS of the FUNCTION_DECL. Thus we can
just make new copies of DECL_RESULT and DECL_ARGUMENTS on stream in rather
than separately streaming them.
But the FUNCTION_DECL's DECL_RESULT and DECL_ARGUMENTS eventually get
genericized, whereas the constexpr_fundef entry consists of a copy of the
FUNCTION_DECL's pre-GENERIC trees. And notably during genericization we
lower invisref parms (which entails changing their TREE_TYPE and setting
DECL_BY_REFERENCE), the lowered form of which the constexpr evaluator
doesn't expect to see, and so this copying approach causes us to ICE for
the below testcase.
This patch fixes this by faithfully streaming the RESULT_DECL and
PARM_DECLs of a constexpr_fundef entry, which seems to just work.
Nathan says[1]: Hm, the reason for the complexity was that I wanted to
recreate the tree graph where the fndecl came from one TU and the defn
came from another one -- we need the definition to refer to argument
decls from the already-read decl. However, it seems that for constexpr
fns here, that is not needed, resulting in a significant simplification.
[1]: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603662.html
PR c++/101449
gcc/cp/ChangeLog:
* module.cc (trees_out::write_function_def): Stream the
parms and result of the constexpr_fundef entry.
(trees_in::read_function_def): Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/modules/cexpr-3_a.C: New test.
* g++.dg/modules/cexpr-3_b.C: New test.
|
|
PR tree-optimization/105820
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/pr105820.c: New test.
|
|
PR tree-optimization/107286
gcc/ChangeLog:
* value-range.cc (range_tests_floats): Do not test for -Inf when
flag_finite_math_only.
|
|
x UNORD x should set NAN on the TRUE side.
The false side of x == x should set NAN.
The true side of x != x should set NAN.
gcc/testsuite/
* gcc.dg/tree-ssa/vrp-float-3a.c: New.
* gcc.dg/tree-ssa/vrp-float-4a.c: New.
* gcc.dg/tree-ssa/vrp-float-5a.c: New.
|
|
There are 3 possible relations range-ops might care about, but only the one
most likely to be needed is supplied. This patch provides a new class
relation_trio which allows 3 relations to be passed in a single word.
fold_range (), op1_range (), and op2_range () are adjusted to take a
relation_trio class instead of a relation_kind, then the routine can
extract which relation it wants to work with.
* gimple-range-fold.cc (fold_using_range::range_of_range_op):
Provide relation_trio class.
* gimple-range-gori.cc (gori_compute::refine_using_relation):
Provide relation_trio class.
(gori_compute::refine_using_relation): Ditto.
(gori_compute::compute_operand1_range): Provide lhs_op2 and
op1_op2 relations via relation_trio class.
(gori_compute::compute_operand2_range): Ditto.
* gimple-range-op.cc (gimple_range_op_handler::calc_op1): Use
relation_trio instead of relation_kind.
(gimple_range_op_handler::calc_op2): Ditto.
(*::fold_range): Ditto.
* gimple-range-op.h (gimple_range_op::calc_op1): Adjust prototypes.
(gimple_range_op::calc_op2): Adjust prototypes.
* range-op-float.cc (*::fold_range): Use relation_trio instead of
relation_kind.
(*::op1_range): Ditto.
(*::op2_range): Ditto.
* range-op.cc (*::fold_range): Use relation_trio instead of
relation_kind.
(*::op1_range): Ditto.
(*::op2_range): Ditto.
* range-op.h (class range_operator): Adjust prototypes.
(class range_operator_float): Ditto.
(class range_op_handler): Adjust prototypes.
(relop_early_resolve): Pickup op1_op2 relation from relation_trio.
* value-relation.cc (VREL_LAST): Adjust use to be one past the end of
the enum.
(relation_oracle::validate_relation): Use relation_trio in call
to fold_range.
* value-relation.h (enum relation_kind_t): Add VREL_LAST as
final element.
(class relation_trio): New.
(TRIO_VARYING, TRIO_SHIFT, TRIO_MASK): New.
|
|
Calling clean_nan on an undefined type traps, set_varying first. Other
tweaks for correctness.
* range-op-float.cc (foperator_not_equal::op1_range): Check for
VREL_EQ after singleton.
(foperator_unordered::op1_range): Set VARYING before calling
clear_nan().
(foperator_ordered::op1_range): Set rather than clear NAN if both
operands are the same.
|
|
The oracle will not register nonssense/useless relations, class
value_relation shouldn't either.
* value-relation.cc (value_relation::dump): Change message.
* value-relation.h (value_relation::set_relation): If op1 is the
same as op2 do not create a relation.
|
|
For example, for "g++-4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4", the recent
commit r13-3220-g45381d6f9f4e7b5c7b062f5ad8cc9788091c2d07
"amdgcn: add multiple vector sizes" broke the build:
In file included from [...]/source-gcc/gcc/coretypes.h:458:0,
from [...]/source-gcc/gcc/config/gcn/gcn.cc:24:
[...]/source-gcc/gcc/config/gcn/gcn.cc: In function ‘machine_mode VnMODE(int, machine_mode)’:
./insn-modes.h:42:71: error: temporary of non-literal type ‘scalar_int_mode’ in a constant expression
#define QImode (scalar_int_mode ((scalar_int_mode::from_int) E_QImode))
^
[...]/source-gcc/gcc/config/gcn/gcn.cc:405:10: note: in expansion of macro ‘QImode’
case QImode:
^
In file included from [...]/source-gcc/gcc/coretypes.h:478:0,
from [...]/source-gcc/gcc/config/gcn/gcn.cc:24:
[...]/source-gcc/gcc/machmode.h:410:7: note: ‘scalar_int_mode’ is not literal because:
class scalar_int_mode
^
[...]/source-gcc/gcc/machmode.h:410:7: note: ‘scalar_int_mode’ is not an aggregate, does not have a trivial default constructor, and has no constexpr constructor that is not a copy or move constructor
[...]
Addressing this like simiar issues have been addressed in the past.
gcc/
* config/gcn/gcn.cc (VnMODE): Use 'case E_QImode:' instead of
'case QImode:', etc.
|
|
Added in 2015 r229696 (commit 1b223a9f3489296c625bdb7cc764196d04fd9231)
"defer mark_addressable calls during expand till the end of expand",
it has never been used 'extern'ally.
gcc/
* gimple-expr.cc (mark_addressable_2): Tag as 'static'.
|
|
The following picks up the prototype by Ju-Zhe Zhong for vectorizing
first order recurrences. That solves two TSVC missed optimization PRs.
There's a new scalar cycle def kind, vect_first_order_recurrence
and it's handling of the backedge value vectorization is complicated
by the fact that the vectorized value isn't the PHI but instead
a (series of) permute(s) shifting in the recurring value from the
previous iteration. I've implemented this by creating both the
single vectorized PHI and the series of permutes when vectorizing
the scalar PHI but leave the backedge values in both unassigned.
The backedge values are (for the testcases) computed by a load
which is also the place after which the permutes are inserted.
That placement also restricts the cases we can handle (without
resorting to code motion).
I added both costing and SLP handling though SLP handling is
restricted to the case where a single vectorized PHI is enough.
Missing is epilogue handling - while prologue peeling would
be handled transparently by adjusting iv_phi_p the epilogue
case doesn't work with just inserting a scalar LC PHI since
that a) keeps the scalar load live and b) that loads is the
wrong one, it has to be the last, much like when we'd vectorize
the LC PHI as live operation. Unfortunately LIVE
compute/analysis happens too early before we decide on
peeling. When using fully masked loop vectorization the
vect-recurr-6.c works as expected though.
I have tested this on x86_64 for now, but since epilogue
handling is missing there's probably no practical cases.
My prototype WHILE_ULT AVX512 patch can handle vect-recurr-6.c
just fine but I didn't feel like running SPEC within SDE nor
is the WHILE_ULT patch complete enough.
PR tree-optimization/99409
PR tree-optimization/99394
* tree-vectorizer.h (vect_def_type::vect_first_order_recurrence): Add.
(stmt_vec_info_type::recurr_info_type): Likewise.
(vectorizable_recurr): New function.
* tree-vect-loop.cc (vect_phi_first_order_recurrence_p): New
function.
(vect_analyze_scalar_cycles_1): Look for first order
recurrences.
(vect_analyze_loop_operations): Handle them.
(vect_transform_loop): Likewise.
(vectorizable_recurr): New function.
(maybe_set_vectorized_backedge_value): Handle the backedge value
setting in the first order recurrence PHI and the permutes.
* tree-vect-stmts.cc (vect_analyze_stmt): Handle first order
recurrences.
(vect_transform_stmt): Likewise.
(vect_is_simple_use): Likewise.
(vect_is_simple_use): Likewise.
* tree-vect-slp.cc (vect_get_and_check_slp_defs): Likewise.
(vect_build_slp_tree_2): Likewise.
(vect_schedule_scc): Handle the backedge value setting in the
first order recurrence PHI and the permutes.
* gcc.dg/vect/vect-recurr-1.c: New testcase.
* gcc.dg/vect/vect-recurr-2.c: Likewise.
* gcc.dg/vect/vect-recurr-3.c: Likewise.
* gcc.dg/vect/vect-recurr-4.c: Likewise.
* gcc.dg/vect/vect-recurr-5.c: Likewise.
* gcc.dg/vect/vect-recurr-6.c: Likewise.
* gcc.dg/vect/tsvc/vect-tsvc-s252.c: Un-XFAIL.
* gcc.dg/vect/tsvc/vect-tsvc-s254.c: Likewise.
* gcc.dg/vect/tsvc/vect-tsvc-s291.c: Likewise.
Co-authored-by: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
|
|
|
|
gcc/ChangeLog:
* config/riscv/t-riscv: Change Tab into 2 space.
|
|
Hi, this patch fixed my mistake in the previous commit patch.
Since "mangle_builtin_type" is a global function will be called in riscv.cc.
It's reasonable move it down and put them together stay with other global functions.
gcc/ChangeLog:
* config/riscv/riscv-vector-builtins.cc (mangle_builtin_type): Move down the function.
|
|
stdint.h is considered a freestanding headers by C, and a valid stdint.h
is required for certain parts of libstdc++' configuration, so we should
simply provide one when we have no other way (i.e. newlib or
user-specified sysroot) of getting one.
* config.gcc: --target=*-elf --without-{newlib,headers} should
provide stdint.h.
|
|
gcc/ChangeLog:
* common/config/i386/cpuinfo.h:
(get_intel_cpu): Handle Meteorlake.
* common/config/i386/i386-common.cc:
(processor_alias_table): Add Meteorlake.
|
|
gcc/ChangeLog:
* common/config/i386/cpuinfo.h:
(get_intel_cpu): Handle Raptorlake.
* common/config/i386/i386-common.cc:
(processor_alias_table): Add Raptorlake.
|
|
|
|
GCC does not allow a the operand of an autoinc addressing mode to
overlap with another soure operand in the same insn. This is primarly
enforced with insn conditions. However, cases can slip through LRA
and reload. To address those scenarios we'll take an idea from the
pdp11 port for describing the restriction in constraints as well.
To implement that we need register classes and constraints which are
"all general purpose hardware registers except r0". And similarly for
r1..r7(sp).
This patch adds those register classes and constraints, but does not
yet use them.
gcc/
* config/h8300/constraints.md (Z0..Z7): New register
constraints.
* config/h8300/h8300.h (reg_class): Add new classes.
(REG_CLASS_NAMES): Similarly.
(REG_CLASS_CONTENTS): Similarly.
|
|
I want to use Z as a multi-letter constraint. So first we have to
adjust the existing use of Z. This does not affect code generation.
gcc/
* config/h8300/constraints.md (Zz constraint): Renamed
from "z".
* config/h8300/movepush.md (movqi_h8sx, movhi_h8sx): Adjust
constraint to use Zz instead of Z.
|
|
gcc/
* config/h8300/h8300.cc (h8300_register_move_cost): Fix typo.
|
|
|
|
|
|
|
|
C2x has, like C++, adopted rules for identifiers based directly on an
unversioned normative reference to Unicode. Make libcpp follow those
rules for c2x / gnu2x standards (this involves bringing back a flag
separate from the C++ one for whether to use these identifier rules,
but this time enabled for all C++ language versions since that was the
conclusion adopted for C++ identifier handling).
There is one change here that affects C++. I believe the new
normative requirement for NFC only applies to identifiers, not to the
use of identifier-continue characters in pp-numbers, where there is no
such requirement and so the diagnostic ought to be a warning not a
pedwarn in pp-numbers, and that this is the case for both C and C++.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
libcpp/
* charset.cc (ucn_valid_in_identifier): Check xid_identifiers not
cplusplus to determine whether to use CXX23 and NXX23 flags.
* include/cpplib.h (struct cpp_options): Add xid_identifiers.
* init.cc (struct lang_flags, lang_defaults): Add xid_identifiers.
(cpp_set_lang): Set xid_identifiers.
* lex.cc (warn_about_normalization): Add parameter identifier.
Only pedwarn about non-NFC for identifiers, not pp-numbers.
(_cpp_lex_direct): Update calls to warn_about_normalization.
gcc/testsuite/
* gcc.dg/cpp/c2x-ucnid-1-utf8.c, gcc.dg/cpp/c2x-ucnid-1.c: New
tests.
|
|
gcc/fortran/ChangeLog:
PR fortran/100971
* resolve.cc (resolve_transfer): Extend check for permissibility
of polymorphic elements in a data transfer to arrays.
gcc/testsuite/ChangeLog:
PR fortran/100971
* gfortran.dg/der_io_5.f90: New test.
|
|
gcc/ChangeLog:
* value-range.cc (frange::set): Implement distinction between
HONOR_SIGNED_ZEROS and MODE_HAS_SIGNED_ZEROS.
|
|
copysign(MAGNITUDE, SIGN) is implemented as the absolute of MAGNITUDE,
with SIGN applied. If the sign of "SIGN" cannot be determined, we
return a range of [-MAGNITUDE, +MAGNITUDE].
gcc/ChangeLog:
* gimple-range-op.cc (class cfn_copysign): New.
(gimple_range_op_handler::maybe_builtin_call): Add
CFN_BUILT_IN_COPYSIGN*.
|
|
gcc/testsuite/
* gfortran.dg/c-interop/deferred-character-2.f90: Use 'dg-do run'.
|
|
[-Inf, -Inf] is being flushed to [-Inf, -0.0] because real_isdenormal
is being overly pessimistic. It is missing a check for rvc_normal.
This doesn't cause problems in real.cc because all uses of
real_isdenormal are already on the rvc_normal path. The uses in
value-range.cc however, are not.
This patch adds a check for rvc_normal.
gcc/ChangeLog:
* real.h (real_isdenormal): Check rvc_normal.
* value-range.cc (range_tests_floats): New test.
|
|
gcc/ChangeLog:
* gimple-range-op.cc
(gimple_range_op_handler::maybe_builtin_call): Replace
CFN_BUILTIN_SIGNBIT* cases with CASE_FLT_FN.
|
|
[-Inf, +Inf] was being chopped correctly for -ffinite-math-only, but
[-Inf, -Inf] was not. This was latent because a bug in
real_isdenormal is causing us to flush -Inf to zero.
gcc/ChangeLog:
* value-range.cc (frange::set): Normalize ranges for both bounds.
|
|
Similar to what we do for NANs when !HONOR_NANS and Inf when
flag_finite_math_only, we can remove -0.0 from the range at creation
time.
We were kinda sorta doing this because there is a bug in
real_isdenormal that is causing flush_denormals_to_zero to saturate
[x, -0.0] to [x, +0.0] when !HONOR_SIGNED_ZEROS. Fixing this bug
(upcoming), causes us to leave -0.0 in places where we aren't
expecting it (the intersection code).
gcc/ChangeLog:
* value-range.cc (frange::set): Drop -0.0 for !HONOR_SIGNED_ZEROS.
|
|
The FUNCTION_DECL we build for __dynamic_cast has an empty DECL_CONTEXT
but trees_out::tree_node expects FUNCTION_DECLs to have non-empty
DECL_CONTEXT, thus we crash when streaming out the dynamic_cast in the
below testcase.
This patch naively fixes this by setting DECL_CONTEXT for __dynamic_cast
appropriately. I suppose we should push it into the namespace too, like
we do for __cxa_atexit which is similarly lazily declared.
PR c++/106304
gcc/cp/ChangeLog:
* constexpr.cc (cxx_dynamic_cast_fn_p): Check for abi_node
instead of global_namespace.
* rtti.cc (build_dynamic_cast_1): Set DECL_CONTEXT and
DECL_SOURCE_LOCATION when building dynamic_cast_node. Push
it into the namespace.
gcc/testsuite/ChangeLog:
* g++.dg/modules/pr106304_a.C: New test.
* g++.dg/modules/pr106304_b.C: New test.
|
|
gcc/ChangeLog:
* gimple-range-op.cc
(gimple_range_op_handler::maybe_builtin_call): Add
CFN_BUILT_IN_SIGNBIT[FL]* entries.
|
|
The following fixes an omission from adding SLP permute nodes which
is live lanes originating from those. We have to check that we
can extract the lane and have to actually code generate them.
PR tree-optimization/107254
* tree-vect-slp.cc (vect_slp_analyze_node_operations_1):
For permutes also analyze live lanes.
(vect_schedule_slp_node): For permutes also code generate
live lane extracts.
* gfortran.dg/vect/pr107254.f90: New testcase.
|
|
This is the infamous PR rtl-optimization/38644 rearing its ugly head for
leaf functions on SPARC more than a decade later... Richard E.'s generic
solution has never been implemented so let's do as other RISC back-ends did.
gcc/
PR target/107248
* config/sparc/sparc.cc (sparc_expand_prologue): Emit a frame
blockage for leaf functions.
(sparc_flat_expand_prologue): Emit frame instead of full blockage.
(sparc_expand_epilogue): Emit a frame blockage for leaf functions.
(sparc_flat_expand_epilogue): Emit frame instead of full blockage.
|
|
Add a test to catch regression in line counts for labels on top of
then/else blocks. Only the 'goto <label>' should contribute to the line
counter for the label, not the if.
gcc/testsuite/ChangeLog:
* gcc.misc-tests/gcov-4.c: New testcase.
|
|
The coverage support will under some conditions decide to split edges to
accurately report coverage. By running the test suite with/without this
edge splitting a small diff shows up, addressed by this patch, which
should catch future regressions.
Removing the edge splitting:
$ diff --git a/gcc/profile.cc b/gcc/profile.cc
--- a/gcc/profile.cc
+++ b/gcc/profile.cc
@@ -1244,19 +1244,7 @@ branch_prob (bool thunk)
Don't do that when the locuses match, so
if (blah) goto something;
is not computed twice. */
- if (last
- && gimple_has_location (last)
- && !RESERVED_LOCATION_P (e->goto_locus)
- && !single_succ_p (bb)
- && (LOCATION_FILE (e->goto_locus)
- != LOCATION_FILE (gimple_location (last))
- || (LOCATION_LINE (e->goto_locus)
- != LOCATION_LINE (gimple_location (last)))))
- {
- basic_block new_bb = split_edge (e);
- edge ne = single_succ_edge (new_bb);
- ne->goto_locus = e->goto_locus;
- }
+
if ((e->flags & (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL))
&& e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
need_exit_edge = 1;
Assuming the .gcov files from make chec-gcc RUNTESTFLAGS=gcov.exp are
kept:
$ diff -r no-split-edge with-split-edge | grep -C 2 -E "^[<>]\s\s"
diff -r sans-split-edge/gcc/gcov-4.c.gcov with-split-edge/gcc/gcov-4.c.gcov
228c228
< -: 224: break;
---
> 1: 224: break;
231c231
< -: 227: break;
---
> #####: 227: break;
237c237
< -: 233: break;
---
> 2: 233: break;
gcc/testsuite/ChangeLog:
* g++.dg/gcov/gcov-1.C: Add line count check.
* gcc.misc-tests/gcov-4.c: Likewise.
|