This is a case D97178 tried to solve but missed. D97178 could not handle
the case when
multiple consecutive delegates are generated:
- Before:
block br (a) try catch end_try end_block <- (a)
- After
block br (a) try ... try try catch end_try <- (a) delegate delegate end_block <- (b)
(The br should point to (b) now)
D97178 assumed end_block exists two BBs later than end_try, because
it assumed the order as end_try BB -> delegate BB -> end_block BB.
But it turned out there can be multiple delegates in between. This
patch changes the logic so we just search from end_try BB until we
find end_block.
Fixes https://github.com/emscripten-core/emscripten/issues/13515.
(More precisely, fixes
https://github.com/emscripten-core/emscripten/issues/13515#issuecomment-784711318.)
genearted => generated