Commit Graph

244 Commits

Author SHA1 Message Date
Eric Botcazou 2364fa7f79 re PR rtl-optimization/81803 (miscompilation at -O1 on mips64el)
PR rtl-optimization/81803
	* lra-constraints.c (curr_insn_transform): Also reload the whole
	register for a strict subreg no wider than a word if this is for
	a WORD_REGISTER_OPERATIONS target.

From-SVN: r254488
2017-11-07 07:44:58 +00:00
Vladimir Makarov 9aae1b1f15 re PR middle-end/82556 (internal compiler error in curr_insn_transform, at lra-constraints.c:4307)
2017-10-18  Vladimir Makarov  <vmakarov@redhat.com>

	PR middle-end/82556
	* lra-constraints.c (curr_insn_transform): Use non-input operand
	instead of output one for matched reload.

2017-10-18  Vladimir Makarov  <vmakarov@redhat.com>

	PR middle-end/82556
	* gcc.target/i386/pr82556.c: New.

From-SVN: r253863
2017-10-18 16:47:38 +00:00
Vladimir Makarov 4796d8f620 re PR rtl-optimization/70478 ([LRA] S/390: Performance regression - superfluous stack frame)
2017-04-11  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/70478
	* lra-constraints.c (process_alt_operands): Check memory for
	disfavoring memory insn operand.

From-SVN: r246854
2017-04-11 19:39:59 +00:00
Vladimir Makarov 9b195552ab re PR rtl-optimization/70478 ([LRA] S/390: Performance regression - superfluous stack frame)
2017-04-10  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/70478
	* lra-constraints.c (curr_small_class_check): New.
	(update_and_check_small_class_inputs): New.
	(process_alt_operands): Update curr_small_class_check.  Disfavor
	alternative insn memory operands.  Check available regs for small
	class operands.

From-SVN: r246808
2017-04-10 14:58:33 +00:00
Vladimir Makarov 8d2696f958 re PR rtl-optimization/70478 ([LRA] S/390: Performance regression - superfluous stack frame)
2017-04-08  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/70478
	* lra-constraints.c: Reverse the last patch.

From-SVN: r246789
2017-04-08 19:18:42 +00:00
Vladimir Makarov 057da7af80 re PR rtl-optimization/70478 ([LRA] S/390: Performance regression - superfluous stack frame)
2017-04-07  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/70478
	* lra-constraints.c (process_alt_operands): Disfavor alternative
	insn memory operands.

2017-04-07  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/70478
	* gcc.target/s390/pr70478.c: New.

From-SVN: r246764
2017-04-07 16:01:50 +00:00
Vladimir Makarov 8b8e41e5c2 re PR target/80017 (ICE: Max. number of generated reload insns per insn is achieved (90))
2017-03-15  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/80017
	* lra-constraints.c (process_alt_operands): Increase reject for
	reloading an input/output operand.

From-SVN: r246181
2017-03-15 23:04:09 +00:00
Vladimir Makarov 9125b9fc80 re PR rtl-optimization/79949 (ICE in Max. number of generated reload insns per insn is achieved (90))
2017-03-09  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/79949
	* lra-constraints.c (process_alt_operands): Check memory when
	trying to predict a cycle.  Print about the overall increase.

From-SVN: r246003
2017-03-09 14:43:17 +00:00
Vladimir Makarov feca7b8954 re PR rtl-optimization/79571 (ICE in Max. number of generated reload insns per insn is achieved (90))
2017-03-06  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/79571
	* lra-constraints.c (process_alt_operands): Claculate static
	reject and subtract it from overal when there will be only address
	reloads.

2017-03-06  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/79571
	* gcc.target/i386/pr79571.c: New.

From-SVN: r245928
2017-03-06 20:23:00 +00:00
Alan Modra 0a001dcba6 PR79584, ICE in base_to_reg
PR rtl-optimization/79584
	* lra-constraints.c (base_to_reg): Reload ad->base, the entire
	base, not ad->base_term, the reg within base.  Remove assertion
	that ad->base == ad->base_term.  Replace gen_int_mode using
	bogus mode with const0_rtx.

From-SVN: r245741
2017-02-26 09:14:41 +10:30
Matthew Fortune 198075e1c9 Support WORD_REGISTER_OPERATIONS requirements in simplify_operand_subreg
gcc/
	PR target/78660
	* lra-constraints.c (simplify_operand_subreg): Handle
	WORD_REGISTER_OPERATIONS targets.

From-SVN: r245655
2017-02-22 17:20:14 +00:00
Matthew Fortune 549a6181ec Revert r245598
gcc/
	PR target/78660
	Revert:
	2017-02-20  Matthew Fortune  <matthew.fortune@imgtec.com>

	* lra-constraints.c (curr_insn_transform): Handle
	WORD_REGISTER_OPERATIONS requirements when reloading SUBREGs.

From-SVN: r245626
2017-02-21 13:29:07 +00:00
Matthew Fortune 1b51df9442 Ensure the mode used to create split registers is suppported
gcc/
	PR target/78012
	* lra-constraints.c (split_reg): Check requested split mode
	is supported by the register.

From-SVN: r245601
2017-02-20 12:07:23 +00:00
Matthew Fortune 77850e96dd Partial revert of r243782 to restore previous behavior
gcc/
	* lra-constraints.c (simplify_operand_subreg): Remove early
	return false.

From-SVN: r245600
2017-02-20 12:07:14 +00:00
Matthew Fortune 62cdb86264 Tighten condition for converting SUBREG reloads from OP_OUT to OP_INOUT
gcc/
	PR target/78660
	* lra-constraints.c (curr_insn_transform): Tighten condition
	for converting SUBREG reloads from OP_OUT to OP_INOUT.

From-SVN: r245599
2017-02-20 12:07:06 +00:00
Matthew Fortune 222aafd7b6 Handle WORD_REGISTER_OPERATIONS when reloading (subreg (reg))
gcc/
	PR target/78660
	* lra-constraints.c (curr_insn_transform): Handle
	WORD_REGISTER_OPERATIONS requirements when reloading SUBREGs.

From-SVN: r245598
2017-02-20 12:06:56 +00:00
Vladimir Makarov 8b4aea7364 re PR rtl-optimization/79541 (lra reads uninitialized memory (with invalid input))
2017-02-17  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/79541
	* lra-constraints.c (curr_insn_transform): Remove wrong asm insn
	instead of transforming it into USE.

From-SVN: r245536
2017-02-17 16:10:59 +00:00
Jakub Jelinek aa326bfb90 cprop.c (cprop_jump): Add missing space in string literal.
* cprop.c (cprop_jump): Add missing space in string literal.
	* tree-ssa-structalias.c (rewrite_constraints): Likewise.
	(get_constraint_for_component_ref): Likewise.
	* df-core.c (df_worklist_dataflow_doublequeue): Likewise.
	* tree-outof-ssa.c (insert_partition_copy_on_edge): Likewise.
	* lra-constraints.c (process_alt_operands): Likewise.
	* ipa-inline.c (inline_small_functions): Likewise.
	* tree-ssa-sccvn.c (visit_reference_op_store): Likewise.
	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Likewise.
	* trans-mem.c (diagnose_tm_1_op): Likewise.
	* omp-grid.c (grid_find_single_omp_among_assignments): Likewise.
	(grid_parallel_clauses_gridifiable): Likewise.
c/
	* c-parser.c (c_parser_oacc_declare): Add missing space in
	diagnostics.
fortran/
	* trans-expr.c (gfc_conv_substring): Add missing space in diagnostics.

From-SVN: r245409
2017-02-13 22:56:13 +01:00
Vladimir Makarov d8321b33d3 re PR rtl-optimization/71374 (ICE on valid code at -O1 and above on x86_64-linux-gnu: in extract_constrain_insn, at recog.c:2190)
2017-01-27  Vladimir Makarov  <vmakarov@redhat.com>

	PR tree-optimization/71374
	* lra-constraints.c (check_conflict_input_operands): New.
	(match_reload): Use it.

2017-01-27  Vladimir Makarov  <vmakarov@redhat.com>

	PR tree-optimization/71374
	* testsuite/gcc.target/i386/pr71374.c: New.

From-SVN: r244991
2017-01-27 18:08:14 +00:00
Vladimir Makarov 15961e4a1b re PR target/79131 (ICE: in extract_constrain_insn, at recog.c:2213, big-endian ARM)
2017-01-26  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/79131
	* lra-assigns.c (setup_live_pseudos_and_spill_after_risky): Take
	endianess for subregs into account.
	* lra-constraints.c (lra_constraints): Do risky transformations
	always on the first iteration.
	* lra-lives.c (check_pseudos_live_through_calls): Add arg
	last_call_used_reg_set.
	(process_bb_lives): Define and use last_call_used_reg_set.
	* lra.c (lra): Always continue after lra_constraints on the first
	iteration.

2017-01-26  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/79131
	* gcc.target/arm/pr79131.c: New.

From-SVN: r244942
2017-01-26 17:08:12 +00:00
Eric Botcazou 849fccf831 re PR rtl-optimization/79032 (unaligned memory access generated with LRA and optimization)
PR rtl-optimization/79032
	* lra-constraints.c (simplify_operand_subreg): In the MEM case, test
	the alignment of the adjusted memory reference against that of MODE,
	instead of the alignment of the original memory reference.

From-SVN: r244311
2017-01-11 11:27:43 +00:00
Martin Liska eb0f878074 Fix lto-bootstrap (PR bootstrap/79003).
2017-01-06  Martin Liska  <mliska@suse.cz>

	PR bootstrap/79003
	* lra-constraints.c: Rename invariant to lra_invariant.
	* predict.c (set_even_probabilities): Initialize e to NULL.
2017-01-06  Martin Liska  <mliska@suse.cz>

	PR bootstrap/79003
	* Makefile.in: Add -fno-lto to {C,CPP,LD}FLAGS.

From-SVN: r244155
2017-01-06 13:56:48 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Eric Botcazou ab5d223376 lra-constraints.c (process_address): Add forward declaration.
* lra-constraints.c (process_address): Add forward declaration.
	(simplify_operand_subreg): In the MEM case, if the adjusted memory
	reference is not sufficient aligned and the address was invalid,
	reload the address before reloading the original memory reference.
	Fix long lines and add a final return for the sake of clarity.

From-SVN: r243782
2016-12-18 08:33:38 +00:00
Eric Botcazou 164f063463 lra-constraints.c (process_address_1): Do not attempt to decompose addresses for MEMs that satisfy fixed-form constraints.
* lra-constraints.c (process_address_1): Do not attempt to decompose
	addresses for MEMs that satisfy fixed-form constraints.

From-SVN: r243632
2016-12-14 08:34:15 +00:00
Eric Botcazou 54b84aa945 lra-constraints.c (emit_spill_move): Use gen_lowpart_SUBREG in all cases to build a lowpart SUBREG.
* lra-constraints.c (emit_spill_move): Use gen_lowpart_SUBREG in all
	cases to build a lowpart SUBREG.

From-SVN: r243222
2016-12-03 17:37:13 +00:00
Vladimir Makarov f7abdf36e5 re PR tree-optimization/77856 (wrong code at -O2 on x86_64-linux-gnu in 32-bit mode)
2016-11-30  Vladimir Makarov  <vmakarov@redhat.com>

	PR tree-optimization/77856
	* lra-constraints.c (inherit_in_ebb): Check original regno for
	invalid invariant regs too.  Set only clobbered hard regs for the
	invalid invariant regs.

2016-11-30  Vladimir Makarov  <vmakarov@redhat.com>

	PR tree-optimization/77856
	* gcc.target/i386.c (pr77856.c): New.

From-SVN: r243038
2016-11-30 17:35:40 +00:00
Jeff Law 48855443fa lra-constraints.c (check_and_process_move): Constrain the range of DCLASS and SCLASS to avoid false positive out of bounds...
* lra-constraints.c (check_and_process_move): Constrain the
	range of DCLASS and SCLASS to avoid false positive out of bounds
	array index warning.

From-SVN: r242993
2016-11-29 21:15:55 -07:00
Vladimir Makarov 3f156a6ce0 re PR rtl-optimization/77541 (wrong code with 512bit vectors of int128 @ -O1)
2016-11-24  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/77541
	* lra-constraints.c (struct input_reload): Add field match_p.
	(get_reload_reg): Check modes of input reloads to generate unique
	value reload pseudo.
	(match_reload): Add input reload pseudo for the current insn.

2016-11-24  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/77541
	* gcc.target/i386/pr77541.c: New.

From-SVN: r242848
2016-11-24 19:54:27 +00:00
Pip Cet 86a21121ac re PR rtl-optimization/78355 (LRA generates unaligned accesses when SLOW_UNALIGNED_ACCESS is 1)
PR rtl-optimization/78355
	* doc/tm.texi.in (SLOW_UNALIGNED_ACCESS): Document that the macro only
	needs to deal with unaligned accesses.
	* doc/tm.texi: Regenerate.
	* lra-constraints.c (simplify_operand_subreg): Only invoke
	SLOW_UNALIGNED_ACCESS on innermode if the MEM is not aligned enough.

Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>

From-SVN: r242554
2016-11-17 16:16:38 +00:00
Trevor Saunders 04a121a757 make LABEL_REF_LABEL a rtx_insn *
While changing LABEL_REF_LABEL it might as well become an inline
function, so that its clearer what types are involved.  Unfortunately
because it is still possible to use XEXP and related macros on a
LABEL_REF rtx you can still set the field to be a non insn rtx.  The
other unfortunate thing is that the generators actually create LABEL_REF
rtx that refer to MATCH_x rtx, so there we actually need to use XEXP to
bypass the checking this patch adds.

