bors[bot] [Mon, 13 Feb 2023 11:15:24 +0000 (11:15 +0000)]
Merge #1750
1750: Implement fixed point macro expansion r=CohenArthur a=CohenArthur
This is a cleanup of #1606's branch, which also contains the code necessary for performing eager macro expansion in builtin macros.
This commit changes our macro expansion system from an eager and recursive
macro expansion to a fixed-point like system. Instead of, when seeing
a macro invocation, expanding it and all of the macros within it, we
now perform multiple passes of expansion on the entire crate.
This, however, leads to a problem. Rust macros are expanded lazily, but
Rust builtin macros should be expanded eagerly. Due to this, we must
work around the lazy expansion in builtin macros and perform eager
expansion for each pass of the fixed-point, before finally expanding
the builtin when there are no longer any inner macro invocations.
To perform proper macro scoping, the ENR now keeps track of the current
scope (`current_scope` member) and resolves macros accordingly.
This is done through the use of the `scoped` method, which creates a new
scope, runs a specified lambda and then exits the scope. This prevents
pushing/popping errors that we've seen happen already in similar
contexts.
We might think about generalizing it to other classes, providing a
`Scoped<EntryFn, ExitFn>` class or similar
Fixes #1795
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
bors[bot] [Fri, 10 Feb 2023 10:17:07 +0000 (10:17 +0000)]
Merge #1810 #1823 #1824 #1837 #1839
1810: fixed indentation in AST pretty printed expanded dump of trait. r=CohenArthur a=00AR
fixes #1785
Signed-off-by: Abdul Rafey <abdulrafeyq@gmail.com>
---
In Dump::visit (TraitImpl), the for loop adds indentation before calling visit () on every iteration. I think when Dump::visit (Method) is executed it adds extra indentation on top of it.
1823: parser: Improve parsing of complex generic arguments r=CohenArthur a=CohenArthur
The parser was missing code for handling complex type arguments such as type paths or nested generics.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_generic_arg): Handle type paths and nested generics properly.
gcc/testsuite/ChangeLog:
* rust/compile/parse_complex_generic_application.rs: New test.
* rust/compile/parse_complex_generic_application2.rs: New test.
1824: parser: Fix parsing of closure param list r=CohenArthur a=CohenArthur
Arthur Cohen [Wed, 18 Jan 2023 11:23:37 +0000 (12:23 +0100)]
macros: Perform macro expansion in a fixed-point fashion.
This commit changes our macro expansion system from an eager and recursive
macro expansion to a fixed-point like system. Instead of, when seeing
a macro invocation, expanding it and all of the macros within it, we
now perform multiple passes of expansion on the entire crate.
This, however, leads to a problem. Rust macros are expanded lazily, but
Rust builtin macros should be expanded eagerly. Due to this, we must
work around the lazy expansion in builtin macros and perform eager
expansion for each pass of the fixed-point, before finally expanding
the builtin when there are no longer any inner macro invocations.
To perform proper macro scoping, the ENR now keeps track of the current
scope (`current_scope` member) and resolves macros accordingly.
This is done through the use of the `scoped` method, which creates a new
scope, runs a specified lambda and then exits the scope. This prevents
pushing/popping errors that we've seen happen already in similar
contexts.
We might think about generalizing it to other classes, providing a
`Scoped<EntryFn, ExitFn>` class or similar
gcc/rust/ChangeLog:
* ast/rust-macro.cc: New file.
* Make-lang.in: Add `rust-macro.o` object
* ast/rust-ast-fragment.cc (Fragment::Fragment): Change API around
the construction of AST fragments.
(Fragment::operator=): Correct `Fragment::operator=` to take into
account the fragment tokens.
(Fragment::create_error): Use new constructor.
(Fragment::complete): Remove in favor of new constructor.
(Fragment::unexpanded): Remove as that Fragment type is no longer used
or possible.
(Fragment::get_tokens): Add helper to access a fragment's tokens.
* ast/rust-ast-fragment.h (enum class): Remove `FragmentKind::Unused`
* ast/rust-ast.cc (MacroInvocation::as_string): Display
builtin macro invocations properly.
* ast/rust-ast.h: Fix `DelimTokenTree` class copy constructors and
handling of its token vector.
* ast/rust-macro.h (class MacroMatcher): Format.
(class MetaItemSeq): Likewise.
(builtin_macro_from_string): Get a `BuiltinMacroKind` from a given
string, i.e the name of the macro (`assert!`, `cfg!` and so on).
* expand/rust-attribute-visitor.cc (AttrVisitor::visit): Do not expand
macros recursively anymore.
(AttrVisitor::maybe_expand_expr): Likewise.
(AttrVisitor::maybe_expand_type): Likewise.
* expand/rust-attribute-visitor.h: Likewise, and remove
`expand_macro_fragment_recursively` function.
* expand/rust-macro-builtins.cc (make_token): Add shorthand for
returning `std::unique_ptr<AST::Token>`s.
(make_macro_invocation): Add shorthand for returning fragments
containing builtin macro invocations.
(try_expand_macro_expression): Do not expand macros recursively.
(try_expand_single_string_literal): Likewise.
(try_expand_many_expr): Likewise.
(parse_single_string_literal): Error out more appropriately.
(MacroBuiltin::file_handler): Return the proper tokens associated with
macro invocation, and builtin macros in the case of necessary eager
expansion.
(MacroBuiltin::column_handler): Likewise.
(MacroBuiltin::include_bytes_handler): Likewise.
(MacroBuiltin::include_str_handler): Likewise.
(MacroBuiltin::concat_handler): Likewise.
(MacroBuiltin::env_handler): Likewise.
(MacroBuiltin::cfg_handler): Likewise.
(MacroBuiltin::include_handler): Likewise.
(MacroBuiltin::line_handler): Likewise.
* expand/rust-macro-expand.cc (MacroExpander::expand_eager_invocations):
Add function to expand eager invocations *once* in the fixed point
pipeline.
(MacroExpander::expand_invoc): Call into `expand_eager_invocations` for
builtin macro invocations.
(MacroExpander::expand_crate): Use new `AttrVisitor` API.
(parse_many): Return tokens in `AST::Fragment`.
(transcribe_expression): Likewise.
(transcribe_type): Likewise.
* expand/rust-macro-expand.h (struct MacroExpander): Add `has_changed`
flag for fixed point checking.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::EarlyNameResolver):
Keep track of the current macro scope.
(EarlyNameResolver::go): Use `scoped` API.
(EarlyNameResolver::visit): Likewise.
* resolve/rust-early-name-resolver.h: Add `scoped` API.
* rust-session-manager.cc (Session::expansion): Perform macro expansion
in a fixed-point fashion.
gcc/testsuite/ChangeLog:
* rust/compile/macro17.rs: Fix testsuite for new recursion errors.
* rust/compile/macro44.rs: Fix invalid testcase assertions.
* rust/compile/builtin_macro_recurse.rs: Fix invalid test.
* rust/compile/builtin_macro_recurse2.rs: New test.
* rust/compile/macro46.rs: New test.
Arthur Cohen [Wed, 18 Jan 2023 11:23:03 +0000 (12:23 +0100)]
macro: Allow builtin `MacroInvocation`s within the AST
This commit turns AST::MacroInvocation into a sum type.
The class can now represent a regular macro invocation (lazily expanded)
or a builtin one (eagerly expanded)
gcc/rust/ChangeLog:
* expand/rust-macro-builtins.cc (make_macro_invocation): Add short hand
function for returning fragments containing macro invocations.
(MacroBuiltin::compile_error_handler): Add explanation for eager
invocation
Philip Herron [Tue, 31 Jan 2023 18:52:33 +0000 (18:52 +0000)]
gccrs: Fix higher ranked trait bounds computation of self
This updates the higher ranked trait bounds computation to handle ambigious
cases. When we have a slice for example:
let slice = &a[1..3];
This works by reusing the Index operator overload from libcore, so when the
index range of 1..3 is computed, the type system needs to compute what the
types of index are; this works by integer inference variables
Range<<integer>> that need to be unified with the impl Index for
Range<Usize> which computes the real type of usize for the index. This is
fine but what happens when we have the Copy and Clone traits bounds which
have implementations for all the primitive types i8, i16, i32, i64...
which is valid for any integer inference variable so the code prior to this
patch would have grabbed the first impl it would have found and used it
which is incorrect. When we have integer or float inference variables we
need to look for their respective defaults or emit an ambigious type bound
error.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
Philip Herron [Tue, 31 Jan 2023 14:27:49 +0000 (14:27 +0000)]
gccrs: Fix nullptr dereference
When we check if this is concrete the guard checks to ensure the argument
is non null but the check here is wrongly returning early when the check
is non null meaning when it is null and therefore not concrete it will
end up doing a null dereference.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
Philip Herron [Mon, 30 Jan 2023 18:19:07 +0000 (18:19 +0000)]
gccrs: Refactor the type unification code
This refactors the unification systems to be a consistent interface using
switch statements and simple functions instead of the old clunky visitor
system. This is more maintainable as it is harder to miss cases when we
can take advantages of switch statements.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
Philip Herron [Fri, 27 Jan 2023 15:38:58 +0000 (15:38 +0000)]
gccrs: Remove monomorphization hack to setup possible associated types
During CallExpr argument type checking we may be calling a default
implementation of a trait function this will require any possible
associated types to be resolved and setup. This monomoprhization call does
this but it will premtivly do extra unification of types which will throw
off type checking later on. This fix is required for my work into type
bounds checking.
Fixes #1773
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
Philip Herron [Fri, 27 Jan 2023 18:31:11 +0000 (18:31 +0000)]
gccrs: Clear the substitution callbacks when copying ArgumentMappings
When we set the callback on substitutions this is not safe to be copied
around since we store the used argument mappings and can reuse them in
different contexts. This clears the callback on copy's to make it safer.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
Philip Herron [Fri, 27 Jan 2023 18:28:06 +0000 (18:28 +0000)]
gccrs: Refactor handle_substitutions to take a reference
This patch changes the recusive substitution code to take a reference
instead of a copy. This is important as the callback field is going to be
made non-copyable in a future patch and this pipeline is for recursive
substitutions so its ok to reuse the same mappings here.
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/ChangeLog:
bors[bot] [Fri, 3 Feb 2023 13:28:26 +0000 (13:28 +0000)]
Merge #1698
1698: update the ubuntu version r=CohenArthur a=ArshErgon
Fixes: #1689
updated the ubuntu-version from 20.04 to 22.04
Thank you for making Rust GCC better!
If your PR fixes an issue, you can add "Fixes #issue_number" into this
PR description and the git commit message. This way the issue will be
automatically closed when your PR is merged. If your change addresses
an issue but does not fully fix it please mark it as "Addresses #issue_number"
in the git commit message.
Here is a checklist to help you with your PR.
- \[ ] GCC development requires copyright assignment or the Developer's Certificate of Origin sign-off, see https://gcc.gnu.org/contribute.html or https://gcc.gnu.org/dco.html
- \[ ] Read contributing guidlines
- \[ ] `make check-rust` passes locally
- \[ ] Run `clang-format`
- \[ ] Added any relevant test cases to `gcc/testsuite/rust/`
Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.
---
*Please write a comment explaining your change. This is the message
that will be part of the merge commit.
The parser now recursively tries to parse a reference type after seeing a `&` or `&&` token.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_type): Handle double ampersan properly (Parser::parse_reference_type): Call into `parse_reference_type_inner` and wrap double reference types in another `AST::ReferenceType` node (Parser::parse_reference_type_inner): Add parsing implementation which does not care about the leading token (& or &&) (Parser::parse_type_no_bounds): Handle double ampersand properly
* parse/rust-parse.h: Declare `parse_reference_type_inner`
gcc/testsuite/ChangeLog:
* rust/compile/multi_reference_type.rs: New test.
Addresses #1807 partly
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Last we did #1700 "Merge upstream, last commit before GCC/Rust upstreaming",
which merged commit b4fddbe9592e9feb37ce567d90af822b75995531 from GCC upstream
master branch.
- dd950cbbb97 Use DW_ATE_UTF for the Rust 'char' type
- b772a504eff gccrs: Add necessary hooks for a Rust front-end testsuite
- 4b8f3005af0 gccrs: Add Debug info testsuite
- f60df7e6202 gccrs: Add link cases testsuite
- 97705b4459b gccrs: Add general compilation test cases
- 5a56869d6e3 gccrs: Add execution test cases
- dc4171edb3c gccrs: Add gcc-check-target check-rust
- 6b35ae12ce9 gccrs: Add Rust front-end base AST data structures
- 438ae944fa6 gccrs: Add definitions of Rust Items in AST data structures
- d588754c826 gccrs: Add full definitions of Rust AST data structures
- 5b981e9c741 gccrs: Add Rust AST visitors
- 18f6990f842 gccrs: Add Lexer for Rust front-end
- 35e4f3b4af4 gccrs: Add Parser for Rust front-end pt.1
- 32c8fb0eeaf gccrs: Add Parser for Rust front-end pt.2
- 1841081a8a3 gccrs: Add expansion pass for the Rust front-end
- 85a8fe00f80 gccrs: Add name resolution pass to the Rust front-end
- 8ad1d56d68a gccrs: Add declarations for Rust HIR
- 7641eaead40 gccrs: Add HIR definitions and visitor framework
- 7999cf327de gccrs: Add AST to HIR lowering pass
- b32b1b1576a gccrs: Add wrapper for make_unique
- c7f8347e83c gccrs: Add port of FNV hash used during legacy symbol mangling
- 15b0278905e gccrs: Add Rust ABI enum helpers
- eb10bc5225e gccrs: Add Base62 implementation
- 9a4fee5f57c gccrs: Add implementation of Optional
- 2e7fc8780e0 gccrs: Add attributes checker
- 9ce37e72062 gccrs: Add helpers mappings canonical path and lang items
- c6c3db21769 gccrs: Add type resolution and trait solving pass
- 24393cb68fa gccrs: Add Rust type information
- 06688fe40a2 gccrs: Add remaining type system transformations
- b1b35204d8a gccrs: Add unsafe checks for Rust
- 5215235f016 gccrs: Add const checker
- ca246e573fb gccrs: Add privacy checks
- 520b52b24e7 gccrs: Add dead code scan on HIR
- 4d67468d1d4 gccrs: Add unused variable scan
- 509e4c32c6a gccrs: Add metadata output pass
- 15f04af347e gccrs: Add base for HIR to GCC GENERIC lowering
- 019b2f15581 gccrs: Add HIR to GCC GENERIC lowering for all nodes
- cfbda2f78ba gccrs: Add HIR to GCC GENERIC lowering entry point
- fe6264fa28a gccrs: These are wrappers ported from reusing gccgo
- bba14a0790f gccrs: Add compiler driver
- ea34614225d gccrs: Compiler proper interface kicks off the pipeline
- ab1e0db43c2 gccrs: Add lang-spec.h
- 5e7d199739f gccrs: Add lang.opt
- 88415d33bb3 gccrs: Add GCC Rust front-end Make-lang.in
- b07ef39ffbf gccrs: Add fatal_error when experimental flag is not present
- a75f038c069 gccrs: Add config-lang.in
- edc676cfe89 gccrs: Add README, CONTRIBUTING and compiler logo
This merge is done with `git merge --strategy=ours`, so that we effectively
don't bring any changes. Rationale: any changes due to upstream review etc.,
have already been applied individually to GCC/Rust master branch, and any
remaining changes we'd either like to persist, or assess individually, later.
Co-authored-by: Tom Tromey <tom@tromey.com> Co-authored-by: Philip Herron <philip.herron@embecosm.com> Co-authored-by: Joel Phillips <simplytheother@gmail.com> Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Arthur Cohen [Wed, 1 Feb 2023 10:40:13 +0000 (11:40 +0100)]
parser: Allow parsing multiple reference types
The parser now recursively tries to parse a reference type after seeing
a `&` or `&&` token.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_type): Handle double ampersan
properly
(Parser::parse_reference_type): Call into `parse_reference_type_inner`
and wrap double reference types in another `AST::ReferenceType` node
(Parser::parse_reference_type_inner): Add parsing implementation
which does not care about the leading token (& or &&)
(Parser::parse_type_no_bounds): Handle double ampersand properly
* parse/rust-parse.h: Declare `parse_reference_type_inner`
Last we did #1700 "Merge upstream, last commit before GCC/Rust upstreaming",
which merged commit b4fddbe9592e9feb37ce567d90af822b75995531 from GCC upstream
master branch.
- dd950cbbb97 Use DW_ATE_UTF for the Rust 'char' type
- b772a504eff gccrs: Add necessary hooks for a Rust front-end testsuite
- 4b8f3005af0 gccrs: Add Debug info testsuite
- f60df7e6202 gccrs: Add link cases testsuite
- 97705b4459b gccrs: Add general compilation test cases
- 5a56869d6e3 gccrs: Add execution test cases
- dc4171edb3c gccrs: Add gcc-check-target check-rust
- 6b35ae12ce9 gccrs: Add Rust front-end base AST data structures
- 438ae944fa6 gccrs: Add definitions of Rust Items in AST data structures
- d588754c826 gccrs: Add full definitions of Rust AST data structures
- 5b981e9c741 gccrs: Add Rust AST visitors
- 18f6990f842 gccrs: Add Lexer for Rust front-end
- 35e4f3b4af4 gccrs: Add Parser for Rust front-end pt.1
- 32c8fb0eeaf gccrs: Add Parser for Rust front-end pt.2
- 1841081a8a3 gccrs: Add expansion pass for the Rust front-end
- 85a8fe00f80 gccrs: Add name resolution pass to the Rust front-end
- 8ad1d56d68a gccrs: Add declarations for Rust HIR
- 7641eaead40 gccrs: Add HIR definitions and visitor framework
- 7999cf327de gccrs: Add AST to HIR lowering pass
- b32b1b1576a gccrs: Add wrapper for make_unique
- c7f8347e83c gccrs: Add port of FNV hash used during legacy symbol mangling
- 15b0278905e gccrs: Add Rust ABI enum helpers
- eb10bc5225e gccrs: Add Base62 implementation
- 9a4fee5f57c gccrs: Add implementation of Optional
- 2e7fc8780e0 gccrs: Add attributes checker
- 9ce37e72062 gccrs: Add helpers mappings canonical path and lang items
- c6c3db21769 gccrs: Add type resolution and trait solving pass
- 24393cb68fa gccrs: Add Rust type information
- 06688fe40a2 gccrs: Add remaining type system transformations
- b1b35204d8a gccrs: Add unsafe checks for Rust
- 5215235f016 gccrs: Add const checker
- ca246e573fb gccrs: Add privacy checks
- 520b52b24e7 gccrs: Add dead code scan on HIR
- 4d67468d1d4 gccrs: Add unused variable scan
- 509e4c32c6a gccrs: Add metadata output pass
- 15f04af347e gccrs: Add base for HIR to GCC GENERIC lowering
- 019b2f15581 gccrs: Add HIR to GCC GENERIC lowering for all nodes
- cfbda2f78ba gccrs: Add HIR to GCC GENERIC lowering entry point
- fe6264fa28a gccrs: These are wrappers ported from reusing gccgo
- bba14a0790f gccrs: Add compiler driver
- ea34614225d gccrs: Compiler proper interface kicks off the pipeline
- ab1e0db43c2 gccrs: Add lang-spec.h
- 5e7d199739f gccrs: Add lang.opt
- 88415d33bb3 gccrs: Add GCC Rust front-end Make-lang.in
- b07ef39ffbf gccrs: Add fatal_error when experimental flag is not present
- a75f038c069 gccrs: Add config-lang.in
- edc676cfe89 gccrs: Add README, CONTRIBUTING and compiler logo
This merge is done with `git merge --strategy=ours`, so that we effectively
don't bring any changes. Rationale: any changes due to upstream review etc.,
have already been applied individually to GCC/Rust master branch, and any
remaining changes we'd either like to persist, or assess individually, later.
bors[bot] [Tue, 31 Jan 2023 21:46:24 +0000 (21:46 +0000)]
Merge #1788
1788: ci: Add commit format checker r=CohenArthur a=CohenArthur
Bring over the commit checker from `gcc-patch-dev` with the `gccrs` prefix checker enabled only for `gcc-patch-dev` PRs. I'll open up an issue to make sure that in the future it's easier to keep that folder in sync between the two branches
Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Jakub Jelinek [Tue, 31 Jan 2023 09:12:19 +0000 (10:12 +0100)]
i386: Fix up ix86_convert_const_wide_int_to_broadcast [PR108599]
The following testcase is miscompiled. The problem is that during
RTL DSE we see a V4DI register is being loaded { 16, 16, 0, 0 }
value and DSE mostly works in terms of scalar modes, so it calls
movoi to set an OImode REG to (const_wide_int 0x100000000000000010)
and ix86_convert_const_wide_int_to_broadcast thinks it can compute
that value by broadcasting DImode 0x10. While it is true that
for TImode result the broadcast could be used, for OImode/XImode
it can't be, because all but the lowest 2 HOST_WIDE_INTs aren't
present (so are 0 or -1 depending on sign), not 0x10 in this case.
The function checks if the least significant HOST_WIDE_INT elt
of the CONST_WIDE_INT is broadcastable from QI/HI/SI/DImode and then
/* Check if OP can be broadcasted from VAL. */
for (int i = 1; i < CONST_WIDE_INT_NUNITS (op); i++)
if (val != CONST_WIDE_INT_ELT (op, i))
return nullptr;
That is needed of course, but nothing checks that
CONST_WIDE_INT_NUNITS (op) isn't too small for the mode in question.
I think if op would be 0 or -1, it ought to be never CONST_WIDE_INT,
but CONST_INT and so we can just punt whenever the number of
CONST_WIDE_INT elts is not the expected one.
2023-01-31 Jakub Jelinek <jakub@redhat.com>
PR target/108599
* config/i386/i386-expand.cc
(ix86_convert_const_wide_int_to_broadcast): Return nullptr if
CONST_WIDE_INT_NUNITS (op) times HOST_BITS_PER_WIDE_INT isn't
equal to bitsize of mode.
Xianmiao Qu [Tue, 31 Jan 2023 08:49:06 +0000 (09:49 +0100)]
testsuite/108604 - gcc.dg/torture/pr108574-3.c hangs on unsigned char archs
In the architecture where sign defaults to unsigned, the 'f' will be zero
extended to int type in the expression 'd = ~(f & ~2880764155)', then the
'd' will become -1 wich cause the case to fail.
So it's ok for the architectures where sign defaults to signed like x86,
but failed for the architectures where sign defaults to unsigned like arm
and csky. Change char to signed char to avoid this problem.
PR testsuite/108604
gcc/testsuite:
* gcc.dg/torture/pr108574-3.c (b, f): Change type from char to
signed char.
Jakub Jelinek [Tue, 31 Jan 2023 08:46:35 +0000 (09:46 +0100)]
bbpart: Fix up ICE on asm goto [PR108596]
On the following testcase we have asm goto in hot block with 2 successors,
one cold to which it both falls through and has one of the label
pointing to it and another hot successor with another label.
Now, during bbpart we want to ensure that no blocks from one partition fall
through into a block in a different partition. fix_up_fall_thru_edges
does that by temporarily clearing the EDGE_CROSSING on the fallthrough edge,
calling force_nonfallthru and then depending on whether it created a new
bb either set EDGE_CROSSING on the single successor edge from the new bb
(the new bb is kept in the same partition as the predecessor block), or
if no new bb has been created setting EDGE_CROSSING back on the fallthru
edge which has been forced non-EDGE_FALLTHRU.
For asm goto this doesn't always work, force_nonfallthru can create a new bb
and change the fallthrough edge to point to that, but if the original
fallthru destination block has its label referenced among the asm goto
labels, it will create a new non-fallthru edge for the label(s).
But because we've temporarily cheated and cleared EDGE_CROSSING on the edge,
it is cleared on the new edge as well, then the caller sees we've created
a new bb and just sets EDGE_CROSSING on the single fallthru edge from the
new bb. But the direct edge from cur_bb to fallthru edge's destination
isn't handled and fails afterwards consistency checks, because it crosses
partitions.
The following patch notes the case and sets EDGE_CROSSING on that edge too.
2023-01-31 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/108596
* bb-reorder.cc (fix_up_fall_thru_edges): Handle the case where cur_bb
ends with asm goto and has a crossing fallthrough edge to the same bb
that contains at least one of its labels by restoring EDGE_CROSSING
flag even on possible edge from cur_bb to new_bb successor.
Jakub Jelinek [Tue, 31 Jan 2023 08:20:34 +0000 (09:20 +0100)]
i386: Fix up -Wuninitialized warnings in avx512erintrin.h [PR105593]
As reported in the PR, there are some -Wuninitialized warnings in
avx512erintrin.h. One can see that by compiling sse-23.c testcase with
-Wuninitialized (or when actually using those intrinsics).
Those 6 spots use an uninitialized variable and pass it as one of the
argument to a builtin with constant mask -1, because there is no unmasked
builtin. It is true that expansion of those builtins into RTL will see
mask is all ones and ignore the unneeded argument, but -Wuninitialized
is diagnosed on GIMPLE and on GIMPLE these builtins are just builtin calls.
avx512fintrin.h and other headers use in these cases the _mm*_undefined_* ()
intrinsics, like:
return (__m512i) __builtin_ia32_psrav8di_mask ((__v8di) __X,
(__v8di) __Y,
(__v8di)
_mm512_undefined_epi32 (),
(__mmask8) -1);
etc. and the following patch does the same for avx512erintrin.h.
With the recent changes in C++ FE and the _mm*_undefined_* intrinsics,
we don't emit -Wuninitialized warnings for those (previously we didn't
just in C due to self-initialization). Of course we could also
just self-initialize these uninitialized vars and add the #pragma GCC
diagnostic dances around it, but using the intrinsics is consistent with
the rest and IMHO cleaner.
2023-01-31 Jakub Jelinek <jakub@redhat.com>
PR c++/105593
* config/i386/avx512erintrin.h (_mm512_exp2a23_round_pd,
_mm512_exp2a23_round_ps, _mm512_rcp28_round_pd, _mm512_rcp28_round_ps,
_mm512_rsqrt28_round_pd, _mm512_rsqrt28_round_ps): Use
_mm512_undefined_pd () or _mm512_undefined_ps () instead of using
uninitialized automatic variable __W.
* gcc.target/i386/sse-23.c: Add -Wuninitialized to dg-options.
Kito Cheng [Tue, 31 Jan 2023 03:48:51 +0000 (11:48 +0800)]
RISC-V: Simplify testcase condition for RVV tests [NFC]
We got some trouble on some platform, it show get twice for the asm, but
it only show once, seems like our pattern might be too complicated, so
simplify that make every platform happey with those testcase.
YunQiang Su [Fri, 6 Jan 2023 10:28:22 +0000 (18:28 +0800)]
libsanitizer/mips: always build with largefile support
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 is always used for mips
when build libsanitizer in LLVM. Thus
FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 176 : 160, 216);
instead of
FIRST_32_SECOND_64((_MIPS_SIM == _ABIN32) ? 160 : 144, 216);
in sanitizer_platform_limits_posix.h.
To keep sync with LLVM and to make the code simple, we use the
largefile options always.
libsanitizer/
* configure.ac: set -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
always for mips*.
* configure: Regenerate.
Gerald Pfeifer [Mon, 30 Jan 2023 22:12:23 +0000 (23:12 +0100)]
libstdc++: Update links in the Memory section of the manual
libstdc++-v3/ChangeLog:
* doc/xml/manual/shared_ptr.xml: Move links from both
http://open-std.org and http://www.open-std.org to
https://www.open-std.org.
* doc/html/manual/memory.html: Regenerate.
Ju-Zhe Zhong [Sun, 29 Jan 2023 23:40:50 +0000 (07:40 +0800)]
RISC-V: Add vloxei64 C++ API intrinsic testcase
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vloxei64-1.C: New test.
* g++.target/riscv/rvv/base/vloxei64-2.C: New test.
* g++.target/riscv/rvv/base/vloxei64-3.C: New test.
* g++.target/riscv/rvv/base/vloxei64_mu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei64_mu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei64_mu-3.C: New test.
* g++.target/riscv/rvv/base/vloxei64_tu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei64_tu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei64_tu-3.C: New test.
* g++.target/riscv/rvv/base/vloxei64_tum-1.C: New test.
* g++.target/riscv/rvv/base/vloxei64_tum-2.C: New test.
* g++.target/riscv/rvv/base/vloxei64_tum-3.C: New test.
* g++.target/riscv/rvv/base/vloxei64_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei64_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei64_tumu-3.C: New test.
Ju-Zhe Zhong [Sun, 29 Jan 2023 23:39:29 +0000 (07:39 +0800)]
RISC-V: Add vloxei32 C++ API intrinsic testcases
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vloxei32-1.C: New test.
* g++.target/riscv/rvv/base/vloxei32-2.C: New test.
* g++.target/riscv/rvv/base/vloxei32-3.C: New test.
* g++.target/riscv/rvv/base/vloxei32_mu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei32_mu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei32_mu-3.C: New test.
* g++.target/riscv/rvv/base/vloxei32_tu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei32_tu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei32_tu-3.C: New test.
* g++.target/riscv/rvv/base/vloxei32_tum-1.C: New test.
* g++.target/riscv/rvv/base/vloxei32_tum-2.C: New test.
* g++.target/riscv/rvv/base/vloxei32_tum-3.C: New test.
* g++.target/riscv/rvv/base/vloxei32_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei32_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei32_tumu-3.C: New test.
Ju-Zhe Zhong [Sun, 29 Jan 2023 23:37:39 +0000 (07:37 +0800)]
RISC-V: Add vloxei16 C++ API intrinsic testcases
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vloxei16-1.C: New test.
* g++.target/riscv/rvv/base/vloxei16-2.C: New test.
* g++.target/riscv/rvv/base/vloxei16-3.C: New test.
* g++.target/riscv/rvv/base/vloxei16_mu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei16_mu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei16_mu-3.C: New test.
* g++.target/riscv/rvv/base/vloxei16_tu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei16_tu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei16_tu-3.C: New test.
* g++.target/riscv/rvv/base/vloxei16_tum-1.C: New test.
* g++.target/riscv/rvv/base/vloxei16_tum-2.C: New test.
* g++.target/riscv/rvv/base/vloxei16_tum-3.C: New test.
* g++.target/riscv/rvv/base/vloxei16_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei16_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei16_tumu-3.C: New test.
Ju-Zhe Zhong [Sun, 29 Jan 2023 23:35:38 +0000 (07:35 +0800)]
RISC-V: Add vloxei8 C++ API intrinsic testcase
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vloxei8-1.C: New test.
* g++.target/riscv/rvv/base/vloxei8-2.C: New test.
* g++.target/riscv/rvv/base/vloxei8-3.C: New test.
* g++.target/riscv/rvv/base/vloxei8_mu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei8_mu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei8_mu-3.C: New test.
* g++.target/riscv/rvv/base/vloxei8_tu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei8_tu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei8_tu-3.C: New test.
* g++.target/riscv/rvv/base/vloxei8_tum-1.C: New test.
* g++.target/riscv/rvv/base/vloxei8_tum-2.C: New test.
* g++.target/riscv/rvv/base/vloxei8_tum-3.C: New test.
* g++.target/riscv/rvv/base/vloxei8_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vloxei8_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vloxei8_tumu-3.C: New test.
Ju-Zhe Zhong [Sun, 29 Jan 2023 23:33:49 +0000 (07:33 +0800)]
RISC-V: Add vluxei64 C++ API intrinsic testcases
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vluxei64-1.C: New test.
* g++.target/riscv/rvv/base/vluxei64-2.C: New test.
* g++.target/riscv/rvv/base/vluxei64-3.C: New test.
* g++.target/riscv/rvv/base/vluxei64_mu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei64_mu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei64_mu-3.C: New test.
* g++.target/riscv/rvv/base/vluxei64_tu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei64_tu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei64_tu-3.C: New test.
* g++.target/riscv/rvv/base/vluxei64_tum-1.C: New test.
* g++.target/riscv/rvv/base/vluxei64_tum-2.C: New test.
* g++.target/riscv/rvv/base/vluxei64_tum-3.C: New test.
* g++.target/riscv/rvv/base/vluxei64_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei64_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei64_tumu-3.C: New test.
Ju-Zhe Zhong [Sun, 29 Jan 2023 23:32:09 +0000 (07:32 +0800)]
RISC-V: Add vluxei32 C++ intrinsic API testcase
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vluxei32-1.C: New test.
* g++.target/riscv/rvv/base/vluxei32-2.C: New test.
* g++.target/riscv/rvv/base/vluxei32-3.C: New test.
* g++.target/riscv/rvv/base/vluxei32_mu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei32_mu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei32_mu-3.C: New test.
* g++.target/riscv/rvv/base/vluxei32_tu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei32_tu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei32_tu-3.C: New test.
* g++.target/riscv/rvv/base/vluxei32_tum-1.C: New test.
* g++.target/riscv/rvv/base/vluxei32_tum-2.C: New test.
* g++.target/riscv/rvv/base/vluxei32_tum-3.C: New test.
* g++.target/riscv/rvv/base/vluxei32_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei32_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei32_tumu-3.C: New test.
Ju-Zhe Zhong [Sun, 29 Jan 2023 23:28:33 +0000 (07:28 +0800)]
RISC-V: Add vluxei16 C++ API intrinsic testcases
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vluxei16-1.C: New test.
* g++.target/riscv/rvv/base/vluxei16-2.C: New test.
* g++.target/riscv/rvv/base/vluxei16-3.C: New test.
* g++.target/riscv/rvv/base/vluxei16_mu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei16_mu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei16_mu-3.C: New test.
* g++.target/riscv/rvv/base/vluxei16_tu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei16_tu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei16_tu-3.C: New test.
* g++.target/riscv/rvv/base/vluxei16_tum-1.C: New test.
* g++.target/riscv/rvv/base/vluxei16_tum-2.C: New test.
* g++.target/riscv/rvv/base/vluxei16_tum-3.C: New test.
* g++.target/riscv/rvv/base/vluxei16_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei16_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei16_tumu-3.C: New test.
Ju-Zhe Zhong [Sun, 29 Jan 2023 23:26:25 +0000 (07:26 +0800)]
RISC-V: Add vluxei8 C++ API intrinsic testcase
gcc/testsuite/ChangeLog:
* g++.target/riscv/rvv/base/vluxei8-1.C: New test.
* g++.target/riscv/rvv/base/vluxei8-2.C: New test.
* g++.target/riscv/rvv/base/vluxei8-3.C: New test.
* g++.target/riscv/rvv/base/vluxei8_mu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei8_mu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei8_mu-3.C: New test.
* g++.target/riscv/rvv/base/vluxei8_tu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei8_tu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei8_tu-3.C: New test.
* g++.target/riscv/rvv/base/vluxei8_tum-1.C: New test.
* g++.target/riscv/rvv/base/vluxei8_tum-2.C: New test.
* g++.target/riscv/rvv/base/vluxei8_tum-3.C: New test.
* g++.target/riscv/rvv/base/vluxei8_tumu-1.C: New test.
* g++.target/riscv/rvv/base/vluxei8_tumu-2.C: New test.
* g++.target/riscv/rvv/base/vluxei8_tumu-3.C: New test.