mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
The FastISEL should be fast. But when we record statistics we use atomic operations to increment the counters.
This patch disables the counters on non-debug builds. This reduces the runtime of SelectionDAGISel::SelectCodeCommon by ~5%. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176214 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cd275c57af
commit
07cd932c93
@ -1076,7 +1076,8 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||||||
FastIS->setLastLocalValue(0);
|
FastIS->setLastLocalValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned NumFastIselRemaining = std::distance(Begin, End);
|
unsigned NumFastIselRemaining = 0;
|
||||||
|
NumFastIselRemaining = std::distance(Begin, End);
|
||||||
// Do FastISel on as many instructions as possible.
|
// Do FastISel on as many instructions as possible.
|
||||||
for (; BI != Begin; --BI) {
|
for (; BI != Begin; --BI) {
|
||||||
const Instruction *Inst = llvm::prior(BI);
|
const Instruction *Inst = llvm::prior(BI);
|
||||||
@ -1094,7 +1095,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||||||
// Try to select the instruction with FastISel.
|
// Try to select the instruction with FastISel.
|
||||||
if (FastIS->SelectInstruction(Inst)) {
|
if (FastIS->SelectInstruction(Inst)) {
|
||||||
--NumFastIselRemaining;
|
--NumFastIselRemaining;
|
||||||
++NumFastIselSuccess;
|
DEBUG(++NumFastIselSuccess);
|
||||||
// If fast isel succeeded, skip over all the folded instructions, and
|
// If fast isel succeeded, skip over all the folded instructions, and
|
||||||
// then see if there is a load right before the selected instructions.
|
// then see if there is a load right before the selected instructions.
|
||||||
// Try to fold the load if so.
|
// Try to fold the load if so.
|
||||||
@ -1110,7 +1111,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||||||
// If we succeeded, don't re-select the load.
|
// If we succeeded, don't re-select the load.
|
||||||
BI = llvm::next(BasicBlock::const_iterator(BeforeInst));
|
BI = llvm::next(BasicBlock::const_iterator(BeforeInst));
|
||||||
--NumFastIselRemaining;
|
--NumFastIselRemaining;
|
||||||
++NumFastIselSuccess;
|
DEBUG(++NumFastIselSuccess);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1149,20 +1150,20 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
|||||||
// Recompute NumFastIselRemaining as Selection DAG instruction
|
// Recompute NumFastIselRemaining as Selection DAG instruction
|
||||||
// selection may have handled the call, input args, etc.
|
// selection may have handled the call, input args, etc.
|
||||||
unsigned RemainingNow = std::distance(Begin, BI);
|
unsigned RemainingNow = std::distance(Begin, BI);
|
||||||
NumFastIselFailures += NumFastIselRemaining - RemainingNow;
|
DEBUG(NumFastIselFailures += NumFastIselRemaining - RemainingNow);
|
||||||
NumFastIselRemaining = RemainingNow;
|
DEBUG(NumFastIselRemaining = RemainingNow);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isa<TerminatorInst>(Inst) && !isa<BranchInst>(Inst)) {
|
if (isa<TerminatorInst>(Inst) && !isa<BranchInst>(Inst)) {
|
||||||
// Don't abort, and use a different message for terminator misses.
|
// Don't abort, and use a different message for terminator misses.
|
||||||
NumFastIselFailures += NumFastIselRemaining;
|
DEBUG(NumFastIselFailures += NumFastIselRemaining);
|
||||||
if (EnableFastISelVerbose || EnableFastISelAbort) {
|
if (EnableFastISelVerbose || EnableFastISelAbort) {
|
||||||
dbgs() << "FastISel missed terminator: ";
|
dbgs() << "FastISel missed terminator: ";
|
||||||
Inst->dump();
|
Inst->dump();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NumFastIselFailures += NumFastIselRemaining;
|
DEBUG(NumFastIselFailures += NumFastIselRemaining);
|
||||||
if (EnableFastISelVerbose || EnableFastISelAbort) {
|
if (EnableFastISelVerbose || EnableFastISelAbort) {
|
||||||
dbgs() << "FastISel miss: ";
|
dbgs() << "FastISel miss: ";
|
||||||
Inst->dump();
|
Inst->dump();
|
||||||
@ -2362,7 +2363,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
DEBUG(errs() << " Skipped scope entry (due to false predicate) at "
|
DEBUG(errs() << " Skipped scope entry (due to false predicate) at "
|
||||||
<< "index " << MatcherIndexOfPredicate
|
<< "index " << MatcherIndexOfPredicate
|
||||||
<< ", continuing at " << FailIndex << "\n");
|
<< ", continuing at " << FailIndex << "\n");
|
||||||
++NumDAGIselRetries;
|
DEBUG(++NumDAGIselRetries);
|
||||||
|
|
||||||
// Otherwise, we know that this case of the Scope is guaranteed to fail,
|
// Otherwise, we know that this case of the Scope is guaranteed to fail,
|
||||||
// move to the next case.
|
// move to the next case.
|
||||||
@ -2943,7 +2944,7 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsigned char *MatcherTable,
|
|||||||
// another child to try in the current 'Scope', otherwise pop it until we
|
// another child to try in the current 'Scope', otherwise pop it until we
|
||||||
// find a case to check.
|
// find a case to check.
|
||||||
DEBUG(errs() << " Match failed at index " << CurrentOpcodeIndex << "\n");
|
DEBUG(errs() << " Match failed at index " << CurrentOpcodeIndex << "\n");
|
||||||
++NumDAGIselRetries;
|
DEBUG(++NumDAGIselRetries);
|
||||||
while (1) {
|
while (1) {
|
||||||
if (MatchScopes.empty()) {
|
if (MatchScopes.empty()) {
|
||||||
CannotYetSelect(NodeToMatch);
|
CannotYetSelect(NodeToMatch);
|
||||||
|
Loading…
Reference in New Issue
Block a user