gcc/ChangeLog:

2016-10-21  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* rtl.h (label_ref_label): New function.
	(set_label_ref_label): New function.
	(LABEL_REF_LABEL): Delete.
	* alias.c (rtx_equal_for_memref_p): Adjust.
	* cfgbuild.c (make_edges): Likewise.
	(purge_dead_tablejump_edges): Likewise.
	* cfgexpand.c (convert_debug_memory_address): Likewise.
	* cfgrtl.c (patch_jump_insn): Likewise.
	* combine.c (distribute_notes): Likewise.
	* cse.c (hash_rtx_cb): Likewise.
	(exp_equiv_p): Likewise.
	(fold_rtx): Likewise.
	(check_for_label_ref): Likewise.
	* cselib.c (rtx_equal_for_cselib_1): Likewise.
	(cselib_hash_rtx): Likewise.
	* emit-rtl.c (mark_label_nuses): Likewise.
	* explow.c (convert_memory_address_addr_space_1): Likewise.
	* final.c (output_asm_label): Likewise.
	(output_addr_const): Likewise.
	* gcse.c (add_label_notes): Likewise.
	* genconfig.c (walk_insn_part): Likewise.
	* genrecog.c (validate_pattern): Likewise.
	* ifcvt.c (cond_exec_get_condition): Likewise.
	(noce_emit_store_flag): Likewise.
	(noce_get_alt_condition): Likewise.
	(noce_get_condition): Likewise.
	* jump.c (maybe_propagate_label_ref): Likewise.
	(mark_jump_label_1): Likewise.
	(redirect_exp_1): Likewise.
	(rtx_renumbered_equal_p): Likewise.
	* lra-constraints.c (operands_match_p): Likewise.
	* print-rtl.c (print_value): Likewise.
	* reload.c (find_reloads): Likewise.
	* reload1.c (set_label_offsets): Likewise.
	* reorg.c (get_branch_condition): Likewise.
	* rtl-tests.c (test_uncond_jump): Likewise.
	* rtl.c (rtx_equal_p_cb): Likewise.
	(rtx_equal_p): Likewise.
	* rtlanal.c (reg_mentioned_p): Likewise.
	(rtx_referenced_p): Likewise.
	(get_condition): Likewise.
	* varasm.c (const_hash_1): Likewise.
	(compare_constant): Likewise.
	(const_rtx_hash_1): Likewise.
	(output_constant_pool_1): Likewise.

