Abstract out can_duplicate_block_on_edge_p from tree-ssa-threadedge.cc [PR126896]

Both the jump threader's joiner registration and the upcoming phiopt
replication of PHI-of-compares joins need a way to determine if a
block on an edge can be duplicated.  Abstract out the code in
tree-ssa-threadedge.cc to be reusable by the upcoming work.

	PR tree-optimization/126896

gcc/ChangeLog:

	* cfghooks.cc (can_duplicate_block_on_edge_p): New.
	* cfghooks.h (can_duplicate_block_on_edge_p): Declare.
	* tree-ssa-threadedge.cc: Include cfghooks.h.
	(jump_threader::thread_across_edge): Use
	can_duplicate_block_on_edge_p.
3 files changed