-stats prints nothing, though something is expected

Given the program:

int sum(int i,int j)
{ return i+j; }

int main()
{ sum(3,2); }

$ clang -S -emit-llvm foo.c

Now I’d like to print all statistics. Unfortunately, the following prints nothing:

$ opt -S -O3 -stats < foo.ll > /dev/null

However, running the following prints an IR that is different to the contents of foo.ll:

$ opt -S -O3 foo.ll

I’m using LLVM 3.5. I’m doing something very obviously wrong. What is it?

You are mostly likely using a Release build. -stats only does anything with Assertions enabled.

Hi Philip,