Skip to content

Instantly share code, notes, and snippets.

@nikic

nikic/dj.diff Secret

Created April 16, 2021 09:49
Show Gist options
  • Save nikic/072a365f6fe2f07e523757de0eb6c61f to your computer and use it in GitHub Desktop.
Save nikic/072a365f6fe2f07e523757de0eb6c61f to your computer and use it in GitHub Desktop.
diff --git a/Zend/Optimizer/zend_cfg.c b/Zend/Optimizer/zend_cfg.c
index badf9d298b..a8f6588f2e 100644
--- a/Zend/Optimizer/zend_cfg.c
+++ b/Zend/Optimizer/zend_cfg.c
@@ -887,6 +887,10 @@ ZEND_API int zend_cfg_identify_loops(const zend_op_array *op_array, zend_cfg *cf
}
while (zend_worklist_len(&work)) {
j = zend_worklist_pop(&work);
+ if (j != 0 && blocks[j].idom < 0) {
+ /* Ignore blocks that are unreachable or only abnormally reachable. */
+ continue;
+ }
while (blocks[j].loop_header >= 0) {
j = blocks[j].loop_header;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment