[LLVMdev] Running Pool Allocated programs
sabre at nondot.org
Sat Apr 2 16:51:43 PST 2005
On Sat, 2 Apr 2005, Ricardo wrote:
> After applying the PA to it, the output is something like this:
> My question is: why is this malloc necessary?
> ltmp_2_5 = malloc(4u);
> Shouldn't be the result a program with this malloc replaced by poolalloc?
> Should I include a special flag to achieve this?
Ah, sorry, my memory was wrong. The default is to perform the
"SelectivePA" optimization. Since pool allocation detected that there is
no point in putting a single allocation into a pool, it left it a malloc.
If you really want it to be a in a pool, pass
-poolalloc-heuristic=AllNodes to opt.
Sorry for the confusion!
> I am using this line:
> opt -load ~/llvm/install/lib/libpoolalloc.so -poolalloc
> and also with -pooloptimize
> Thanks in advance
> --- Chris Lattner <sabre at nondot.org> wrote:
>> On Sat, 2 Apr 2005, Ricardo wrote:
>>> I am trying to run a program optimized with the Pool Allocation, but I am receiving this
>>> *** 4 DYNAMIC POOLS INITIALIZED ***
>>> *** 4 DYNAMIC POOLS ALLOCATED FROM ***
>>> MaxHeapSize = 0.062500KB HeapSizeAtExit = 0.062500KB NOTE: only valid if using
>>> Heuristic=AllPools and no bumpptr/realloc!
>> This output is what happens when you link with the debug version of the
>> runtime library. If you rebuild the FL2Allocator with 'make
>> ENABLE_OPTIMIZED=1' and link with the result, you shouldn't get this.
>>> I have tried to link the program with the Analysis and with Datastructure libs:
>>> llvm-gcc -o test test.opt.bc -lpoolalloc -lpoolalloc_rt -lLLVMDataStructure -lLLVMAnalysis
>>> But I am still receiving the error.
>> You should only need -lpoolalloc_rt.
>> For the record, I usually do (effectively) this to test the pool
>> llvm-gcc *.c -o program # compile&link whole prog with LLVM
>> opt -load ... -poolalloc program.bc ... -o program.pa.bc
>> llc program.pa.bc -march=c -o program.pa.cbe.c
>> gcc -fno-strict-aliasing -O2 program.pa.cbe.c -o program.pa
>> -L~/llvm/projects/llvm-poolalloc/Release/lib/ -lpoolalloc_rt
>> Alternatively, if you want a quick test, you can do the first two steps,
>> lli -load ~/llvm/projects/llvm-poolalloc/Release/lib/libpoolalloc_rt.so program.pa.bc
>> If you're on a target that supports the JIT.
>>> Another question, I do not want to use the bump ptr optimization, and I suppose that the right
>>> heuristic for that is AllNodes? But if I want to use it, what is the right heuristic?
>> The AllNodes heuristic is the only one that is substantially tested. I
>> would recommend it, none of the others have any significant performance
>> benefit anyway.
>> The bump pointer and other opts are a seperate option -pooloptimize, which
>> can be run after -poolalloc. It does not work with -pointercompress
>>> Also, if I want to use the Pointer Compression, I suppose that I have to
>>> use the -pointercompress switch with opt or what?
>> Yes, if you use it, don't specify -poolalloc manually.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the llvm-dev