From 6696baf20308dda1fe98f2b519d6c1f769ebec60 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 20 Apr 2016 00:21:24 +0000 Subject: [PATCH] ScoreboardHazardRecognizer: unbreak TSAN by moving a static mutated variable to a member From: Mehdi Amini llvm-svn: 266837 --- .../llvm/CodeGen/ScoreboardHazardRecognizer.h | 6 ++---- lib/CodeGen/ScoreboardHazardRecognizer.cpp | 21 ++++++------------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/include/llvm/CodeGen/ScoreboardHazardRecognizer.h b/include/llvm/CodeGen/ScoreboardHazardRecognizer.h index ab14c2de32b..e0c30fe4d82 100644 --- a/include/llvm/CodeGen/ScoreboardHazardRecognizer.h +++ b/include/llvm/CodeGen/ScoreboardHazardRecognizer.h @@ -83,11 +83,9 @@ class ScoreboardHazardRecognizer : public ScheduleHazardRecognizer { void dump() const; }; -#ifndef NDEBUG // Support for tracing ScoreboardHazardRecognizer as a component within - // another module. Follows the current thread-unsafe model of tracing. - static const char *DebugType; -#endif + // another module. + const char *DebugType; // Itinerary data for the target. const InstrItineraryData *ItinData; diff --git a/lib/CodeGen/ScoreboardHazardRecognizer.cpp b/lib/CodeGen/ScoreboardHazardRecognizer.cpp index e765486c74b..69c48703301 100644 --- a/lib/CodeGen/ScoreboardHazardRecognizer.cpp +++ b/lib/CodeGen/ScoreboardHazardRecognizer.cpp @@ -23,22 +23,13 @@ using namespace llvm; -#define DEBUG_TYPE ::llvm::ScoreboardHazardRecognizer::DebugType +#define DEBUG_TYPE DebugType -#ifndef NDEBUG -const char *ScoreboardHazardRecognizer::DebugType = ""; -#endif - -ScoreboardHazardRecognizer:: -ScoreboardHazardRecognizer(const InstrItineraryData *II, - const ScheduleDAG *SchedDAG, - const char *ParentDebugType) : - ScheduleHazardRecognizer(), ItinData(II), DAG(SchedDAG), IssueWidth(0), - IssueCount(0) { - -#ifndef NDEBUG - DebugType = ParentDebugType; -#endif +ScoreboardHazardRecognizer::ScoreboardHazardRecognizer( + const InstrItineraryData *II, const ScheduleDAG *SchedDAG, + const char *ParentDebugType) + : ScheduleHazardRecognizer(), DebugType(ParentDebugType), ItinData(II), + DAG(SchedDAG), IssueWidth(0), IssueCount(0) { // Determine the maximum depth of any itinerary. This determines the depth of // the scoreboard. We always make the scoreboard at least 1 cycle deep to