This is an archive of the discontinued LLVM Phabricator instance.

Cleaning up static initializers in InterferenceCache by moving the NoInterference static object into the class.
AbandonedPublic

Authored by beanz on Oct 3 2014, 2:25 PM.

Details

Reviewers
None
Summary

This is a pretty straight forward transformation to change a static member into an instance member.

Diff Detail

Event Timeline

beanz updated this revision to Diff 14407.Oct 3 2014, 2:25 PM
beanz retitled this revision from to Cleaning up static initializers in InterferenceCache by moving the NoInterference static object into the class..
beanz updated this object.
beanz edited the test plan for this revision. (Show Details)
beanz added a subscriber: Unknown Object (MLST).
chandlerc added inline comments.
lib/CodeGen/InterferenceCache.h
174

I don't think you should make the Cursor object larger here. One of three options should be employed:

  1. If possible, just construct a null temporary BlockInterference object where one is needed, or provide a factor function to do so.
  2. Alternatively (perhaps if that fails because it needs to have identity), make this a static *constant* (ie, constant initialized, should be possible from glancing at it). You could even make it a constexpr when we have support for that.
  3. If nothing else works, store it in the Entry, and reach it via the CacheEntry pointer.
beanz added inline comments.Oct 10 2014, 3:05 PM
lib/CodeGen/InterferenceCache.h
174

Unfortunately I don't think any of these options work without significant reworking of the code.

  1. We can't construct a null temporary because the way this code works is based on having a pointer to the BlockInterference object.
  2. BlockInterference objects can't be statically initialized because they have user defined constructors and contain SlotIndex members. I don't think we can statically initialize those without constexpr.
  3. Unfortunately it can't be in the CacheEntry either because the only time this is used is when CacheEntry is null.

Thoughts?

chandlerc added inline comments.Oct 10 2014, 3:18 PM
lib/CodeGen/InterferenceCache.h
174

Mostly frustration. ;] This code isn't making this easy.

The code clearly isn't *using* the SlotIndex members for the "no" case so I think this is just a badly designed set of data structures. I think you'll have to do the substantial changes here.

I would try to remove the use of a pointer to a special BlockInterference object as the sigil for "no interference". Instead I would try to use a null pointer or a separate flag (potentially embedded into the pointer via PointerUnion).

Sorry, this one just looks like one of the hard ones.

beanz added a comment.Oct 10 2014, 3:24 PM

That is a totally reasonable answer. I'll start working on the larger patches.

Thanks,
-Chris

beanz abandoned this revision.Jan 23 2015, 3:49 PM