I have a FunctionPass that is being scheduled by the legacy pass manager using EP_OptimizerLast. It is an instrumentation pass that makes a function bigger. The problem is that runOnFunction() is being called many times for the same function, resulting in runaway growth and eventual OOM for the clang process.
I see that sanitizer passes are using EP_OptimizerLast, so obviously the capacity to run once is available. Is there some mistake I might be making that would cause LLVM to do this? If not, can someone let me know how to tell LLVM to call runOnFunction() only one time for each function?
This behavior does not happen for all functions or in all files, and it seems to be more common on Linux than Mac. So perhaps an LLVM bug of some sort?
I see the same behavior using r238200 and r240137.