From-SVN: r241401
2016-10-21 12:32:56 +00:00
Thomas Preud'homme 4d0cdd0ce6 Move MEMMODEL_* from coretypes.h to memmodel.h
2016-10-13  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    * coretypes.h: Move MEMMODEL_* macros and enum memmodel definition
    into ...
    * memmodel.h: This file.
    * alias.c, asan.c, auto-inc-dec.c, bb-reorder.c, bt-load.c,
      caller-save.c, calls.c, ccmp.c, cfgbuild.c, cfgcleanup.c,
      cfgexpand.c, cfgloopanal.c, cfgrtl.c, cilk-common.c, combine.c,
      combine-stack-adj.c, common/config/aarch64/aarch64-common.c,
      common/config/arm/arm-common.c, common/config/bfin/bfin-common.c,
      common/config/c6x/c6x-common.c, common/config/i386/i386-common.c,
      common/config/ia64/ia64-common.c, common/config/nvptx/nvptx-common.c,
      compare-elim.c, config/aarch64/aarch64-builtins.c,
      config/aarch64/aarch64-c.c, config/aarch64/cortex-a57-fma-steering.c,
      config/arc/arc.c, config/arc/arc-c.c, config/arm/arm-builtins.c,
      config/arm/arm-c.c, config/avr/avr.c, config/avr/avr-c.c,
      config/avr/avr-log.c, config/bfin/bfin.c, config/c6x/c6x.c,
      config/cr16/cr16.c, config/cris/cris.c, config/darwin-c.c,
      config/darwin.c, config/epiphany/epiphany.c,
      config/epiphany/mode-switch-use.c,
      config/epiphany/resolve-sw-modes.c, config/fr30/fr30.c,
      config/frv/frv.c, config/ft32/ft32.c, config/h8300/h8300.c,
      config/i386/i386-c.c, config/i386/winnt.c, config/iq2000/iq2000.c,
      config/lm32/lm32.c, config/m32c/m32c.c, config/m32r/m32r.c,
      config/m68k/m68k.c, config/mcore/mcore.c,
      config/microblaze/microblaze.c, config/mmix/mmix.c,
      config/mn10300/mn10300.c, config/moxie/moxie.c,
      config/msp430/msp430.c, config/nds32/nds32-cost.c,
      config/nds32/nds32-intrinsic.c, config/nds32/nds32-md-auxiliary.c,
      config/nds32/nds32-memory-manipulation.c,
      config/nds32/nds32-predicates.c, config/nds32/nds32.c,
      config/nios2/nios2.c, config/nvptx/nvptx.c, config/pa/pa.c,
      config/pdp11/pdp11.c, config/rl78/rl78.c, config/rs6000/rs6000-c.c,
      config/rx/rx.c, config/s390/s390-c.c, config/s390/s390.c,
      config/sh/sh.c, config/sh/sh-c.c, config/sh/sh-mem.cc,
      config/sh/sh_treg_combine.cc, config/sol2.c, config/spu/spu.c,
      config/stormy16/stormy16.c, config/tilegx/tilegx.c,
      config/tilepro/tilepro.c, config/v850/v850.c, config/vax/vax.c,
      config/visium/visium.c, config/vms/vms-c.c, config/xtensa/xtensa.c,
      coverage.c, cppbuiltin.c, cprop.c, cse.c, cselib.c, dbxout.c, dce.c,
      df-core.c, df-problems.c, df-scan.c, dojump.c, dse.c, dwarf2asm.c,
      dwarf2cfi.c, dwarf2out.c, emit-rtl.c, except.c, explow.c, expmed.c,
      expr.c, final.c, fold-const.c, function.c, fwprop.c, gcse.c,
      ggc-page.c, haifa-sched.c, hsa-brig.c, hsa-gen.c, hw-doloop.c,
      ifcvt.c, init-regs.c, internal-fn.c, ira-build.c, ira-color.c,
      ira-conflicts.c, ira-costs.c, ira-emit.c, ira-lives.c, ira.c, jump.c,
      loop-doloop.c, loop-invariant.c, loop-iv.c, loop-unroll.c,
      lower-subreg.c, lra.c, lra-assigns.c, lra-coalesce.c,
      lra-constraints.c, lra-eliminations.c, lra-lives.c, lra-remat.c,
      lra-spills.c, mode-switching.c, modulo-sched.c, omp-low.c, passes.c,
      postreload-gcse.c, postreload.c, predict.c, print-rtl-function.c,
      recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regrename.c,
      reload.c, reload1.c, reorg.c, resource.c, rtl-chkp.c, rtl-tests.c,
      rtlanal.c, rtlhooks.c, sched-deps.c, sched-rgn.c, sdbout.c,
      sel-sched-ir.c, sel-sched.c, shrink-wrap.c, simplify-rtx.c,
      stack-ptr-mod.c, stmt.c, stor-layout.c, target-globals.c,
      targhooks.c, toplev.c, tree-nested.c, tree-outof-ssa.c,
      tree-profile.c, tree-ssa-coalesce.c, tree-ssa-ifcombine.c,
      tree-ssa-loop-ivopts.c, tree-ssa-loop.c, tree-ssa-reassoc.c,
      tree-ssa-sccvn.c, tree-vect-data-refs.c, ubsan.c, valtrack.c,
      var-tracking.c, varasm.c: Include memmodel.h.
    * genattrtab.c (write_header): Include memmodel.h in generated file.
    * genautomata.c (main): Likewise.
    * gengtype.c (open_base_files): Likewise.
    * genopinit.c (main): Likewise.
    * genconditions.c (write_header): Include memmodel.h earlier in
    generated file.
    * genemit.c (main): Likewise.
    * genoutput.c (output_prologue): Likewise.
    * genpeep.c (main): Likewise.
    * genpreds.c (write_insn_preds_c): Likewise.
    * genrecog.c (write_header): Likewise.
    * Makefile.in (PLUGIN_HEADERS): Include memmodel.h

    gcc/ada/
    * gcc-interface/utils2.c: Include memmodel.h.

    gcc/c-family/
    * c-cppbuiltin.c: Include memmodel.h.
    * c-opts.c: Likewise.
    * c-pragma.c: Likewise.
    * c-warn.c: Likewise.

    gcc/c/
    * c-typeck.c: Include memmodel.h.

    gcc/cp/
    * decl2.c: Include memmodel.h.
    * rtti.c: Likewise.

    gcc/fortran/
    * trans-intrinsic.c: Include memmodel.h.

    gcc/go/
    * go-backend.c: Include memmodel.h.

    libgcc/
    * libgcov-profiler.c: Replace MEMMODEL_* macros by their __ATOMIC_*
    equivalent.
    * config/tilepro/atomic.c: Likewise and stop casting model to
    enum memmodel.

