forked from OSchip/llvm-project
Disable statistics on Release builds and move tests that depend on -stats.
Summary: Statistics are still available in Release+Asserts (any +Asserts builds), and stats can also be turned on with LLVM_ENABLE_STATS. Move some of the FastISel stats that were moved under DEBUG() back out of DEBUG(), since stats are disabled across the board now. Many tests depend on grepping "-stats" output. Move those into a orig_dir/Stats/. so that they can be marked as unsupported when building without statistics. Differential Revision: http://llvm-reviews.chandlerc.com/D486 llvm-svn: 176733
This commit is contained in:
parent
51c3318b01
commit
7857a64909
|
@ -51,7 +51,9 @@ public:
|
|||
|
||||
// Allow use of this class as the value itself.
|
||||
operator unsigned() const { return Value; }
|
||||
const Statistic &operator=(unsigned Val) {
|
||||
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||
const Statistic &operator=(unsigned Val) {
|
||||
Value = Val;
|
||||
return init();
|
||||
}
|
||||
|
@ -106,6 +108,46 @@ public:
|
|||
return init();
|
||||
}
|
||||
|
||||
#else // Statistics are disabled in release builds.
|
||||
|
||||
const Statistic &operator=(unsigned Val) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Statistic &operator++() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsigned operator++(int) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Statistic &operator--() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsigned operator--(int) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Statistic &operator+=(const unsigned &V) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Statistic &operator-=(const unsigned &V) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Statistic &operator*=(const unsigned &V) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
const Statistic &operator/=(const unsigned &V) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||
|
||||
protected:
|
||||
Statistic &init() {
|
||||
bool tmp = Initialized;
|
||||
|
|
|
@ -63,13 +63,11 @@
|
|||
#include "llvm/Target/TargetMachine.h"
|
||||
using namespace llvm;
|
||||
|
||||
#ifndef NDEBUG
|
||||
STATISTIC(NumFastIselSuccessIndependent, "Number of insts selected by "
|
||||
"target-independent selector");
|
||||
STATISTIC(NumFastIselSuccessTarget, "Number of insts selected by "
|
||||
"target-specific selector");
|
||||
STATISTIC(NumFastIselDead, "Number of dead insts removed on failure");
|
||||
#endif // NDEBUG
|
||||
|
||||
/// startNewBlock - Set the current block to which generated machine
|
||||
/// instructions will be appended, and clear the local CSE map.
|
||||
|
@ -334,7 +332,7 @@ void FastISel::removeDeadCode(MachineBasicBlock::iterator I,
|
|||
MachineInstr *Dead = &*I;
|
||||
++I;
|
||||
Dead->eraseFromParent();
|
||||
DEBUG(++NumFastIselDead);
|
||||
++NumFastIselDead;
|
||||
}
|
||||
recomputeInsertPt();
|
||||
}
|
||||
|
@ -830,7 +828,7 @@ FastISel::SelectInstruction(const Instruction *I) {
|
|||
|
||||
// First, try doing target-independent selection.
|
||||
if (SelectOperator(I, I->getOpcode())) {
|
||||
DEBUG(++NumFastIselSuccessIndependent);
|
||||
++NumFastIselSuccessIndependent;
|
||||
DL = DebugLoc();
|
||||
return true;
|
||||
}
|
||||
|
@ -845,7 +843,7 @@ FastISel::SelectInstruction(const Instruction *I) {
|
|||
// Next, try calling the target to attempt to handle the instruction.
|
||||
SavedInsertPt = FuncInfo.InsertPt;
|
||||
if (TargetSelectInstruction(I)) {
|
||||
DEBUG(++NumFastIselSuccessTarget);
|
||||
++NumFastIselSuccessTarget;
|
||||
DL = DebugLoc();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -58,14 +58,13 @@
|
|||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
STATISTIC(NumFastIselBlocks, "Number of blocks selected entirely by fast isel");
|
||||
STATISTIC(NumDAGBlocks, "Number of blocks selected using DAG");
|
||||
|
||||
#ifndef NDEBUG
|
||||
STATISTIC(NumDAGIselRetries,"Number of times dag isel has to try another path");
|
||||
STATISTIC(NumFastIselFailures, "Number of instructions fast isel failed on");
|
||||
STATISTIC(NumFastIselSuccess, "Number of instructions fast isel selected");
|
||||
STATISTIC(NumFastIselBlocks, "Number of blocks selected entirely by fast isel");
|
||||
STATISTIC(NumDAGBlocks, "Number of blocks selected using DAG");
|
||||
STATISTIC(NumDAGIselRetries,"Number of times dag isel has to try another path");
|
||||
|
||||
#ifndef NDEBUG
|
||||
static cl::opt<bool>
|
||||
EnableFastISelVerbose2("fast-isel-verbose2", cl::Hidden,
|
||||
cl::desc("Enable extra verbose messages in the \"fast\" "
|
||||
|
@ -1090,7 +1089,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||
// Try to select the instruction with FastISel.
|
||||
if (FastIS->SelectInstruction(Inst)) {
|
||||
--NumFastIselRemaining;
|
||||
DEBUG(++NumFastIselSuccess);
|
||||
++NumFastIselSuccess;
|
||||
// If fast isel succeeded, skip over all the folded instructions, and
|
||||
// then see if there is a load right before the selected instructions.
|
||||
// Try to fold the load if so.
|
||||
|
@ -1106,7 +1105,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||
// If we succeeded, don't re-select the load.
|
||||
BI = llvm::next(BasicBlock::const_iterator(BeforeInst));
|
||||
--NumFastIselRemaining;
|
||||
DEBUG(++NumFastIselSuccess);
|
||||
++NumFastIselSuccess;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -1145,21 +1144,20 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||
// Recompute NumFastIselRemaining as Selection DAG instruction
|
||||
// selection may have handled the call, input args, etc.
|
||||
unsigned RemainingNow = std::distance(Begin, BI);
|
||||
(void) RemainingNow;
|
||||
DEBUG(NumFastIselFailures += NumFastIselRemaining - RemainingNow);
|
||||
DEBUG(NumFastIselRemaining = RemainingNow);
|
||||
NumFastIselFailures += NumFastIselRemaining - RemainingNow;
|
||||
NumFastIselRemaining = RemainingNow;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isa<TerminatorInst>(Inst) && !isa<BranchInst>(Inst)) {
|
||||
// Don't abort, and use a different message for terminator misses.
|
||||
DEBUG(NumFastIselFailures += NumFastIselRemaining);
|
||||
NumFastIselFailures += NumFastIselRemaining;
|
||||
if (EnableFastISelVerbose || EnableFastISelAbort) {
|
||||
dbgs() << "FastISel missed terminator: ";
|
||||
Inst->dump();
|
||||
}
|
||||
} else {
|
||||
DEBUG(NumFastIselFailures += NumFastIselRemaining);
|
||||
NumFastIselFailures += NumFastIselRemaining;
|
||||
if (EnableFastISelVerbose || EnableFastISelAbort) {
|
||||
dbgs() << "FastISel miss: ";
|
||||
Inst->dump();
|
||||
|
@ -2357,7 +2355,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||
DEBUG(errs() << " Skipped scope entry (due to false predicate) at "
|
||||
<< "index " << MatcherIndexOfPredicate
|
||||
<< ", continuing at " << FailIndex << "\n");
|
||||
DEBUG(++NumDAGIselRetries);
|
||||
++NumDAGIselRetries;
|
||||
|
||||
// Otherwise, we know that this case of the Scope is guaranteed to fail,
|
||||
// move to the next case.
|
||||
|
@ -2938,7 +2936,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||
// another child to try in the current 'Scope', otherwise pop it until we
|
||||
// find a case to check.
|
||||
DEBUG(errs() << " Match failed at index " << CurrentOpcodeIndex << "\n");
|
||||
DEBUG(++NumDAGIselRetries);
|
||||
++NumDAGIselRetries;
|
||||
while (1) {
|
||||
if (MatchScopes.empty()) {
|
||||
CannotYetSelect(NodeToMatch);
|
||||
|
|
|
@ -40,7 +40,9 @@ namespace llvm { extern raw_ostream *CreateInfoOutputFile(); }
|
|||
/// what they did.
|
||||
///
|
||||
static cl::opt<bool>
|
||||
Enabled("stats", cl::desc("Enable statistics output from program"));
|
||||
Enabled(
|
||||
"stats",
|
||||
cl::desc("Enable statistics output from program (available with Asserts)"));
|
||||
|
||||
|
||||
namespace {
|
||||
|
@ -142,6 +144,7 @@ void llvm::PrintStatistics(raw_ostream &OS) {
|
|||
}
|
||||
|
||||
void llvm::PrintStatistics() {
|
||||
#if !defined(NDEBUG) || defined(LLVM_ENABLE_STATS)
|
||||
StatisticInfo &Stats = *StatInfo;
|
||||
|
||||
// Statistics not enabled?
|
||||
|
@ -151,4 +154,17 @@ void llvm::PrintStatistics() {
|
|||
raw_ostream &OutStream = *CreateInfoOutputFile();
|
||||
PrintStatistics(OutStream);
|
||||
delete &OutStream; // Close the file.
|
||||
#else
|
||||
// Check if the -stats option is set instead of checking
|
||||
// !Stats.Stats.empty(). In release builds, Statistics operators
|
||||
// do nothing, so stats are never Registered.
|
||||
if (Enabled) {
|
||||
// Get the stream to write to.
|
||||
raw_ostream &OutStream = *CreateInfoOutputFile();
|
||||
OutStream << "Statistics are disabled. "
|
||||
<< "Build with asserts or with -DLLVM_ENABLE_STATS\n";
|
||||
OutStream.flush();
|
||||
delete &OutStream; // Close the file.
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,8 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
targets = set(config.root.targets_to_build.split())
|
||||
if not 'ARM' in targets:
|
||||
config.unsupported = True
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,8 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
targets = set(config.root.targets_to_build.split())
|
||||
if not 'PowerPC' in targets:
|
||||
config.unsupported = True
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,8 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
targets = set(config.root.targets_to_build.split())
|
||||
if not 'X86' in targets:
|
||||
config.unsupported = True
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
|
@ -0,0 +1,4 @@
|
|||
config.suffixes = ['.ll', '.c', '.cpp']
|
||||
|
||||
if not config.root.enable_assertions:
|
||||
config.unsupported = True
|
Loading…
Reference in New Issue