[PATCH] Compile time reduction for small programs.

Puyan Lotfi plotfi at apple.com
Wed Feb 5 13:24:33 PST 2014


On Feb 5, 2014, at 12:48 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:

> 
> On Feb 5, 2014, at 12:34 PM, Puyan Lotfi <plotfi at apple.com> wrote:
> 
>> 
>> On Feb 5, 2014, at 9:46 AM, Eric Christopher <echristo at gmail.com> wrote:
>> 
>>> On Wed, Feb 5, 2014 at 9:39 AM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
>>>> 
>>>> Looking at the top of InterferenceCache::get(), the PhysRegEntries array is used in the same way as the sparse array in llvm::SparseSet, see also Preston's paper: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.30.7319
>>>> 
>>>> The double-checking "E < CacheEntries && Entries[E].getPhysReg() == PhysReg" means that the initial values of the array don't matter, and so the only reason for clearing it is to shut up tools like valgrind. That's why it can simply be allocated with calloc() and not cleared in reinitPhysRegEntries().
>>>> 
>>>> Clearly, this needs to be explained in a comment if we're going to bypass the zeroing.
>>>> 
>>> 
>>> Aha. That makes total sense. And please :)
>>> 
>>> -eric
>>> 
>> 
>> Zeroing explanation added:
>> 
>> <CompileTimeReductionSmall2.patch>
>> 
>> Eric, Jakob: does this patch now look good to you?
> 
> Hi Puyan,
> 
> It looks like you have 3 unrelated patches in one. Please split it up. I’ll just comment on the InterferenceCache changes below:
> 
>  InterferenceCache::Entry *InterferenceCache::get(unsigned PhysReg) {
> +  // Call reinitPhysRegEntries here because PhysRegEntries may need to be
> +  // resized in case a pass manager is reused for multiple targets.
> +  reinitPhysRegEntries();
>    unsigned E = PhysRegEntries[PhysReg];
> 
> That doesn’t sound right at all. Isn’t InterferenceCache::init() called per function?
> 
> Thanks,
> /jakob
> 



Hi Jakob,

I was trying to reinitialized the PhysRegEntries prior to its use in InterferenceCache::get, like we had discussed.
I also call it in InterferenceCache::init since that’s where the assign(N, 0) was.
But I think there’s probably no need to call reinitPhysRegEntries in InterferenceCache::get.

Do you think all this needs is to remove the call in InterferenceCache::get?

These are the 3 separated patches:



-Puyan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140205/e6b11ad5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CompileTimeReductionSmall_InterferenceCache.patch
Type: application/octet-stream
Size: 2810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140205/e6b11ad5/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140205/e6b11ad5/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CompileTimeReductionSmall_LiveRegMatrix.patch
Type: application/octet-stream
Size: 611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140205/e6b11ad5/attachment-0001.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140205/e6b11ad5/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CompileTimeReductionSmall_VirtRegMap.patch
Type: application/octet-stream
Size: 3139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140205/e6b11ad5/attachment-0002.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140205/e6b11ad5/attachment-0003.html>


More information about the llvm-commits mailing list