From-SVN: r241121
2016-10-13 14:17:52 +00:00
Bernd Edlinger 1686923c4b re PR rtl-optimization/77289 (ICE in extract_constrain_insn, at recog.c:2212 on powerpc64)
2016-09-13  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR rtl-optimization/77289
        * lra-constraints.c (get_final_hard_regno): Removed.
        (get_hard_regno): Add new parameter final_p.
        (get_reg_class): Directly call lra_get_elimination_hard_regno.
        (operands_match_p): Adjust call to get_hard_regno.
        (uses_hard_regs_p): Likewise.
        (process_alt_operands): Likewise.

From-SVN: r240124
2016-09-13 21:25:04 +00:00
Peter Bergner 9d0a9bb43a re PR rtl-optimization/77289 (ICE in extract_constrain_insn, at recog.c:2212 on powerpc64)
gcc/
	PR rtl-optimization/77289
	* lra-constraints.c (get_final_hard_regno): Add support for non hard
	register numbers.  Remove support for subregs.
	(get_hard_regno): Use SUBREG_P.  Don't call get_final_hard_regno().
	(get_reg_class): Delete removed get_final_hard_regno() argument.
	(uses_hard_regs_p): Call get_final_hard_regno().

gcc/testsuite/
	PR rtl-optimization/77289
	* gcc.target/powerpc/pr77289.c: New test.

From-SVN: r240065
2016-09-09 20:36:33 -05:00
Segher Boessenkool 2008be405c lra: A multiple_sets is not a simple_move_p (PR73650)
In the PR we have a PARALLEL of a move and a compare (a "mr." instruction).
The compare is dead, so single_set on it returns just the move.  Then,
simple_move_p returns true; but the instruction does need reloads in this
case.  This patch solves this by making simple_move_p return false for
every multiple_sets instruction.


	PR rtl-optimization/73650
	* lra-constraints.c (simple_move_p): If the insn is multiple_sets
	it is not a simple move.

From-SVN: r239483
2016-08-15 18:17:21 +02:00
Alan Modra 2e186411b3 [LRA] Reload of slow mems
pr71680.c -m64 -O1 -mlra, ira output showing two problem insns.
(insn 7 5 26 3 (set (reg:SI 159 [ a ])
        (mem/c:SI (reg/f:DI 158) [1 a+0 S4 A8])) pr71680.c:13 464 {*movsi_internal1}
     (expr_list:REG_EQUIV (mem/c:SI (reg/f:DI 158) [1 a+0 S4 A8])
        (nil)))
(insn 26 7 27 3 (set (reg:DI 162)
        (unspec:DI [
                (fix:SI (subreg:SF (reg:SI 159 [ a ]) 0))
            ] UNSPEC_FCTIWZ)) pr71680.c:13 372 {fctiwz_sf}
     (expr_list:REG_DEAD (reg:SI 159 [ a ])
        (nil)))
Insn 26 requires that reg 159 be of class FLOAT_REGS.

