]> git.pld-linux.org Git - packages/gcc.git/blob - gcc-cse-find_best_addr.patch
This commit was manufactured by cvs2git to create branch 'AC-branch'.
[packages/gcc.git] / gcc-cse-find_best_addr.patch
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?
14 This patch should fix the problem.  (at least it fixes it for the
15 similar testcase that comes from proprietary program.  Do you think you
16 can simplify your code into small enought testcase for testsuite?)
17
18 Bootstrap passed on x86-64, regtest in progress, OK if it suceeds?
19
20 Honza
21
22 Sat Jun 21 14:51:44 CEST 2003  Jan Hubicka  <jh@suse.cz>
23         * cse.c (find_best_addr):  Fold the best address discovered.
24 Index: cse.c
25 ===================================================================
26 RCS file: /cvs/gcc/gcc/gcc/cse.c,v
27 retrieving revision 1.243.2.4
28 diff -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.04545 seconds and 3 git commands to generate.