spmd_compile: Add support for while loop