cannelloni: needs dynamic library
[buildroot-gz.git] / package / gcc / 4.8.5 / 842-PR60155.patch
blob7bc2122fd4d86898a313f0c3b13c83e99c70f490
1 From gcc bugzilla https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60155
2 Upstream status: in trunk.
4 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
6 --- trunk/gcc/gcse.c 2014/02/12 14:50:06 207726
7 +++ trunk/gcc/gcse.c 2014/04/04 22:25:51 209134
8 @@ -2502,6 +2502,65 @@
12 +struct set_data
14 + rtx insn;
15 + const_rtx set;
16 + int nsets;
17 +};
19 +/* Increment number of sets and record set in DATA. */
21 +static void
22 +record_set_data (rtx dest, const_rtx set, void *data)
24 + struct set_data *s = (struct set_data *)data;
26 + if (GET_CODE (set) == SET)
27 + {
28 + /* We allow insns having multiple sets, where all but one are
29 + dead as single set insns. In the common case only a single
30 + set is present, so we want to avoid checking for REG_UNUSED
31 + notes unless necessary. */
32 + if (s->nsets == 1
33 + && find_reg_note (s->insn, REG_UNUSED, SET_DEST (s->set))
34 + && !side_effects_p (s->set))
35 + s->nsets = 0;
37 + if (!s->nsets)
38 + {
39 + /* Record this set. */
40 + s->nsets += 1;
41 + s->set = set;
42 + }
43 + else if (!find_reg_note (s->insn, REG_UNUSED, dest)
44 + || side_effects_p (set))
45 + s->nsets += 1;
46 + }
49 +static const_rtx
50 +single_set_gcse (rtx insn)
52 + struct set_data s;
53 + rtx pattern;
55 + gcc_assert (INSN_P (insn));
57 + /* Optimize common case. */
58 + pattern = PATTERN (insn);
59 + if (GET_CODE (pattern) == SET)
60 + return pattern;
62 + s.insn = insn;
63 + s.nsets = 0;
64 + note_stores (pattern, record_set_data, &s);
66 + /* Considered invariant insns have exactly one set. */
67 + gcc_assert (s.nsets == 1);
68 + return s.set;
71 /* Emit move from SRC to DEST noting the equivalence with expression computed
72 in INSN. */
74 @@ -2509,7 +2568,8 @@
75 gcse_emit_move_after (rtx dest, rtx src, rtx insn)
77 rtx new_rtx;
78 - rtx set = single_set (insn), set2;
79 + const_rtx set = single_set_gcse (insn);
80 + rtx set2;
81 rtx note;
82 rtx eqv = NULL_RTX;
84 @@ -3369,13 +3429,12 @@
85 FOR_EACH_VEC_ELT (occrs_to_hoist, j, occr)
87 rtx insn;
88 - rtx set;
89 + const_rtx set;
91 gcc_assert (!occr->deleted_p);
93 insn = occr->insn;
94 - set = single_set (insn);
95 - gcc_assert (set);
96 + set = single_set_gcse (insn);
98 /* Create a pseudo-reg to store the result of reaching
99 expressions into. Get the mode for the new pseudo
100 @@ -3456,10 +3515,8 @@
102 rtx reg;
103 enum reg_class pressure_class;
104 - rtx set = single_set (insn);
105 + const_rtx set = single_set_gcse (insn);
107 - /* Considered invariant insns have only one set. */
108 - gcc_assert (set != NULL_RTX);
109 reg = SET_DEST (set);
110 if (GET_CODE (reg) == SUBREG)
111 reg = SUBREG_REG (reg);