rtl-optimization/105559 - avoid quadratic behavior in delete_insn_and_edges
Commit Message
When the insn to delete is a debug insn there's no point in figuring
out whether it might be the last real insn and thus we have to purge
dead edges.
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
2022-05-11 Richard Biener <rguenther@suse.de>
PR rtl-optimization/105559
* cfgrtl.cc (delete_insn_and_edges): Only perform search to BB_END
for non-debug insns.
---
gcc/cfgrtl.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -240,7 +240,7 @@ delete_insn_and_edges (rtx_insn *insn)
basic_block bb = BLOCK_FOR_INSN (insn);
if (BB_END (bb) == insn)
purge = true;
- else if (DEBUG_INSN_P (BB_END (bb)))
+ else if (NONDEBUG_INSN_P (insn) && DEBUG_INSN_P (BB_END (bb)))
for (rtx_insn *dinsn = NEXT_INSN (insn);
DEBUG_INSN_P (dinsn); dinsn = NEXT_INSN (dinsn))
if (BB_END (bb) == dinsn)