Don't generate carry bit when loading immediate values on the Microblaze.
[oota-llvm.git] / lib / VMCore / Attributes.cpp
index d854628603bee0b6ed48059b8ef43c0a0aa2b5a9..92152a3b90ae3f08a8c286bdf86d6c15ca61acdb 100644 (file)
@@ -15,8 +15,8 @@
 #include "llvm/Type.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/FoldingSet.h"
-#include "llvm/System/Atomic.h"
-#include "llvm/System/Mutex.h"
+#include "llvm/Support/Atomic.h"
+#include "llvm/Support/Mutex.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/raw_ostream.h"
@@ -106,6 +106,11 @@ Attributes Attribute::typeIncompatible(const Type *Ty) {
 // AttributeListImpl Definition
 //===----------------------------------------------------------------------===//
 
+namespace llvm {
+  class AttributeListImpl;
+}
+
+static ManagedStatic<FoldingSet<AttributeListImpl> > AttributesLists;
 
 namespace llvm {
 static ManagedStatic<sys::SmartMutex<true> > ALMutex;
@@ -131,8 +136,10 @@ public:
   }
   void DropRef() {
     sys::SmartScopedLock<true> Lock(*ALMutex);
-    sys::cas_flag old = RefCount++;
-    if (old == 0)
+    if (!AttributesLists.isConstructed())
+      return;
+    sys::cas_flag new_val = --RefCount;
+    if (new_val == 0)
       delete this;
   }
   
@@ -147,8 +154,6 @@ public:
 };
 }
 
-static ManagedStatic<FoldingSet<AttributeListImpl> > AttributesLists;
-
 AttributeListImpl::~AttributeListImpl() {
   // NOTE: Lock must be acquired by caller.
   AttributesLists->RemoveNode(this);