[PATCH] Cleaning up static initializers in InterferenceCache by moving the NoInterference static object into the class.

Chandler Carruth chandlerc at gmail.com
Fri Oct 10 02:18:09 PDT 2014


================
Comment at: lib/CodeGen/InterferenceCache.h:174
@@ -173,3 +173,3 @@
     BlockInterference *Current;
-    static BlockInterference NoInterference;
+    BlockInterference NoInterference;
 
----------------
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.

http://reviews.llvm.org/D5609






More information about the llvm-commits mailing list