first lra action:
deleting insn with uid = 7.
Changing pseudo 159 in operand 1 of insn 26 on equiv [r158:DI]
      Creating newreg=164, assigning class ALL_REGS to subreg reg r164
   26: r162:DI=unspec[fix(r164:SI#0)] 7
      REG_DEAD r159:SI
    Inserting subreg reload before:
   30: r164:SI=[r158:DI]
[snip]
      Change to class FLOAT_REGS for r164

Well, that didn't do much.  lra tried the equiv mem, found that didn't
work, and had to reload.  Effectively getting back to the two original
insns but r159 replaced with r164.  simplify_operand_subreg did not do
anything in this case because SLOW_UNALIGNED_ACCESS was true (wrongly
for power8, but that's beside the point).  So now we have, using
abbreviated rtl notation:
r164:SI=[r158:DI]
r162:DI=unspec[fix(r164:SI)]
The problem here is that the first insn isn't valid, due to the rs6000
backend not supporting SImode in fprs, and r164 must be an fpr to make
the second insn valid.

next lra action:
      Creating newreg=165 from oldreg=164, assigning class GENERAL_REGS to r165
   30: r165:SI=[r158:DI]
    Inserting insn reload after:
   31: r164:SI=r165:SI
so now we have
r165:SI=[r158:DI]
r164:SI=r165:SI
r162:DI=unspec[fix(r164:SI)]

This ought to be good on power8, except for one little thing.
r165 is GENERAL_REGS so the first insn is good, a gpr load from mem.
r164 is FLOAT_REGS, making the last insn good, a fctiwz.
The second insn ought to be a sldi, mtvsrd, xscvspdpn combination, but
that is only supported for SFmode.  So lra continue on reloading the
second insn, but in vain because it never tries anything other than
SImode and as noted above, SImode is not valid in fprs.

What this patch does is arrange to emit the two reloads needed for the
SLOW_UNALIGNED_ACCESS case at once, moving the subreg to the second
insn in order to switch modes, producing:

r164:SI=[r158:DI]
r165:SF=r164:SI#0
r162:DI=unspec[fix(r165:SF)]

I've also tidied a couple of other things:
1) "old" is unnecessary as it duplicated "operand".
2) Rejecting mem subregs due to SLOW_UNALIGNED_ACCESS only makes sense
if the original mode was not slow.

	PR target/71680
	* lra-constraints.c (simplify_operand_subreg): Allow subreg
	mode for mem when SLOW_UNALIGNED_ACCESS if inner mode is also
	slow.  Emit two reloads for slow mem case, first loading in
	fast innermode, then converting to required mode.
testsuite/
	* gcc.target/powerpc/pr71680.c: New.

From-SVN: r239342
2016-08-11 08:42:11 +09:30
Vladimir Makarov b10d44efe5 re PR rtl-optimization/69847 (Spec 2006 403.gcc slows down with -mlra vs. reload on PowerPC)
2016-08-05  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/69847
	* lra-constraints.c (process_invariant_for_inheritance): Save
	pattern instead of src.
	(remove_inheritance_pseudos): Use the pattern.  Add assert.

From-SVN: r239180
2016-08-05 21:31:31 +00:00
Vladimir Makarov 8a8330b7ef re PR rtl-optimization/69847 (Spec 2006 403.gcc slows down with -mlra vs. reload on PowerPC)
2016-08-02  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/69847
	* lra-int.h (struct lra-reg): Use restore_rtx instead of
	restore_regno.
	(lra_rtx_hash): New.
	* lra.c (initialize_lra_reg_info_element): Use restore_rtx instead
	of restore_regno.
	(lra_rtx_hash): Rename and move lra-remat.c::rtx_hash.
	* lra-remat.c (rtx_hash): Rename and Move to lra.c.
	* lra-spills.c (lra_final_code_change): Don't delete insn when the
	next insn is USE with the same reg as the current insn source.
	* lra-constraints.c (curr_insn_transform): Use restore_rtx instead
	of restore_regno.
	(lra_constraints_init): Call initiate_invariants.
	(lra_constraints_finish): Call finish_invariants.
	(struct invariant, invariant_t, invariant_ptr_t): New.
	(const_invariant_ptr_t, invariants, invariants_pool): New.
	(invariant_table, invariant_hash, invariant_eq_p): New.
	(insert_invariant, initiate_invariants, finish_invariants): New.
	(clear_invariants, invalid_invariant_regs): New.
	(inherit_reload_reg, split_reg, fix_bb_live_info): Use restore_rtx
	instead of restore_regno.
	(invariant_p, process_invariant_for_inheritance): New.
	(inherit_in_ebb): Implement invariant inheritance.
	(lra_inheritance): Initialize and finalize invalid_invariant_regs.
	(remove_inheritance_pseudos): Implement undoing invariant
	inheritance.
	(undo_optional_reloads, lra_undo_inheritance): Use restore_rtx
	instead of restore_regno.
	* lra-assigns.c (regno_live_length): New.
	(reload_pseudo_compare_func): Use regno_live_length.
	(assign_by_spills): Use restore_rtx instead of restore_regno.
	(lra_assign): Ditto.  Initiate regno_live_length.

From-SVN: r238991
2016-08-02 16:07:36 +00:00
Thomas Preud'homme aefae0f13c re PR rtl-optimization/71878 (ICE in cselib_record_set)
2016-07-14  Thomas Preud'homme  <thomas.preudhomme@arm.com>

    gcc/
    PR rtl-optimization/71878
    * lra-constraints.c (match_reload): Pass information about other
    output operands.  Create new unique register value if matching input
    operand shares same register value as output operand being considered.
    (curr_insn_transform): Record output operands already processed.

From-SVN: r238346
2016-07-14 16:41:06 +00:00
Vladimir Makarov d13835b668 re PR rtl-optimization/71621 (ICE in assign_by_spills, at lra-assigns.c:1417 (error: unable to find a register to spill) w/ -O2 -mavx2 -ftree-vectorize)
2016-07-08  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/71621
	* lra-constraints.c (process_alt_operands): Check combination of
	reg class and mode.

2016-07-08  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/71621
	* gcc.target/i386/pr71621-1.c: New.
	* gcc.target/i386/pr71621-2.c: New.

From-SVN: r238178
2016-07-08 20:29:12 +00:00
Jiong Wang 10406801f4 [LRA] Don't count spilling cost for it offmemok
* lra-constraints.c (process_alt_operands): Don't add spilling cost for
	"offmemok".

From-SVN: r238010
2016-07-05 16:05:27 +00:00
Vladimir Makarov 5f225ef44a [Patch] PR70751, correct the cost for spilling non-pseudo into memory
PR rtl-optimization/70751
	* lra-constraints.c (process_alt_operands): Recognize Non-pseudo spilled
	into memory.


Co-Authored-By: Jiong Wang <jiong.wang@arm.com>

From-SVN: r237277
2016-06-09 21:28:31 +00:00
Jiong Wang 3c11e1af83 [Patch, lra] Guard in_class_p with REG_P check
gcc/

	PR rtl-optimization/71150
	* lra-constraint (process_addr_reg): Guard "in_class_p" with REG_P
	check.

From-SVN: r236396
2016-05-18 14:37:28 +00:00
Jiong Wang ada2eb687f [LRA] PR70904, relax the restriction on subreg reload for wide mode
2016-05-12  Jiong Wang  <jiong.wang@arm.com>

gcc/
  PR rtl-optimization/70904
  * lra-constraint.c (process_addr_reg): Relax the restriction on
  subreg reload for wide mode.

From-SVN: r236181
2016-05-12 17:00:52 +00:00
Vladimir Makarov 987b67f17c re PR middle-end/70689 (ICE on valid code at -O1 in 32-bit mode on x86_64-linux-gnu in curr_insn_transform, at lra-constraints.c:3564)
2016-04-18  Vladimir Makarov  <vmakarov@redhat.com>

	PR middle-end/70689
	* lra-constraints.c (equiv_substition_p): New.
	(process_alt_operands): Use it.
	(swap_operands): Swap it.
	(curr_insn_transform): Update it.

2016-04-18  Vladimir Makarov  <vmakarov@redhat.com>

	PR middle-end/70689
	* testsuite/gcc.target/i386/pr70689.c: New.

From-SVN: r235184
2016-04-19 02:49:54 +00:00
Vladimir Makarov bc2fc1f3b8 re PR rtl-optimization/70398 (gcc.dg/vect/slp-multitypes-9.c FAILs with -fno-tree-loop-optimize -fno-tree-ter)
2016-04-06  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/70398
	* lra-constraints.c (process_address_1): Check zero scale and code
	for reloading with zero scale.

2016-04-06  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/70398
	* testsuite/gcc.target/aarch64/pr70398.c: New.

From-SVN: r234792
2016-04-06 16:48:36 +00:00
Bernd Schmidt 5c6a601cd2 Fix PR70278, a problem with the previous split_reg change
PR rtl-optimization/70278
	* lra-constraints.c (split_reg): Handle the case where biggest_mode is
	VOIDmode.

testsuite/
	* gcc.dg/torture/pr70278.c: New test.
	* gcc.target/arm/pr70278.c: New test.

From-SVN: r234342
2016-03-18 19:09:08 +00:00
Jakub Jelinek 79b57d18c6 re PR middle-end/70219 (ICE: in delete_move_and_clobber, at lra-constraints.c:5864 with -O2)
PR middle-end/70219
	* lra-constraints.c (delete_move_and_clobber): Change assertion
	to also allow dregno == 0.

	* gcc.dg/pr70219.c: New test.

From-SVN: r234201
2016-03-14 23:19:32 +01:00
Bernd Schmidt 3cbf012a40 LRA: identify biggest access mode for hard_regs and use it in split_reg
PR target/70083
	* lra-lives.c (process_bb_lives): Also update biggest mode for hard
	regs.
	(lra_create_live_ranges_1): initialize hard register biggest_mode to
	VOIDmode.
	* lra-constraints.c (split_reg): For hard regs, try to find the
	biggest single-register mode used in the function.

testsuite/
	PR target/70083
	* gcc.dg/torture/pr70083.c: New test.
	* gcc.target/i386/pr70083.c: New test.

From-SVN: r234184
2016-03-14 15:08:54 +00:00
Vladimir Makarov cefe08a4ec re PR target/69614 (wrong code with -Os -fno-expensive-optimizations -fschedule-insns -mtpcs-leaf-frame -fira-algorithm=priority @ armv7a)
2016-03-12  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/69614
	* lra-constraints.c (delete_move_and_clobber): New.
	(remove_inheritance_pseudos): Use it.

2016-03-12  Vladimir Makarov  <vmakarov@redhat.com>

	PR target/69614
	* gcc.target/arm/pr69614.c: New.

From-SVN: r234162
2016-03-12 14:56:24 +00:00