[llvm-dev] ScalarEvolution pass and interprocedural analysis

Dmitrii Kuvaiskii via llvm-dev llvm-dev at lists.llvm.org
Fri Sep 2 06:01:58 PDT 2016


Hello all,

I was looking for an analysis pass that could provide comprehensive
information on pointer arithmetic in the context of whole-program
optimization. It seems that Scalar Evolution provides exactly what I'm
looking for, but it is restricted to only intraprocedural analysis.

E.g., consider this toy snippet:

void foo(int* p) { (*p)++; }

int bar() {
  int i;
  for (i = 0; i < n; i++) {
    foo(&i);
  }
  return i;
}

Here Scalar Evolution will not be able to compute a SCEV expression on
`i` (assume no inline of foo).

So, two questions: (1) is there a way to make Scalar Evolution work in
an interprocedural manner? (2) would it be too expensive in terms of
compilation time for real-world (think memcached, nginx) programs?

Any feedback/hints/papers are welcome, thanks in advance. Also, any
good manual on how ScalarEvolution can be used in LLVM would be great
(currently I'm looking into how other LLVM passes use it).

-- 
Yours sincerely,
Dmitrii Kuvaiskii


More information about the llvm-dev mailing list