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

Ignore conditions guarding __builtin_unreachable in inliner metrics

This extends my last year attempt to make inliner metric ignore
conditionals guarding __builtin_unreachable.  Compared to previous
patch, this one implements a "mini-dce" in ipa-fnsummary to avoid
accounting all statements that are only used to determine conditionals
guarding __builtin_unnecesary.  These will be removed later once value
ranges are determined.

While working on this, I noticed that we do have a lot of dead code while
computing fnsummary for early inline. Those are only used to apply
large-function growth, but it seems there is enough dead code to make this
valud kind of irrelevant.  Also there seems to be quite a lot of const/pure
calls that can be cheaply removed before we inline them.  So I wonder if we
want to run one DCE before early inlining.

gcc/ChangeLog:

	PR tree-optimization/109442
	* ipa-fnsummary.cc (builtin_unreachable_bb_p): New function.
	(guards_builtin_unreachable): New function.
	(STMT_NECESSARY): New macro.
	(mark_stmt_necessary): New function.
	(mark_operand_necessary): New function.
	(find_necessary_statements): New function.
	(analyze_function_body): Use it.

gcc/testsuite/ChangeLog:

	* gcc.dg/ipa/fnsummary-1.c: New test.
parent 064c6493
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