`create_bool_from_template_assertion_predicate()` is currently hard to understand and does many things simultaneously. For the complete fix for assertion predicates (JDK-8288981), we need to adapt the algorithm which is difficult.
On top of that, the current algorithm to do the DFS walk contains a bug which could lead to an endless DFS processing. The DFS implementation does not use a visited set. This means that we could visit a node twice and repeat previous work. In some edge cases (see attached EndlessDFS.java), we could spend a very long time in the DFS walk. The test case contains many diamonds which creates an exponential explosion of different paths which are all visited by the current DFS implementation. This is also fixed in the refactored code of this algorithm.
While the refactoring fixes the endless DFS problem, we do not replace all uses of `create_bool_from_template_assertion_predicate()`, yet. Loop Unswitching and Split If use `create_bool_from_template_assertion_predicate()` for pure cloning while the remaining cases also require a transformation of the OpaqueLoop* nodes. These remaining cases and the complete removal of `create_bool_from_template_assertion_predicate()` is done separately in JDK-8327111 which will then also completely fix the endless DFS problem.