[LLVMdev] NumLoads/NumStores for linearscan?

Silvio Ricardo Cordeiro silvioricardoc at gmail.com
Tue Aug 24 16:04:58 PDT 2010


On Sun, Aug 15, 2010 at 10:04 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk>wrote:

>
> On Aug 15, 2010, at 5:12 PM, Silvio Ricardo Cordeiro wrote:
>
> > Is there a way for me to collect statistics about the number of
> loads/stores added by the "linearscan" register allocator (just like can be
> done with the "local" allocator)?  I still haven't grokked very well the
> interaction between RALinScan and Spiller... Should I add those two
> statistics to the spiller's class?
>
> RALinearScan asks the Spiller to spill a virtual register. The
> StandardSpiller passes the request to LiveIntervals::addIntervalsForSpills.
> Here, the spill and restore points are added to the VirtRegMap. No spill
> code has been inserted yet. After register allocation completes,
> VirtRegRewriter inserts the store and load instructions specified in
> VirtRegMap.
>
> The counters you are looking for are in VirtRegRewriter.cpp.
>

I compiled "sort.c" from coreutils8.5 using both *local* and
*linearscan* allocators
(I'm using LLVM 2.7). For *local*, I get a Load/Store count of 314/367. But
when I use *linearscan*, the counters at VirtRegRewriter.cpp end up being
0/0. I've also tried to compile a couple other source files, and
VirtRegRewriter.cpp
always has NumLoads=0 and NumStores=0 in the end.

I can't believe linearscan is *that *good! I've tried to add other variables
to the source code, but it seems to be spiling them without updating
NumLoads/NumStores...

Is there a source file that's commonly used to test this kind of thing?


We are working on simplifying this for obvious reasons. If you specify
> -spiller=inline, the InlineSpiller will insert loads and stores immediately.
> There are currently no statistics counters in InlineSpiller.cpp. Feel free
> to add some.
>

Hmmm yeah, but that's not available for LLVM 2.7, so no luck (although I may
try to "adapt" it for 2.7 if I need to).



>  /jakob
>
>
-- 
Silvio Ricardo Cordeiro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100824/2f060657/attachment.html>


More information about the llvm-dev mailing list