[LLVMdev] Total size of global data

Scott Ricketts sricketts at maxentric.com
Tue Jul 21 13:31:23 PDT 2009


On Tue, Jul 21, 2009 at 1:21 PM, Eli Friedman<eli.friedman at gmail.com> wrote:
> It's impossible to tell what exactly will get merged until link-time;
> also, CodeGen often introduces constant globals.

This is something I had not yet considered. I will take a closer look.

> That said, as far as
> I know, LLVM doesn't know how to merge constants beyond running the
> constmerge pass and emitting globals into sections which can be
> merged.

Something is merging constants in my test cases. I do not explicitly
run "constmerge."

> What are you actually trying to do?
>
> -Eli

I want to calculate the high water mark of the memory footprint of a
program at run time. I instrument the LLVM IR with calls to my
library, which keeps track of the size of the allocated memory in
scope.

Everything works fine, except the accounting for global allocation is
not quite right because of the constant merging issue.

Scott



More information about the llvm-dev mailing list