Control flow graphs are well-studied, critical parts of most compilers. The halting problem involves complexity of semantics in loops and jumps, but it’s possible to understand what loops
may run just fine, without being able to decide
exactly when a loop may exit.
In many cases Clang and GCC compiler can easily understand loops, and even reduce them to constant time.