opt_dead_store: Optimizer: Dead Store Elimination.

View source: R/opt-dead-store.R

opt_dead_storeR Documentation

Optimizer: Dead Store Elimination.

Description

Performs one dead store elimination pass. Carefully examine the results after running this function!

Usage

opt_dead_store(texts)

Arguments

texts

A list of character vectors with the code to optimize.

Examples

code <- paste(
  "foo <- function() {",
  "  x <- 128 ^ 2",
  "  return(TRUE)",
  "}",
  sep = "\n"
)
cat(opt_dead_store(list(code))$codes[[1]])

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]])


jcrodriguez1989/rco documentation built on Nov. 12, 2024, 12:23 p.m.