powered by
Performs one loop-invariant code motion pass. Carefully examine the results after running this function!
opt_loop_invariant(texts)
A list of character vectors with the code to optimize.
# NOT RUN { code <- paste( "i <- 0", "while (i < n) {", " x <- y + z", " a[i] <- 6 * i + x * x", " i <- i + 1", "}", sep = "\n" ) cat(opt_loop_invariant(list(code))$codes[[1]]) # }
Run the code above in your browser using DataLab