diff --git a/include/llvm/ADT/Statistic.h b/include/llvm/ADT/Statistic.h index 484ff5fbebc..1a4833cc4a0 100644 --- a/include/llvm/ADT/Statistic.h +++ b/include/llvm/ADT/Statistic.h @@ -34,10 +34,10 @@ class Statistic { public: const char *Name; const char *Desc; - unsigned Value; + volatile llvm::sys::cas_flag Value; bool Initialized; - unsigned getValue() const { return Value; } + llvm::sys::cas_flag getValue() const { return Value; } const char *getName() const { return Name; } const char *getDesc() const { return Desc; } diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index 4ace049afa5..3fb65265472 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -211,7 +211,7 @@ namespace { // for each location equivalent Node. struct Node { private: - static unsigned Counter; + static volatile sys::cas_flag Counter; public: Value *Val; @@ -618,7 +618,7 @@ X("anders-aa", "Andersen's Interprocedural Alias Analysis", false, true); static RegisterAnalysisGroup Y(X); // Initialize Timestamp Counter (static). -unsigned Andersens::Node::Counter = 0; +volatile llvm::sys::cas_flag Andersens::Node::Counter = 0; ModulePass *llvm::createAndersensPass() { return new Andersens(); } diff --git a/lib/Support/Annotation.cpp b/lib/Support/Annotation.cpp index b7780433c06..4b5b97e41f3 100644 --- a/lib/Support/Annotation.cpp +++ b/lib/Support/Annotation.cpp @@ -39,7 +39,7 @@ namespace { } typedef std::map IDMapType; -static unsigned IDCounter = 0; // Unique ID counter +static volatile sys::cas_flag IDCounter = 0; // Unique ID counter // Static member to ensure initialiation on demand. static ManagedStatic IDMap;