This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Value numbering and volatility


On 6/21/06, Eric Botcazou <ebotcazou@adacore.com> wrote:
Hi,

We're experiencing a memory explosion during PRE on several ACATS tests with
mainline (+1 local patch, but it's very likely the same issue as PR 27937).

Excerpt from .067t.pre:

Created value VH.26 for (struct cd5012i__genproc__cell *volatile & {ref-all})
VH.25
Created value VH.33 for *VH.26 vuses: (fcndecl__var0_49,HEAP.8_51,SMT.10_52)
Created value VH.34 for *VH.26 vuses: (fcndecl__var0_49,HEAP.8_51,SMT.10_52)
Created value VH.47 for *VH.26 vuses: (fcndecl__var0_49,HEAP.8_51,SMT.10_52)
Created value VH.49 for *VH.26 vuses: (fcndecl__var0_49,HEAP.8_51,SMT.10_52)
[...]

and so on ad nauseam.  The problem boils down to operand_equal_p returning
false on

operand_equal_p (arg0=0x93dc744, arg1=0x94d4724, flags=2)
    at /home/eric/gnat/gnat6/src/gcc/fold-const.c:2491
2491      if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) ==
ERROR_MARK)
(gdb) p debug_tree(arg0)
 <indirect_ref 0x93dc744
    type <pointer_type 0x556f7ac8 cd5012i__genproc__pointer
        type <record_type 0x556f77e8 cd5012i__genproc__cell sizes-gimplified
DI
            size <integer_cst 0x556a9528 constant invariant visited 64>
            unit size <integer_cst 0x556a9540 constant invariant 8>
            align 32 symtab 0 alias set 5 fields <field_decl 0x556f78a0 value>
Ada size <integer_cst 0x556a9528 64>
            pointer_to_this <pointer_type 0x556f3d4c
cd5012i__genproc__pointer>chain <type_decl 0x556bf208 D.619>>
        sizes-gimplified volatile public unsigned SI
        size <integer_cst 0x556a93f0 constant invariant 32>
        unit size <integer_cst 0x556a9180 constant invariant 4>
        user align 32 symtab 0 alias set -1 reference_to_this <reference_type
0x556f7b24>>
    side-effects volatile
    arg 0 <value_handle 0x55704160
        type <reference_type 0x556f7b24 type <pointer_type 0x556f7ac8
cd5012i__genproc__pointer>
            sizes-gimplified static unsigned SI size <integer_cst 0x556a93f0
32> unit size <integer_cst 0x556a9180 4>
            align 32 symtab 0 alias set -1>
       >
    cd5012i.adb:27>
$5 = void
(gdb) p debug_tree(arg1)
 <indirect_ref 0x94d4724
    type <pointer_type 0x556f7ac8 cd5012i__genproc__pointer
        type <record_type 0x556f77e8 cd5012i__genproc__cell sizes-gimplified
DI
            size <integer_cst 0x556a9528 constant invariant visited 64>
            unit size <integer_cst 0x556a9540 constant invariant 8>
            align 32 symtab 0 alias set 5 fields <field_decl 0x556f78a0 value>
Ada size <integer_cst 0x556a9528 64>
            pointer_to_this <pointer_type 0x556f3d4c
cd5012i__genproc__pointer>chain <type_decl 0x556bf208 D.619>>
        sizes-gimplified volatile public unsigned SI
        size <integer_cst 0x556a93f0 constant invariant 32>
        unit size <integer_cst 0x556a9180 constant invariant 4>
        user align 32 symtab 0 alias set -1 reference_to_this <reference_type
0x556f7b24>>
    side-effects volatile
    arg 0 <value_handle 0x55704160
        type <reference_type 0x556f7b24 type <pointer_type 0x556f7ac8
cd5012i__genproc__pointer>
            sizes-gimplified static unsigned SI size <integer_cst 0x556a93f0
32> unit size <integer_cst 0x556a9180 4>
            align 32 symtab 0 alias set -1>
       >
    cd5012i.adb:27>
$6 = void

i.e. 2 dereferences of the same volatile VALUE_HANDLE because of:

    case tcc_reference:
      /* If either of the pointer (or reference) expressions we are
         dereferencing contain a side effect, these cannot be equal.  */
      if (TREE_SIDE_EFFECTS (arg0)
          || TREE_SIDE_EFFECTS (arg1))
        return 0;


It seems to me that the volatility should be accounted for in the VALUE_HANDLE itself only, not in (de)references to it.

Thoughts?

What do you mean by "in the VALUE_HANDLE itself"? I think we should not bother value-numbering volatile mem-accesses at all.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]