https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102844
--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following removes the premature optimization(?) using
EDGE_NO_COPY_SRC_BLOCK
in case the block contained a condition we could thread through. That fixes
the testcase.
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c
index c3ea2d680d8..2005e30322b 100644
--- a/gcc/tree-ssa-threadedge.c
+++ b/gcc/tree-ssa-threadedge.c
@@ -989,8 +989,11 @@ thread_around_empty_blocks (edge taken_edge,
return false;
bitmap_set_bit (visited, taken_edge->dest->index);
+ /* We may not use EDGE_NO_COPY_SRC_BLOCK since the condition
+ might later be simplified to something needing a temporary
+ SSA definition. See PR102844. */
jump_thread_edge *x
- = new jump_thread_edge (taken_edge, EDGE_NO_COPY_SRC_BLOCK);
+ = new jump_thread_edge (taken_edge, EDGE_COPY_SRC_BLOCK);
path->safe_push (x);
thread_around_empty_blocks (taken_edge,