rco icon indicating copy to clipboard operation
rco copied to clipboard

New feature: LICM - Include repeat optimization?

Open jcrodriguez1989 opened this issue 5 years ago • 0 comments

Since determining the conditional that causes a repeat loop to stop is not that simple, it is not easy to remove invariant variables and place them in an if.

For example, the code:

y <- 1
repeat{
  if (y > 4) {
    break
  }
  x <- 8 * 8
  y <- y + 1
}

Should be optimized to:

y <- 1
if (y <= 4) {
  x <- 8 * 8
}
repeat{
  if (y > 4) {
    break
  }
  y <- y + 1
}

jcrodriguez1989 avatar Aug 20 '19 16:08 jcrodriguez1989