tests/nestedLoops2.R

library(RLLVMCompile)

f = function(n) {
   ctr = 0L
   for(i in 1:n)
      for(j in 1:i) {
         if(i == j)
           printf("diagonal %d\n", i)
         ctr = ctr + 1L
      }
   ctr
}

fc = compileFunction(f, Int32Type, Int32Type)

stopifnot(.llvm(fc, 10) == 55L)
cat("okay\n")
duncantl/RLLVMCompile documentation built on May 15, 2019, 5:31 p.m.