I assumed the LLVM-IR behind the godbolt link represented the C code you used before. SimplifyCFG actually helps the loop being removed: https://godbolt.org/z/5v7SXh But this doesn't even involve JumpThreading. Michael