Skip to content
Snippets Groups Projects
Commit cc33f880 authored by Jan Hubicka's avatar Jan Hubicka
Browse files

Avoid expicit builtion list in tree-ssa-dce

while working on -fmalloc-dce I noticed that tree-ssa-dce.cc still has an
outdated list of builtions that are known to not read memory that can be
replaced by query to fnspec and modref.

If I get things right, dce does some dead store removal, but only on those
memory object that are non-aliased (automatic variabels with no address taken)
and for all other memory addresses it resorts to
mark_all_reaching_defs_necessary expecting DSE to do the rest.  So we really
want to only check if there are no memory reads at all rather then trying to
understand them by parsing fnspec or modref summary.

I did run testsuite ensuring that all builtins matched previously are
still matched.  There are few testcases where this check fails, due to
type incompatibility.  New code uses gimple_call_builtin while other
just checked callee_decl.

We test things like calling free() without parmeter which I don't think
we want to care about, but there is also testase declaring

void * calloc (long, long)

where builtin declaration expects unsigned long.  I am not sure if this
case should not be allowed by gimple_call_builtin?

Bootstrappe/regtested x86_64-linux. OK?

gcc/ChangeLog:

	* ipa-modref.cc (ipa_modref_callee_reads_no_memory_p): New function.
	* ipa-modref.h (ipa_modref_callee_reads_no_memory_p): Declare
	* tree-ssa-dce.cc (propagate_necessity): Use it.
parent 101f8c73
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment