Performs one dead store elimination pass. Carefully examine the results after running this function!
opt_dead_store(texts)
texts | A list of character vectors with the code to optimize. |
---|
code <- paste( "foo <- function() {", " x <- 128 ^ 2", " return(TRUE)", "}", sep = "\n" ) cat(opt_dead_store(list(code))$codes[[1]])#> foo <- function() { #> 128 ^ 2 #> return(TRUE) #> }code <- paste( "sinpi <- function() {", " pi <- 3.1415", " e <- 2.718", " phi <- 1.618", " sin(pi)", "}", sep = "\n" ) cat(opt_dead_store(list(code))$codes[[1]])#> sinpi <- function() { #> pi <- 3.1415 #> 2.718 #> 1.618 #> sin(pi) #> }