When we fixup a noreturn call during inlining we can end up eliding
debug stmts, so we have to make sure to not re-instantiate SSA
operands on those later when processing all debug stmts.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed to trunk.
PR tree-optimization/124627
* tree-inline.cc (copy_debug_stmts): Only copy debug
stmts that are still in the IL.
---
gcc/tree-inline.cc | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index 98ef6310d06..087fcc8a8b8 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -3372,7 +3372,9 @@ copy_debug_stmts (copy_body_data *id)
return;
for (gdebug *stmt : id->debug_stmts)
- copy_debug_stmt (stmt, id);
+ /* But avoid re-processing debug stmts that have been elided. */
+ if (gimple_bb (stmt))
+ copy_debug_stmt (stmt, id);
id->debug_stmts.release ();
}
--
2.51.0