preserve more debug stmts in gimple jump threading

Gimple jump threading does not duplicate forwarder blocks that might
be present before or after the second copied block.  This silently
drops debug binds and markers that might be present in them.  This
patch attempts to preserve them.

For blocks after either copied block, we attempt to append debug stmts
to the copied block, if it does not end with a block-ending stmt.
Failing that, for blocks between both copied blocks, we prepend its
debug stmts to the copy of the second block.

If everything fails, we still drop debug stmts on the floor, though
preexisting code consolidates debug binds in the block that threading
flows into, so only markers are really lost.  We can't do much better
than that without conditional binds and markers, or debug stmts in
edges, or somesuch.

If we append debug stmts to a reusable template block, we copy it
after splitting out the debug stmts, and before putting them back.


for  gcc/ChangeLog

	* tree-ssa-threadupdate.c (struct ssa_local_info_t): Add
	field template_last_to_copy.
	(ssa_create_duplicates): Set it, and use it.  Attempt to
	preserve more debug stmts.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@271477 138bc75d-0d04-0410-961f-82ee72b054a4
2 files changed