Jakub Jelinek [Mon, 25 Jun 2018 17:37:02 +0000 (19:37 +0200)]
backport: re PR inline-asm/84941 (internal compiler error: in reg_overlap_mentioned_p, at rtlanal.c:1870 (reg_overlap_mentioned_p()/match_asm_constraints_1()))
Backported from mainline
2018-03-22 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/84941
* function.c (match_asm_constraints_1): Don't do the optimization
if input isn't a REG, SUBREG, MEM or constant.
Jakub Jelinek [Mon, 25 Jun 2018 17:34:55 +0000 (19:34 +0200)]
backport: re PR target/84899 (ICE: in final_scan_insn_1, at final.c:3139 (error: could not split insn))
Backported from mainline
2018-03-16 Jakub Jelinek <jakub@redhat.com>
PR target/84899
* postreload.c (reload_combine_recognize_pattern): Perform
INTVAL addition in unsigned HOST_WIDE_INT type to avoid UB and
truncate_int_for_mode the result for the destination's mode.
Jakub Jelinek [Mon, 25 Jun 2018 17:32:10 +0000 (19:32 +0200)]
backport: re PR c++/84222 ([[deprecated]] class complains about internal class usage)
Backported from mainline
2018-03-15 Jakub Jelinek <jakub@redhat.com>
PR c++/84222
* cp-tree.h (cp_warn_deprecated_use): Declare.
* tree.c (cp_warn_deprecated_use): New function.
* typeck2.c (build_functional_cast): Use it.
* decl.c (grokparms): Likewise.
(grokdeclarator): Likewise. Temporarily push nested class scope
around grokparms call for out of class member definitions.
* g++.dg/warn/deprecated.C (T::member3): Change dg-warning to dg-bogus.
* g++.dg/warn/deprecated-6.C (T::member3): Likewise.
* g++.dg/warn/deprecated-13.C: New test.
Jakub Jelinek [Mon, 25 Jun 2018 17:31:23 +0000 (19:31 +0200)]
backport: re PR target/84772 (powerpc-spe: Spurious "is used uninitialized" warning, or possibly incorrect codegen for va_arg(long double))
Backported from mainline
2018-03-09 Jakub Jelinek <jakub@redhat.com>
PR target/84772
* config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Mark va_arg_tmp
temporary TREE_ADDRESSABLE before gimplification of BUILT_IN_MEMCPY.
Jakub Jelinek [Mon, 25 Jun 2018 17:30:03 +0000 (19:30 +0200)]
backport: re PR c++/84076 (Warning about objects through POD mistakenly claims the object is a pointer)
Backported from mainline
2018-03-09 Jason Merrill <jason@redhat.com>
Jakub Jelinek <jakub@redhat.com>
PR c++/84076
* call.c (convert_arg_to_ellipsis): Instead of cp_build_addr_expr
build ADDR_EXPR with REFERENCE_TYPE.
(build_over_call): For purposes of check_function_arguments, if
argarray[j] is ADDR_EXPR with REFERENCE_TYPE created above, use
its operand rather than the argument itself.
Jakub Jelinek [Mon, 25 Jun 2018 17:28:32 +0000 (19:28 +0200)]
backport: re PR tree-optimization/84739 (ICE in get_value_for_expr, at tree-ssa-ccp.c:649)
Backported from mainline
2018-03-08 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/84739
* tree-tailcall.c (find_tail_calls): Check call arguments against
DECL_ARGUMENTS (current_function_decl) rather than
DECL_ARGUMENTS (func) when checking for tail recursion.
Jakub Jelinek [Mon, 25 Jun 2018 17:27:47 +0000 (19:27 +0200)]
backport: re PR target/84700 (ICE on 32-bit BE powerpc targets w/ -misel -O1)
Backported from mainline
2018-03-05 Jakub Jelinek <jakub@redhat.com>
PR target/84700
* combine.c (combine_simplify_rtx): Don't try to simplify if
if_then_else_cond returned non-NULL, but either true_rtx or false_rtx
are equal to x.
Jakub Jelinek [Mon, 25 Jun 2018 17:26:53 +0000 (19:26 +0200)]
backport: re PR c++/84662 (internal compiler error: tree check: expected class 'type', have 'exceptional' (error_mark) in is_bitfield_expr_with_lowered_type, at cp/typeck.c:1944)
Backported from mainline
2018-03-02 Jakub Jelinek <jakub@redhat.com>
PR c++/84662
* pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Use
RETURN instead of return.
<case POINTER_PLUS_EXPR>: Likewise.
<case CONVERT_EXPR>: If op0 is error_mark_node, just return
it instead of wrapping it into CONVERT_EXPR.
Jakub Jelinek [Mon, 25 Jun 2018 17:25:41 +0000 (19:25 +0200)]
backport: re PR inline-asm/84625 (ICE with empty constraint and vector constant)
Backported from mainline
2018-03-02 Jakub Jelinek <jakub@redhat.com>
PR inline-asm/84625
* config/i386/i386.c (ix86_print_operand): Use conditional
output_operand_lossage instead of gcc_assert if CONST_VECTOR is not
zero vector.
Jakub Jelinek [Mon, 25 Jun 2018 17:23:21 +0000 (19:23 +0200)]
backport: re PR c++/84448 (ICE with broken condition in parallel for loop)
Backported from mainline
2018-02-19 Jakub Jelinek <jakub@redhat.com>
PR c++/84448
* parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
either operand is error_mark_node, set current.lhs to that instead of
creating a binary op with error_mark_node operands.
Jakub Jelinek [Mon, 25 Jun 2018 17:21:47 +0000 (19:21 +0200)]
backport: re PR c/82210 (Having _Alignas in a struct with VLAs causes writing to one array to overwrite another)
Backported from mainline
2018-02-13 Jakub Jelinek <jakub@redhat.com>
PR c/82210
* stor-layout.c (place_field): For variable length fields, adjust
offset_align afterwards not just based on the field's alignment,
but also on the size.
Jakub Jelinek [Mon, 25 Jun 2018 17:19:13 +0000 (19:19 +0200)]
backport: re PR target/83986 (ICE in maybe_record_trace_start, at dwarf2cfi.c:2348)
Backported from mainline
2018-01-30 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/83986
* sched-deps.c (sched_analyze_insn): For frame related insns, add anti
dependence against last_pending_memory_flush in addition to
pending_jump_insns.
Jakub Jelinek [Mon, 25 Jun 2018 17:11:36 +0000 (19:11 +0200)]
backport: re PR preprocessor/83722 (the ICE dumper doesn't comment-out some error messages)
Backported from mainline
2018-01-09 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/83722
* gcc.c (try_generate_repro): Pass
&temp_stderr_files[RETRY_ICE_ATTEMPTS - 1] rather than
&temp_stdout_files[RETRY_ICE_ATTEMPTS - 1] as last argument to
do_report_bug.
Jakub Jelinek [Mon, 25 Jun 2018 17:11:05 +0000 (19:11 +0200)]
backport: re PR tree-optimization/83605 (ICE: verify_gimple failed (error: dead STMT in EH table))
Backported from mainline
2018-01-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/83605
* gimple-ssa-strength-reduction.c: Include tree-eh.h.
(find_candidates_dom_walker::before_dom_children): Ignore stmts that
can throw.
Jakub Jelinek [Mon, 25 Jun 2018 17:10:18 +0000 (19:10 +0200)]
backport: re PR c++/83553 (compiler removes body of the for-loop, although there is a case label inside)
Backported from mainline
2017-12-23 Jakub Jelinek <jakub@redhat.com>
PR c++/83553
* fold-const.c (struct contains_label_data): New type.
(contains_label_1): Return non-NULL even for CASE_LABEL_EXPR, unless
inside of a SWITCH_BODY seen during the walk.
(contains_label_p): Use walk_tree instead of
walk_tree_without_duplicates, prepare data for contains_label_1 and
provide own pset.
Jakub Jelinek [Mon, 25 Jun 2018 17:08:02 +0000 (19:08 +0200)]
backport: re PR debug/83550 (Bad location of DW_TAG_structure_type with forward declaration since r224161)
Backported from mainline
2017-12-22 Jakub Jelinek <jakub@redhat.com>
PR debug/83550
* c-decl.c (finish_struct): Set DECL_SOURCE_LOCATION on
TYPE_STUB_DECL and call rest_of_type_compilation before processing
incomplete vars rather than after it.
Jakub Jelinek [Mon, 25 Jun 2018 17:05:01 +0000 (19:05 +0200)]
backport: re PR rtl-optimization/80747 (gcc.dg/tree-ssa/tailrecursion-4.c fails with ICE when compiled with options "-fprofile-use -freorder-blocks-and-partition")
Backported from mainline
2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/80747
PR rtl-optimization/83512
* cfgrtl.c (force_nonfallthru_and_redirect): When splitting
succ edge from ENTRY, copy partition from e->dest to the newly
created bb.
* bb-reorder.c (reorder_basic_blocks_simple): If last_tail is
ENTRY, use BB_PARTITION of its successor block as current_partition.
Don't copy partition when splitting succ edge from ENTRY.
* gcc.dg/pr80747.c: New test.
* gcc.dg/pr83512.c: New test.
Jakub Jelinek [Mon, 25 Jun 2018 17:03:26 +0000 (19:03 +0200)]
backport: re PR tree-optimization/83521 (ICE: verify_gimple failed (error: invalid operand in unary operation))
Backported from mainline
2017-12-21 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/83521
* tree-ssa-phiopt.c (factor_out_conditional_conversion): Use
gimple_build_assign without code on result of
fold_build1 (VIEW_CONVERT_EXPR, ...), as it might not create
a VIEW_CONVERT_EXPR.
Jakub Jelinek [Mon, 25 Jun 2018 17:02:47 +0000 (19:02 +0200)]
backport: re PR ipa/82801 (Internal compiler error with Eigen and __attribute__((always_inline, flatten)))
Backported from mainline
2017-12-19 Jakub Jelinek <jakub@redhat.com>
PR ipa/82801
PR ipa/83346
* ipa-inline.c (flatten_remove_node_hook): New function.
(ipa_inline): Keep only nodes with flatten attribute at the end of
the array in the order from ipa_reverse_postorder, only walk that
portion of array for flattening, if there is more than one such
node, temporarily register a removal hook and ignore removed nodes.
Jakub Jelinek [Mon, 25 Jun 2018 16:57:13 +0000 (18:57 +0200)]
backport: re PR target/78643 (ICE in convert_move, at expr.c:230)
Backported from mainline
2017-12-02 Jakub Jelinek <jakub@redhat.com>
PR target/78643
PR target/80583
* expr.c (get_inner_reference): If DECL_MODE of a non-bitfield
is BLKmode for vector field with vector raw mode, use TYPE_MODE
instead of DECL_MODE.
Jakub Jelinek [Mon, 25 Jun 2018 16:53:11 +0000 (18:53 +0200)]
backport: parser.c (cp_parser_omp_declare): Change return type to bool from void, return true for declare simd.
Backported from mainline
2017-11-23 Jakub Jelinek <jakub@redhat.com>
* parser.c (cp_parser_omp_declare): Change return type to bool from
void, return true for declare simd.
(cp_parser_pragma): Return cp_parser_omp_declare returned value
rather than always false.
Jakub Jelinek [Mon, 25 Jun 2018 16:51:38 +0000 (18:51 +0200)]
backport: re PR middle-end/82253 (ICE in convert_move, at expr.c:604)
Backported from mainline
2017-11-23 Jakub Jelinek <jakub@redhat.com>
PR middle-end/82253
* expr.c (expand_assignment): For CONCAT to_rtx, complex type from and
bitpos/bitsize covering the whole destination, use store_expr only if
the complex mode is the same. Otherwise, use expand_normal and if
it returns CONCAT, subreg each part separately instead of trying to
subreg the whole result.
Jakub Jelinek [Mon, 25 Jun 2018 16:47:39 +0000 (18:47 +0200)]
backport: re PR c++/82781 (Vector extension operators return wrong result in constexpr)
Backported from mainline
2017-11-20 Jakub Jelinek <jakub@redhat.com>
PR c++/82781
* constexpr.c (cxx_eval_vector_conditional_expression): New function.
(cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead
of cxx_eval_conditional_expression.
Jakub Jelinek [Mon, 25 Jun 2018 16:45:10 +0000 (18:45 +0200)]
backport: re PR rtl-optimization/82192 (gcc produces incorrect code with -O2 and bit-field)
Backported from mainline
2017-09-15 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/82192
* combine.c (make_extraction): Don't look through non-paradoxical
SUBREGs or TRUNCATE if pos + len is or might be bigger than
inner's mode.
2018-06-23 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
PR tree-optimization/85989
* gimple-ssa-backprop.c (backprop::m_visited_phis): New member
variable.
(backprop::backprop): Initialize it.
(backprop::~backprop): Free it.
(backprop::intersect_uses): Check it when deciding whether this
is a backedge reference.
(backprop::process_block): Add each phi to m_visited_phis
after visiting it, then clear it at the end.
gcc/testsuite/
PR tree-optimization/85989
* gcc.dg/torture/pr85989.c: New test.
Richard Biener [Thu, 21 Jun 2018 11:18:50 +0000 (11:18 +0000)]
backport: [multiple changes]
2018-06-21 Richard Biener <rguenther@suse.de>
Backport from mainline
2017-09-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/82108
* tree-vect-stmts.c (vectorizable_load): Fix pointer adjustment
for gap in the non-permutation SLP case.
* gcc.dg/vect/pr82108.c: New testcase.
2017-06-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/81410
* tree-vect-stmts.c (vectorizable_load): Properly adjust for
the gap in the ! slp_perm SLP case after each group.
* gcc.dg/vect/pr81410.c: New testcase.
2017-03-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/79920
* tree-vect-slp.c (vect_create_mask_and_perm): Remove and inline
with ncopies == 1 to ...
(vect_transform_slp_perm_load): ... here. Properly compute
all element loads by iterating VF times over the group. Do
not handle ncopies (computed in a broken way) in
vect_create_mask_and_perm.
Richard Biener [Thu, 21 Jun 2018 09:50:36 +0000 (09:50 +0000)]
backport: [multiple changes]
2018-06-21 Richard Biener <rguenther@suse.de>
Backport from mainline
2018-02-28 Richard Biener <rguenther@suse.de>
PR middle-end/84607
* genmatch.c (capture_info::walk_match): Do not mark
captured expressions without operands as expr_p given
they act more like predicates and should be subject to
"lost tail" side-effect preserving.
* gcc.dg/pr84607.c: New testcase.
2018-05-04 Richard Biener <rguenther@suse.de>
PR middle-end/85588
* fold-const.c (negate_expr_p): Restrict negation of operand
zero of a division to when we know that can happen without
overflow.
(fold_negate_expr_1): Likewise.
* gcc.dg/torture/pr85588.c: New testcase.
* gcc.dg/torture/pr57656.c: Use dg-additional-options.
Richard Biener [Thu, 21 Jun 2018 07:24:06 +0000 (07:24 +0000)]
backport: [multiple changes]
2018-06-21 Richard Biener <rguenther@suse.de>
Backport from mainline
2017-08-21 Richard Biener <rguenther@suse.de>
PR middle-end/81884
* tree-ssa-alias.c (stmt_kills_ref_p): Handle array accesses
at struct end conservatively when comparing common bases.
* g++.dg/torture/pr81884.C: New testcase.
2017-05-04 Richard Biener <rguenther@suse.de>
* tree.c (array_at_struct_end_p): Handle arrays at struct
end with flexarrays more conservatively. Refactor and treat
arrays of arrays or aggregates more strict. Fix
VIEW_CONVERT_EXPR handling.
2018-04-06 Richard Biener <rguenther@suse.de>
PR middle-end/85244
* tree-dfa.c (get_ref_base_and_extent): Reset seen_variable_array_ref
after seeing a component reference with an adjacent field. Treat
refs to arrays at struct end of external decls similar to
refs to unconstrained commons.
* gcc.dg/torture/pr85244-1.c: New testcase.
* gcc.dg/torture/pr85244-2.c: Likewise.
PR c/84873
* c-gimplify.c (c_gimplify_expr): Do not fold expressions.
* c-c++-common/pr84873.c: New testcase.
2018-05-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/85597
* tree-vect-stmts.c (vectorizable_operation): For ternary SLP
do not use split vect_get_vec_defs call but call vect_get_slp_defs
directly.
Backport from mainline
2018-01-01 Jakub Jelinek <jakub@redhat.com>
PR middle-end/83623
* expmed.c (expand_shift_1): For 2-byte rotates by BITS_PER_UNIT,
check for bswap in mode rather than HImode and use that in expand_unop
too.
* gcc.dg/pr83623.c: New test.
2017-09-26 Richard Biener <rguenther@suse.de>
Backport from mainline
2017-09-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/82264
* tree-ssa-sccvn.c (vn_phi_eq): Use safe_dyn_cast to check
for GIMPLE_CONDs.
(vn_phi_lookup): Likewise.
(vn_phi_insert): Likewise.
* is-a.h (safe_dyn_cast): New.
* gcc.dg/torture/pr82264.c: New testcase.
2017-09-25 Richard Biener <rguenther@suse.de>
PR tree-optimization/82285
* tree-vect-patterns.c (vect_recog_bool_pattern): Also handle
enumeral types.
* gcc.dg/torture/pr82285.c: New testcase.
2017-11-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/82402
* tree-vect-loop-manip.c (create_lcssa_for_virtual_phi): Properly
set SSA_NAME_OCCURS_IN_ABNORMAL_PHI.
* gcc.dg/torture/pr82402.c: New testcase.
2017-10-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/82697
* tree-ssa-phiopt.c (cond_store_replacement): Use alias-set
zero for conditional load and unconditional store.
* gcc.dg/torture/pr82697.c: New testcase.
2017-11-02 Richard Biener <rguenther@suse.de>
PR middle-end/82765
* varasm.c (decode_addr_const): Make offset HOST_WIDE_INT.
Truncate ARRAY_REF index and element size.
Max Filippov [Tue, 19 Jun 2018 21:08:46 +0000 (21:08 +0000)]
xtensa: fix PR target/65416
The issue is caused by reordering of stack pointer update after stack
space allocation with instructions that write to the allocated stack
space. In windowed ABI register spill area for the previous call frame
is located just below the stack pointer and may be reloaded back into
the register file on movsp.
Implement allocate_stack pattern for windowed ABI configuration and
insert an instruction that prevents reordering of frame memory access
and stack pointer update.
gcc/
2018-06-19 Max Filippov <jcmvbkbc@gmail.com>
Backport from mainline
2018-06-19 Max Filippov <jcmvbkbc@gmail.com>
* config/xtensa/xtensa.md (UNSPEC_FRAME_BLOCKAGE): New unspec
constant.
(allocate_stack, frame_blockage, *frame_blockage): New patterns.
Martin Liska [Fri, 15 Jun 2018 08:51:28 +0000 (10:51 +0200)]
Partial backport r256656
2018-06-15 Martin Liska <mliska@suse.cz>
Backport from mainline
2018-01-10 Kelvin Nilsen <kelvin@gcc.gnu.org>
* lex.c (search_line_fast): Remove illegal coercion of an
unaligned pointer value to vector pointer type and replace with
use of __builtin_vec_vsx_ld () built-in function, which operates
on unaligned pointer values.
Eric Botcazou [Sat, 2 Jun 2018 09:58:46 +0000 (09:58 +0000)]
backport: trans.c (Call_to_gnu): If this is a function call and there is no target...
Backport from mainline
2018-05-31 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (Call_to_gnu): If this is a function call and
there is no target, also create a temporary for the return value for
an allocator if the type is an unconstrained record type with default
discriminant.
Bill Schmidt [Fri, 1 Jun 2018 13:00:57 +0000 (13:00 +0000)]
backport: [multiple changes]
2018-06-01 Bill Schmidt <wschmidt@linux.ibm.com>
PR tree-optimization/85712
Backport from mainline:
2018-05-23 Bill Schmidt <wschmidt@linux.ibm.com>
PR tree-optimization/85712
* gimple-ssa-strength-reduction.c (struct slsr_cand_d): Add
first_interp field.
(alloc_cand_and_find_basis): Initialize first_interp field.
(slsr_process_mul): Modify first_interp field.
(slsr_process_add): Likewise.
(slsr_process_cast): Modify first_interp field for each new
interpretation.
(slsr_process_copy): Likewise.
(dump_candidate): Dump first_interp field.
(replace_mult_candidate): Process all interpretations, not just
subsequent ones.
(replace_rhs_if_not_dup): Likewise.
(replace_one_candidate): Likewise.
Backport from mainline:
2018-05-25 Bill Schmidt <wschmidt@linux.ibm.com>
PR tree-optimization/85712
* gimple-ssa-strength-reduction.c (replace_one_candidate): Skip if
this candidate has already been replaced in-situ by a copy.