mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Fix the stats collection for fast-isel. The failed count was only accounting
for a single miss and not all predecessor instructions that get selected by the selection DAG instruction selector. This is still not exact (e.g., over states misses when folded/dead instructions are present), but it is a step in the right direction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144832 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2929de422e
commit
f91488cc10
@ -892,13 +892,16 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
||||
FastIS->setLastLocalValue(0);
|
||||
}
|
||||
|
||||
unsigned NumFastIselRemaining = std::distance(Begin, End);
|
||||
// Do FastISel on as many instructions as possible.
|
||||
for (; BI != Begin; --BI) {
|
||||
const Instruction *Inst = llvm::prior(BI);
|
||||
|
||||
// If we no longer require this instruction, skip it.
|
||||
if (isFoldedOrDeadInstruction(Inst, FuncInfo))
|
||||
if (isFoldedOrDeadInstruction(Inst, FuncInfo)) {
|
||||
--NumFastIselRemaining;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Bottom-up: reset the insert pos at the top, after any local-value
|
||||
// instructions.
|
||||
@ -906,6 +909,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
||||
|
||||
// Try to select the instruction with FastISel.
|
||||
if (FastIS->SelectInstruction(Inst)) {
|
||||
--NumFastIselRemaining;
|
||||
++NumFastIselSuccess;
|
||||
// If fast isel succeeded, skip over all the folded instructions, and
|
||||
// then see if there is a load right before the selected instructions.
|
||||
@ -918,15 +922,18 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
||||
}
|
||||
if (BeforeInst != Inst && isa<LoadInst>(BeforeInst) &&
|
||||
BeforeInst->hasOneUse() &&
|
||||
TryToFoldFastISelLoad(cast<LoadInst>(BeforeInst), Inst, FastIS))
|
||||
TryToFoldFastISelLoad(cast<LoadInst>(BeforeInst), Inst, FastIS)) {
|
||||
// If we succeeded, don't re-select the load.
|
||||
BI = llvm::next(BasicBlock::const_iterator(BeforeInst));
|
||||
--NumFastIselRemaining;
|
||||
++NumFastIselSuccess;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Then handle certain instructions as single-LLVM-Instruction blocks.
|
||||
if (isa<CallInst>(Inst)) {
|
||||
++NumFastIselFailures;
|
||||
|
||||
if (EnableFastISelVerbose || EnableFastISelAbort) {
|
||||
dbgs() << "FastISel missed call: ";
|
||||
Inst->dump();
|
||||
@ -941,24 +948,30 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
|
||||
bool HadTailCall = false;
|
||||
SelectBasicBlock(Inst, BI, HadTailCall);
|
||||
|
||||
// Recompute NumFastIselRemaining as Selection DAG instruction
|
||||
// selection may have handled the call, input args, etc.
|
||||
unsigned RemainingNow = std::distance(Begin, BI);
|
||||
NumFastIselFailures += NumFastIselRemaining - RemainingNow;
|
||||
|
||||
// If the call was emitted as a tail call, we're done with the block.
|
||||
if (HadTailCall) {
|
||||
--BI;
|
||||
break;
|
||||
}
|
||||
|
||||
NumFastIselRemaining = RemainingNow;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isa<TerminatorInst>(Inst) && !isa<BranchInst>(Inst)) {
|
||||
// Don't abort, and use a different message for terminator misses.
|
||||
++NumFastIselFailures;
|
||||
NumFastIselFailures += NumFastIselRemaining;
|
||||
if (EnableFastISelVerbose || EnableFastISelAbort) {
|
||||
dbgs() << "FastISel missed terminator: ";
|
||||
Inst->dump();
|
||||
}
|
||||
} else {
|
||||
++NumFastIselFailures;
|
||||
NumFastIselFailures += NumFastIselRemaining;
|
||||
if (EnableFastISelVerbose || EnableFastISelAbort) {
|
||||
dbgs() << "FastISel miss: ";
|
||||
Inst->dump();
|
||||
|
Loading…
Reference in New Issue
Block a user