Of course, LLVM converts all types of loops into a consistent form (if possible, of course). Thus, if you have the same functionality, it doesnโt really matter if you use for , while , do-while or goto to form a loop, if it received the same initialization, the exit condition and update and body, it will give same machine code.
This is difficult to do in the compiler if it was done early enough during optimization (therefore, the compiler still understands what is actually being written). The goal of this โmake all loops equalโ is that you only need one way to optimize loops, instead of having one for while-loops, one for for-loops, one for do-while and one for "any other loops "".
This is not guaranteed for ALL compilers, but I know that gcc / g ++ also generates almost identical code no matter what the contour is built, and from what I saw, Microsoft also does the same.
source share