This is the mail archive of the gcc-patches@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: [PATCH]: Reduce memory usage and compile time necessary for pruning


> In order to catch places where this is not happening, i have added an
> assert that verifies we don't add bare defs unless TMT_USED_ALONE is set
> true, which will catch places where it is not updated but needs to be.

This triggers during the compilation of ASIS (a standard Ada add-on).  I've 
reduced the function to a few statements but it depends on a bunch of spec 
files so I'm not sure you would be really interested in seeing them. :-)

Here's the scenario:

Variable: D.1598, UID 1598, struct ALLOC *, symbol memory tag: SMT.25

D.1598_38, is dereferenced, points-to anything

Variable: SMT.25, UID 1653, struct ALLOC, is addressable, is global, call 
clobbered, may aliases: { A.2 }

Aliased symbols:
SMT.25, UID 1653, struct ALLOC, is addressable, is global, call clobbered, may 
aliases: { A.2 }

Dereferenced pointers:
D.1598, UID 1598, struct ALLOC *, symbol memory tag: SMT.25

Symbol memory tags:
SMT.25, UID 1653, struct ALLOC, is addressable, is global, call clobbered, may 
aliases: { A.2 }


The statement before copyprop1 is

  #   A.2_276 = V_MAY_DEF <A.2_270>;
  #   SMT.25_280 = V_MAY_DEF <SMT.25_274>;
  D.1598_38->ARRAY[2]{lb: 1 sz: 48} = a4g__mapping__node_to_element_new 
(arg_node_17, 0, 0, statement_3, 399, 0, 0, 1, 1, 0, 
&asis__nil_compilation_unit) [return slot optimization];

In other words, a MODIFY-CALL statement.

SMT_USED_ALONE is never set on SMT.25.  add_virtual_operand is invoked twice 
for SMT.25 on the statement when updating_used_alone is not set (after 
copyprop1), the first time by add_call_clobber_ops and the new check is not 
exercised because

	  if (v_ann->is_aliased
	      || none_added
	      || (TREE_CODE (var) == SYMBOL_MEMORY_TAG
		  && for_clobber
		  && SMT_USED_ALONE (var)))

is false (A.2 is added to the list of MAY_DEF variables).

The second time is by get_indirect_ref_operands because of the dereference of 
D.1598.  But A.2 has nothing to do with D.1598 so is not added on the list.
So the above conditional is true and the check triggers

	      /* Every bare SMT def we add should have SMT_USED_ALONE
		 set on it, or else we will get the wrong answer on
		 clobbers.  */
	      if (none_added
		  && !updating_used_alone && aliases_computed_p
		  && TREE_CODE (var) == SYMBOL_MEMORY_TAG)
		gcc_assert (SMT_USED_ALONE (var));


It seems to me that the MODIFY part of MODIFY-CALL statements is not processed 
in recalculate_used_alone so is not allowed to have SMT as vops.

What do you think?  Thanks in advance.

-- 
Eric Botcazou


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