From a9783663398baf1289683fc7326430b89963f38e Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 16 Jun 2012 21:48:13 +0000 Subject: [PATCH] Guard private fields that are unused in Release builds with #ifndef NDEBUG. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158608 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/LexicalScopes.h | 7 ++++++- lib/CodeGen/MachineScheduler.cpp | 8 +++++++- lib/CodeGen/RegAllocBasic.cpp | 2 ++ lib/ExecutionEngine/JIT/JITEmitter.cpp | 7 ++++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/llvm/CodeGen/LexicalScopes.h b/include/llvm/CodeGen/LexicalScopes.h index eb01f66c312..8414c64544e 100644 --- a/include/llvm/CodeGen/LexicalScopes.h +++ b/include/llvm/CodeGen/LexicalScopes.h @@ -158,7 +158,10 @@ class LexicalScope { public: LexicalScope(LexicalScope *P, const MDNode *D, const MDNode *I, bool A) : Parent(P), Desc(D), InlinedAtLocation(I), AbstractScope(A), - LastInsn(0), FirstInsn(0), DFSIn(0), DFSOut(0), IndentLevel(0) { + LastInsn(0), FirstInsn(0), DFSIn(0), DFSOut(0) { +#ifndef NDEBUG + IndentLevel = 0; +#endif if (Parent) Parent->addChild(this); } @@ -241,7 +244,9 @@ private: const MachineInstr *FirstInsn; // First instruction of this scope. unsigned DFSIn, DFSOut; // In & Out Depth use to determine // scope nesting. +#ifndef NDEBUG mutable unsigned IndentLevel; // Private state for dump() +#endif }; } // end llvm namespace diff --git a/lib/CodeGen/MachineScheduler.cpp b/lib/CodeGen/MachineScheduler.cpp index 1783cbe21ee..3b8e826e5ac 100644 --- a/lib/CodeGen/MachineScheduler.cpp +++ b/lib/CodeGen/MachineScheduler.cpp @@ -351,15 +351,21 @@ class ScheduleDAGMI : public ScheduleDAGInstrs { IntervalPressure BotPressure; RegPressureTracker BotRPTracker; +#ifndef NDEBUG /// The number of instructions scheduled so far. Used to cut off the /// scheduler at the point determined by misched-cutoff. unsigned NumInstrsScheduled; +#endif public: ScheduleDAGMI(MachineSchedContext *C, MachineSchedStrategy *S): ScheduleDAGInstrs(*C->MF, *C->MLI, *C->MDT, /*IsPostRA=*/false, C->LIS), AA(C->AA), RegClassInfo(C->RegClassInfo), SchedImpl(S), RPTracker(RegPressure), CurrentTop(), TopRPTracker(TopPressure), - CurrentBottom(), BotRPTracker(BotPressure), NumInstrsScheduled(0) {} + CurrentBottom(), BotRPTracker(BotPressure) { +#ifndef NDEBUG + NumInstrsScheduled = 0; +#endif + } ~ScheduleDAGMI() { delete SchedImpl; diff --git a/lib/CodeGen/RegAllocBasic.cpp b/lib/CodeGen/RegAllocBasic.cpp index 1fa54cd7484..73059ec0ab3 100644 --- a/lib/CodeGen/RegAllocBasic.cpp +++ b/lib/CodeGen/RegAllocBasic.cpp @@ -64,8 +64,10 @@ class RABasic : public MachineFunctionPass, public RegAllocBase // context MachineFunction *MF; +#ifndef NDEBUG // analyses RenderMachineFunction *RMF; +#endif // state std::auto_ptr SpillerInstance; diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 504c8bdffd1..5427eec4dff 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -186,12 +186,17 @@ namespace { JITEmitter &JE; +#ifndef NDEBUG /// Instance of JIT corresponding to this Resolver. JIT *TheJIT; +#endif public: explicit JITResolver(JIT &jit, JITEmitter &je) - : state(&jit), nextGOTIndex(0), JE(je), TheJIT(&jit) { + : state(&jit), nextGOTIndex(0), JE(je) { +#ifndef NDEBUG + TheJIT = &jit; +#endif LazyResolverFn = jit.getJITInfo().getLazyResolverFunction(JITCompilerFn); }