]> git.pld-linux.org Git - packages/gcc.git/blame - gcc-cse-find_best_addr.patch
- added gcc-cmpi.patch (ppc build fix)
[packages/gcc.git] / gcc-cse-find_best_addr.patch
CommitLineData
f0f0d871
JB
1> On Thu, Jun 19, 2003 at 08:31:03AM +0200, Jan Hubicka wrote:
2> > > Nathan Myers <ncm-nospam@cantrip.org> writes:
3> > >
4> > > > gnu/include/c++/3.4/x86_64-unknown-linux-gnu/bits/atomicity.h: In
5> > > > function `int main()':
6> > > > /amd/ncm/gnu/include/c++/3.4/x86_64-unknown-linux-gnu/bits/atomicity.h:43: error: inconsistent
7> > > > operand constraints in an `asm'
8> > >
9> > > Honza, isn't this the bug in gcse that you're hunting down?
10> > Yes, that looks like the same CSE problem. I will try to give it
11> > priority this afternoon so it gets fixed.
12>
13> I take it, then, that this is a core compiler bug and not a std headers bug?
14This patch should fix the problem. (at least it fixes it for the
15similar testcase that comes from proprietary program. Do you think you
16can simplify your code into small enought testcase for testsuite?)
17
18Bootstrap passed on x86-64, regtest in progress, OK if it suceeds?
19
20Honza
21
22Sat Jun 21 14:51:44 CEST 2003 Jan Hubicka <jh@suse.cz>
23 * cse.c (find_best_addr): Fold the best address discovered.
24Index: cse.c
25===================================================================
26RCS file: /cvs/gcc/gcc/gcc/cse.c,v
27retrieving revision 1.243.2.4
28diff -c -3 -p -r1.243.2.4 cse.c
29*** gcc/gcc/cse.c 6 Jun 2003 10:09:09 -0000 1.243.2.4
30--- gcc/gcc/cse.c 21 Jun 2003 12:49:18 -0000
31*************** find_best_addr (insn, loc, mode)
32*** 3021,3029 ****
33
34 if (found_better)
35 {
36! if (validate_change (insn, loc,
37! canon_reg (copy_rtx (best_elt->exp),
38! NULL_RTX), 0))
39 return;
40 else
41 best_elt->flag = 1;
42--- 3021,3049 ----
43
44 if (found_better)
45 {
46! /* Avoid find_best_addr from touching this address again:
47! at the beggining of this function we attempt to fold
48! the address. Do it now as well. Not doing so would mean
49! that we will create multiple versions of the address in the
50! insn chain that may result in "+m" ASM constraint from not
51! being matched. */
52!
53! rtx best = canon_reg (copy_rtx (best_elt->exp), NULL_RTX);
54! rtx folded = fold_rtx (copy_rtx (best), NULL_RTX);
55! int addr_folded_cost = address_cost (folded, mode);
56! int addr_cost = address_cost (best, mode);
57!
58! if ((addr_folded_cost < addr_cost
59! || (addr_folded_cost == addr_cost
60! /* ??? The rtx_cost comparison is left over from an
61! older version of this code. It is probably no
62! longer helpful. */
63! && (rtx_cost (folded, MEM) > rtx_cost (addr, MEM)
64! || (approx_reg_cost (folded)
65! < approx_reg_cost (addr)))))
66! && validate_change (insn, loc, folded, 0))
67! return;
68! if (validate_change (insn, loc, best, 0))
69 return;
70 else
71 best_elt->flag = 1;
This page took 0.039557 seconds and 4 git commands to generate.