The following patch updates GCC from Unicode 16.0.0 to 17.0.0.
I've followed what the README says and updated also one script from
glibc, but that needed another Unicode file - HangulSyllableType.txt -
around as well, so I'm adding it.
I've added one new test to named-universal-char-escape-1.c for
randomly chosen character from new CJK block.
Note, Unicode 17.0.0 authors forgot to adjust the 4-8 table, I've filed
bugreports about that but the UnicodeData.txt changes for the range ends
and the new range seems to match e.g. what is in the glyph tables, so
the patch follows UnicodeData.txt and not 4-8 table here.
Another thing was that makeuname2c.cc didn't handle correctly when
the size of the generated string table modulo 77 was 76 or 77, in which
case it forgot to emit a semicolon after the string literal and so failed
to compile.
And as can be seen in the emoji-data.txt diff, some properties like
Extended_Pictographic have been removed from certain characters, e.g.
from the Mahjong cards characters except U+1F004, and one libstdc++
test was testing that property exactly on U+1F000. Dunno why that was
changed, but U+1F004 is the only colored one among tons of black and white
ones.
2025-10-08 Jakub Jelinek <jakub@redhat.com>
contrib/
* unicode/README: Add HangulSyllableType.txt file to the
list as newest utf8_gen.py from glibc now needs it. Adjust
git commit hash and change unicode 16 version to 17.
* unicode/from_glibc/utf8_gen.py: Updated from glibc.
* unicode/DerivedCoreProperties.txt: Updated from Unicode 17.0.0.
* unicode/emoji-data.txt: Likewise.
* unicode/PropList.txt: Likewise.
* unicode/GraphemeBreakProperty.txt: Likewise.
* unicode/DerivedNormalizationProps.txt: Likewise.
* unicode/NameAliases.txt: Likewise.
* unicode/UnicodeData.txt: Likewise.
* unicode/EastAsianWidth.txt: Likewise.
* unicode/DerivedGeneralCategory.txt: Likewise.
* unicode/HangulSyllableType.txt: New file.
gcc/testsuite/
* c-c++-common/cpp/named-universal-char-escape-1.c: Add test for
\N{CJK UNIFIED IDEOGRAPH-3340E}.
libcpp/
* makeucnid.cc (write_copyright): Adjust copyright year.
* makeuname2c.cc (generated_ranges): Adjust end points for a couple
of ranges based on UnicodeData.txt Last changes and add a whole new
CJK UNIFIED IDEOGRAPH- entry. None of these changes are in the 4-8
table, but clearly it has just been forgotten.
(write_copyright): Adjust copyright year.
(write_dict): Fix up condition when to print semicolon.
* generated_cpp_wcwidth.h: Regenerate.
* ucnid.h: Regenerate.
* uname2c.h: Regenerate.
libstdc++-v3/
* include/bits/unicode-data.h: Regenerate.
* testsuite/ext/unicode/properties.cc: Test __is_extended_pictographic
on U+1F004 rather than U+1F000.
And also add the clobber for non-placement new.
For now let's limit the clobber of an array with non-constant bound to
placement new in constant evaluation, where we need it to set the active
member of a union.
And catch some additional cases of there being no actual data to clobber.
This changes the diagnostics in a couple of analyzer tests, but the new
diagnostics are also valid.
It also adds some -Wuninitialized warnings which seem like an improvement;
the lines that now warn about an uninitialized vptr are correct, since
trying to assign to a member of a virtual base reads the vptr of an object
that was never created.
gcc/cp/ChangeLog:
* init.cc (build_new_1): Also clobber for non-placement new.
Only loop clobber in constexpr.
* expr.cc (wrap_with_if_consteval): New.
* cp-tree.h (wrap_with_if_consteval): Declare.
gcc/testsuite/ChangeLog:
* g++.dg/analyzer/new-2.C: Adjust diags.
* g++.dg/analyzer/noexcept-new.C: Adjust diags.
* g++.dg/warn/Warray-bounds-23.C: Add warnings.
* g++.dg/warn/Warray-bounds-24.C: Add warnings.
* g++.dg/cpp26/constexpr-new4a.C: New test.
The value should use divide instead of modulo, as given 1st of month
being weekday X (Mon, Tue, ...), 01 is always X[1], 08 is X[2], e.t.c.
This values is currently not observable, as there is no user-accessible
format specifier that will print it, however it may be exposed in future.
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h (_ChronoData::_M_fill_day): Replace
'%' by '/'.
For MinGW on x86-64, GCC currently passes and returns `_Float16` in
GPRs. Microsoft does not specify an ABI for the type so this is purely
an extension; however, there are a few reasons the current ABI is not
ideal:
1. `float` and `double` are both passed and returned in xmm registers
under the MSVC ABI, there isn't any reason for `_Float16` to deviate.
2. `_Float16` is returned in xmm0 on Windows x86-32 by both GCC and
Clang.
3. There is a platform-natural ABI with AVX512-FP16, which requires
half-precision operands to be in vector registers.
4. System V uses vector registers for `_Float16`.
Thus, update the `HFmode` ABI to both pass and return in vector
registers, meaning its ABI is now identical to `float` and `double`.
This is already Clang's behavior on both its x64 MSVC and MinGW targets,
so the change here also resolves an ABI incompatibility (originally
reported in linked issue).
The results can be verified by evaluating the change in assembly output
with this source:
void pass_f16(_Float16 x, _Float16 *dst) {
*dst = x;
}
void callee_f16(_Float16);
void call_f16() {
callee_f16(1.0);
}
_Float16 ret_f16(_Float16 *x) {
return *x;
}
/* Check libcall ABI */
void extend_f16(_Float16 *x, _Float32 *dst) {
*dst = (_Float32)*x;
}
void trunc_f16(_Float32 *x, _Float16 *dst) {
*dst = (_Float16)*x;
}
/* Float varargs should be in vregs with a zeroed shadow GPR */
void va(_Float16, ...);
void va_f16() {
va(1.0f16, 2.0f16, 3.0f16, 4.0f16, 5.0f16);
}
While modifying the `function_value_ms_64` `switch` statement, a
redundant condition and trailing whitespace in the 16-byte case is
cleaned up.
2025-09-13 Trevor Gross <tmgross@umich.edu>
gcc:
PR target/115054
* config/i386/i386.cc (function_arg_ms_64,
function_value_ms_64): Pass and return _Float16 in vector
registers on Windows.
Signed-off-by: Trevor Gross <tmgross@umich.edu>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
As we consider bitwise operations possible mask operations we have
to consider the case of only one operand arriving as mask. The
following compensates for this by creating mask from the other operand
and insert possibly required mask conversions.
PR tree-optimization/110223
PR tree-optimization/122128
* tree-vect-patterns.cc (vect_recog_bool_pattern): Add
compensation for mixed mask/data bitwise operations.
* gcc.dg/vect/vect-bool-2.c: New testcase.
* gcc.dg/vect/vect-bool-cmp-3.c: Likewise.
* gcc.dg/vect/vect-bool-cmp-4.c: Likewise.
We are now vectorizing more loops in standard library functions.
Restrict the dump scan to the loop we're interested in.
PR testsuite/120100
* g++.dg/vect/pr64410.cc: Adjust.
Implement the class submdspan_mapping_result and add it to the std
module.
PR libstdc++/110352
libstdc++-v3/ChangeLog:
* include/std/mdspan (submdspan_mapping_result): New class.
* src/c++23/std.cc.in (submdspan_mapping_result): Add.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
Add the class and updates the std module.
PR libstdc++/110352
libstdc++-v3/ChangeLog:
* include/std/mdspan (full_extent_t): New class.
* src/c++23/std.cc.in (full_extent_t): Add.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
The improvement is that in __index_type_cast, we don't need to check at
runtime if we know that _IndexType is smaller than _OIndexType.
The cleanup is whitespace (overlength lines) in <mdspan>, grouping is_always_foo
and is_foo together, and de-uglifying a variable in test code.
libstdc++-v3/ChangeLog:
* include/std/mdspan (__mdspan::__index_type_cast): Optimize by
skipping a __glibcxx_assert if it's know at compile-time.
(std::layout_left_padded, std::layout_righ_padded): Reorder
is_always_strided and is_unique member functions.
* testsuite/23_containers/mdspan/int_like.h: Rename _M_i to
value.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
We are not considering ia32 to be TARGET_MMX_WITH_SSE so the testcase
cannot work there.
PR target/120091
gcc/testsuite/
* gcc.target/i386/pr119919.c: Only check for vectorization
when !ia32.
This commit adds the right padded layout as described in N5014, with
LWG4372 (dynamic padding value) and LWG4314 (move in operator()).
PR libstdc++/110352
libstdc++-v3/ChangeLog:
* include/std/mdspan (_RightPaddedIndices): Traits for right
padded layouts.
(layout_right::mapping::mapping) New overload for right padded
layouts.
(layout_right_padded): Add implementation.
* src/c++23/std.cc.in (layout_right_padded): Add.
* testsuite/23_containers/mdspan/layouts/ctors.cc: Update
test for right padded layouts.
* testsuite/23_containers/mdspan/layouts/empty.cc: Ditto.
* testsuite/23_containers/mdspan/layouts/mapping.cc: Ditto.
* testsuite/23_containers/mdspan/layouts/padded.cc: Ditto.
* testsuite/23_containers/mdspan/layouts/padded_neg.cc: Ditto.
* testsuite/23_containers/mdspan/layouts/padded_traits.h: Ditto.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
This commit adds a new layout layout_left_padded as standardized in
N5014. It adds a purely internal feature testing macro padded_layouts
and registers layout_left_padded in the std module.
This commit implements LWG4372, because without it's not possible
to properly test padded layouts with a dynamic padding value. It also
implements LWG4314, for consistency with prior layouts.
The implementation uses a _PaddedStorage to deduplicate most of the code
shared between left- and right-padded layouts. It's implemented through
aggregation rather than inheritence, because of a bug related to
inheriting conditionally explicit ctors.
The tests are written such that the canonical version works for
layout_left_padded. A version for layout_right_padded is derived
essentially by reversing the order of the extents.
PR libstdc++/110352
libstdc++-v3/ChangeLog:
* include/bits/version.def (padded_layouts): Add new internal
feature testing macro.
* include/bits/version.h: Regenerate.
* include/std/mdspan (__fwd_prod): New overload.
(layout_left_padded): Add declaration and implementation.
(layout_right_padded): Add declaration only.
(layout_left::mapping::mapping): New overload for left
padded mappings.
(__index_type_cast): New function that performs a checked cast
to index_type.
(__is_left_padded_mapping): New concept.
(__is_right_padded_mapping): Ditto.
(__standardized_mapping): Recognize left and right padded
mappings.
(_LeftPaddedIndices): Traits for left padded details.
(_PaddedStorage): New class for implementing padded layouts.
* src/c++23/std.cc.in (layout_left_padded): Add.
* testsuite/23_containers/mdspan/layouts/class_mandate_neg.cc:
Refactor and add tests for layout_left_padded.
* testsuite/23_containers/mdspan/layouts/ctors.cc: Ditto.
* testsuite/23_containers/mdspan/layouts/empty.cc: Ditto.
* testsuite/23_containers/mdspan/layouts/mapping.cc: Ditto.
* testsuite/23_containers/mdspan/layouts/padded.cc: Ditto.
* testsuite/23_containers/mdspan/layouts/padded_neg.cc: Ditto.
* testsuite/23_containers/mdspan/layouts/padded_traits.h: New
traits.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
My patch (r16-4182-g73888cefe6da65) broke another target (i386), which this
patch fixes.
The issue was the target_version code was incorrectly being triggered on
targets that do not support target_version semantics (i386).
PR target/122180
gcc/c/ChangeLog:
* c-decl.cc (pushdecl): Add TARGET_HAS_FMV_TARGET_ATTRIBUTE check.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr122180.c: New test.
The following testcase ICEs during gimplification.
The problem is that save_expr sometimes doesn't create a SAVE_EXPR but
returns the original complex tree (COND_EXPR) and the code then uses that
tree in 2 different spots without unsharing. As this is done during
gimplification it wasn't unshared when whole body is unshared and because
gimplification is destructive, the first time we gimplify it we destruct it
and second time we try to gimplify it we ICE on it.
Now, we could replace one a use with unshare_expr (a), but because this
is a gimplification hook, I think easier than trying to create a save_expr
is just gimplify the argument, then we know it is is_gimple_val and so
something without side-effects and can safely use it twice. That argument
would be the first thing to gimplify after return GS_OK anyway, so it
doesn't change argument sequencing etc.
2025-10-08 Jakub Jelinek <jakub@redhat.com>
PR c/122188
* c-gimplify.cc (c_gimplify_expr): Gimplify CALL_EXPR_ARG (*expr_p, 0)
instead of calling save_expr on it.
* c-c++-common/pr122188.c: New test.
The test FAILs on ilp32 targets with
pr121987.c:5:21: warning: unsigned conversion from 'long long int' to 'long unsigned int' changes value from '10000000000' to '1410065408' [-Woverflow]
excess error. Fixed by using unsigned long long instead of unsigned and
using a suffix on the constant.
Tested on x86_64-linux with -m32/-m64, additionally tested with older cc1
where it ICEd in both cases in upper_bound.
2025-10-08 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/121206
* gcc.dg/pr121987.c (main): Use unsigned long long type for e instead
of unsigned long and use ULL suffix on the initializer.
2025-10-08 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/93175
PR fortran/102240
PR fortran/102686
* array.cc (match_array_element_spec): For pdt templates, call
gfc_correct_parm_expr to elimante extraneous symbols from the
bound expressions.
* decl.cc (correct_parm_expr, gfc_correct_parm_expr): New fcns
that remove symbols that are not PDT parameters from the type
specification expressions.
(insert_parameter_exprs): Process function symbols as if they
are variables in the substitution with parameter expressions.
(gfc_get_pdt_instance): Make sure that the parameter list of
PDT components is updated as the instance is built. Move the
construction of pdt_strings down a bit in the function and
remove the tie up with pdt_arrays.
* gfortran.h: Add prototype for gfc_correct_parm_expr.
* resolve.cc (resolve_component): Skip testing for constant
specification expressions in pdt_template component string
lengths and pdt_strings.
* trans-array.cc (structure_alloc_comps): Remove testing for
deferred parameters and instead make sure that components of
PDT type have parameters substituted with the parameter exprs
of the enclosing PDT.
gcc/testsuite/
PR fortran/93175
PR fortran/102240
PR fortran/102686
* gfortran.dg/pdt_55.f03: New test.
I think the bool pattern recognition for a store from a bool we
decided to represent with a mask type is a bit confused. The
following streamlines it by using the mask to create a data 0/1
and first possibly converting the mask according to the vector
data type we produce (that was missing and is noticable in PR110223).
This alone doesn't fix the 2nd testcase from the PR, but is required.
PR tree-optimization/110223
* tree-vect-patterns.cc (vect_recog_bool_pattern): Fix
mistakes in the store-from-mask bool pattern. Add
required mask conversions.
We miss to add a mask conversion from the mask producer to the
appropriate mask for the condition operation. The following moves
required helpers and adds the missing part of the pattern. That's
required both for the case we have different mask element sizes
and for the case we have a different number of elements because
cond expression vectorization doesn't handle the mask having
different nunits than the data vector.
PR tree-optimization/105490
* tree-vect-patterns.cc (build_mask_conversion): Move earlier.
(vect_convert_mask_for_vectype): Likewise.
(vect_recog_bool_pattern): Remove redundant truth type
construction. Add missing possibly required mask conversion.
* gcc.dg/vect/vect-cond-14.c: New testcase.
Before C2y, a tentative definition (file-scope, not extern, no
initializer) with internal linkage and incomplete type was undefined
behavior ("shall" outside Constraints violated). In C2y, this has
changed to a constraint violation if the type has not been completed
by the end of the translation unit, and is valid if the type has been
completed by the end of the translation unit. This change originates
from N3347 but the wording accepted into C2y was that from reflector
message 26758.
In GCC, the case of incomplete array types was a hard error with
-pedantic, rather than a pedwarn, contrary to how -pedantic is
supposed to behave; bug 26581 requested a change to allow this case
with -pedantic (i.e. the change made in C2y). For incomplete structs
and unions, GCC only diagnoses them if the type remains incomplete at
the end of the translation unit; bug 88727 (*not* fixed here) requests
the case where the type gets completed should also be diagnosed as a
quality of implementation matter (and that bug is still applicable for
pre-C2y langauge versions and -Wc23-c2y-compat).
Change the handling of arrays following C2y; the previous error
becomes a pedwarn_c23 while there is a new error at the end of the
translation unit if the type remains incomplete there in C2y mode.
There is an ambiguity in the wording in C2y for the case where the
type gets completed only in an inner scope; I've raised that in
reflector message 34118.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
PR c/26581
gcc/c/
* c-decl.cc (c_finish_incomplete_decl): Give error for tentative
definition of incomplete array for C2y with internal linkage.
(finish_decl): Do not set DO_DEFAULT based on -pedantic. Use
pedwarn_c23 for missing array sizes for internal linkage.
gcc/testsuite/
* gcc.dg/c23-incomplete-2.c, gcc.dg/c23-incomplete-3.c,
gcc.dg/c23-incomplete-4.c, gcc.dg/c2y-incomplete-4.c,
gcc.dg/c2y-incomplete-5.c: New tests.
* gcc.dg/c23-thread-local-2.c, gcc.dg/c2y-incomplete-1.c: Update
expected errors.
Since _Decimal128 arithmetic requires the round-to-nearest rounding
mode, define DFP_INIT_ROUNDMODE and DFP_RESTORE_ROUNDMODE, similar to
FP_INIT_ROUNDMODE in sfp-machine.h, to set the rounding mode to
round-to-nearest at _Decimal128 related arithmetic function entrances
and restores it upon return. This doesn't require linking with libm
when libgcc is used.
libgcc/
PR target/120691
* Makefile.in (DECNUMINC): Add -I$(srcdir)/config/$(cpu_type).
* config/i386/dfp-machine.h: New file.
* config/i386/32/dfp-machine.h: Likewise.
* config/i386/64/dfp-machine.h: Likewise.
libgcc/config/libbid/
PR target/120691
* bid128_div.c: Run DFP_INIT_ROUNDMODE at function entrace and
DFP_RESTORE_ROUNDMODE at function exit.
* bid128_rem.c: Likewise.
* bid128_sqrt.c: Likewise.
* bid64_div.c (bid64_div): Likewise.
* bid64_sqrt.c (bid64_sqrt): Likewise.
* bid_conf.h: Include <dfp-machine.h>.
* dfp-machine.h: New file.
gcc/testsuite/
PR target/120691
* gcc.target/i386/pr120691.c: New test.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
I previously tried to clobber an array as a whole, but fell back on a loop
due to issues with std::construct_at following the resolution of LWG3436.
But the loop seems to make life hard for the optimizers and it occurs to me
that for a one-element array we can just clobber the element type.
This also fixes some xfails in Warray-bounds-20.C.
gcc/cp/ChangeLog:
* init.cc (build_new_1): Clobber a constant-bound array as a whole.
gcc/testsuite/ChangeLog:
* g++.dg/warn/Warray-bounds-20.C: Remove xfails, add diags.
avr.cc::avr_out_extr() and avr.cc::avr_out_extr_not()
changed xop for output, which spoiled the operand for
the next invokation, running into an assertion.
This patch makes a local copy of the operands.
PR target/122187
gcc/
* config/avr/avr.cc (avr_out_extr, avr_out_extr_not):
Make a local copy of the passed rtx[] operands.
gcc/testsuite/
* gcc.target/avr/torture/pr122187.c: New test.
Hi,
In shuffle_series_pattern we use series_p to determine if the permute
mask is a simple series. This didn't take into account that series_p
also returns true for e.g. {0, 3, 2, 1} where the step is 3 and the
indices form a series modulo 4.
We emit
vid + vmul
in order to synthesize a series. In order to be always correct we would
need a vrem afterwards still which does not seem worth it.
This patch adds the modulo for VLA permutes and punts if we wrap around
for VLS permutes. I'm not really certain whether we'll really see a wrapping
VLA series (certainly we haven't so far in the test suite) but as we observed
a VLS one here now it appears conservatively correct to module the indices.
Regtested on rv64gcv_zvl512b.
Regards
Robin
PR target/121845
gcc/ChangeLog:
* config/riscv/riscv-v.cc (shuffle_series_patterns):
Modulo indices for VLA and punt when wrapping for VLS.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr121845.c: New test.
Ensure the second pivot is really a pivot and it's not in OP1.
PR target/122124
gcc/ChangeLog:
* config/riscv/riscv-v.cc (shuffle_slide_patterns): Check if
the second pivot is in OP1 and improve comments.
gcc/testsuite/ChangeLog:
* gcc.target/riscv/rvv/autovec/pr122124.c: New test.
2025-10-07 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/102901
* trans-array.cc (structure_alloc_comps): Do not use
gfc_check_pdt_dummy with pointer or allocatable components.
gcc/testsuite/
PR fortran/102901
* gfortran.dg/pdt_56.f03: Copy of pdt_13.f03 compiled with
-fcheck=all.
Like r16-4120-ge1b9ccaa10df01 this is a false positive, but we can just
initialize the variable.
libstdc++-v3/ChangeLog:
* testsuite/std/time/parse/parse.cc: Initialize variable.
The __throw_out_of_range_fmt function works like fprintf and so the
arguments corresponding to %zu specifiers need to be size_t. The
std::basic_string<C,T,A>::size_type type is A::size_type which is not
necessarily size_t. Add explicit casts to avoid a -Wformat warning with
-Wsystem-headers.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (basic_string::_M_check): Cast
size_type arguments to size_t.
When I tried to fix this before I didn't realize there was already a pattern for
`-(a ptrdiff b) -> (b ptrdiff a)`, I had added a complex pattern to match `ptr0 - (ptr0 - ptr1)`.
But with there being a pattern for `-(a ptrdiff b)`, we just need to extend the pattern
to support a nop conversion inbetween the negative and the ptrdiff.
Also the check for TYPE_OVERFLOW_UNDEFINED was wrong, in the case of `-(a - b) -> (b - a)`, the check
is !TYPE_OVERFLOW_SANITIZED so this pattern should use the same check.
Bootstrapped and tested on x86_64-linux-gnu.
Changes since v1:
* v2: Use the old type of the pointer_diff rather than ssizetype.
PR tree-optimization/121921
gcc/ChangeLog:
* match.pd (`-(a ptrdiff b)`): Extend for a nop_convert
between the neg and ptrdiff.
gcc/testsuite/ChangeLog:
* gcc.dg/pr121921-1.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
cselim (and the phiopt's cselim-limited) can commonalize a single
store which makes this too limited in some/many cases. Instead let's
commonalize all trailing stores as much as possible (only in the same
order).
The change is smallish, basically the restriction on being the only store
is removed from single_trailing_store_in_bb (renamed too). And also
looping to remove all of the trailing stores instead of just doing one for
the pass.
Note sink will do the same optimization so doing it earlier seems like a good
idea because it improve change inlining size estimates.
For an example with this change, early inlining can happen for min_cmp<long int>
in g++.dg/opt/pr122083-1.C now; that avoids a -Wnonnull warning as the memcmp with
the null argument is optimized early. It can also catch some min in phiopt1 in some
cases.
Bootstrapped and tested on x86_64-linux-gnu.
Changes since v1:
* v2: For !flag_expensive_optimizations, handle the only store rather than just the last
store.
PR tree-optimization/122083
gcc/ChangeLog:
* tree-ssa-phiopt.cc (single_trailing_store_in_bb): Rename to ...
(trailing_store_in_bb): This and take new argument to check for
only store.
(cond_if_else_store_replacement_limited): Update to use
trailing_store_in_bb.
(cond_if_else_store_replacement): Loop until
cond_if_else_store_replacement_limited returns false.
(pass_phiopt::execute): Instead of calling cond_if_else_store_replacement_limited
once, also loop on it.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/ssa-pre-19.c: Disable phiopt and cselim.
* g++.dg/opt/pr122083-1.C: New test.
* gcc.dg/tree-ssa/cselim-1.c: New test.
* gcc.dg/tree-ssa/cselim-2.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
This is a small compile time optimization where if commonalizing stores
that have the same rhs, a phi node does not need to be created.
This uses the same code as what was added for the `= {};` case.
The reason why it is a compile time optimization is that Copy prop
later on will do the same thing so not creating a new phi and a new
ssa name will have a small compile time improvement.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/122155
gcc/ChangeLog:
* tree-ssa-phiopt.cc (cond_if_else_store_replacement_1): Don't
create a phi if the 2 rhs are the same.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/cselim-3.c: New test.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
The profile mismatches uncovered by my merge_blocks change are actually caused
by tree-ssa-dce not updating profile of blocks with no statements for whose it
optimized away control dependencies. In most cases those basic blocks are
merged or skipped as forwarders. I tried to simply set their count as
uninitialized but that upsets verifier since in some cases we keep the block
around (for example, when it is header of a loop).
In all cases I debugged we optimized away an unnecesary loop and while merging
old code picked porfile of loop preheader, while we now pick loop header. This
is however not guaranteed and we may process blocks in different order and pick
wrong profile.
Since regions of dead basic blocks must be acyclic it is easy to propagate the
frequencies as implemented by this patch.
Bootstrapped/regtested x86_64-linux. Comitted
gcc/ChangeLog:
PR middle-end/122122
* tree-cfgcleanup.cc (tree_forwarder_block_p): Cleanup.
* tree-ssa-dce.cc (propagate_counts): New function.
(eliminate_unnecessary_stmts): Use it.
Rather than trying to be smart, if the bitmask changes, adjust all range
bounds to satisfy the bitmask requirements.
PR tree-optimization/121206
gcc/
* value-range.cc (irange::intersect_bitmask): Always call
set_range_from_bitmask if the bitmask changes.
gcc/testsuite
* gcc.dg/pr121987.c: New.