[LLVMdev] please advise on PassManager

Chris Lattner clattner at apple.com
Wed Oct 17 12:58:52 PDT 2012

On Oct 17, 2012, at 7:34 AM, Kostya Serebryany <kcc at google.com> wrote:

> Hello, 
> I've recently changed AddressSanitizer (asan) compiler pass from ModulePass to FunctionPass and it could a bit of mayhem. 
> The problem is that asan FunctionPass instruments a function foo, then foo gets inlined into bar, then bar gets instrumented
> and thus the code of foo gets instrumented twice (which causes run-time crash).
> This happens only at -O0; at -O1 we get the correct order of events for some reason (foo gets inlined, then foo and bar are instrumented). 

I'm not sure what the difference here is between -O0 and -O1, but this *is* intended behavior.  This "interlacing" of passes is really important for C++ optimization (among other things) where optimizing a function can dramatically shrink it (due to abstraction penalties being removed)… which then makes it a much strongly inline candidate.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121017/deca85be/attachment.html>

More information about the llvm-dev mailing list