Skip to content

Commit a1c6635

Browse files
author
Cameron Zwarich
committed
Add some stats to CodeGenPrepare to make it easier to speed it up without
regressing code quality. llvm-svn: 122887
1 parent 89cd5f0 commit a1c6635

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,15 @@
4444
using namespace llvm;
4545
using namespace llvm::PatternMatch;
4646

47-
STATISTIC(NumElim, "Number of blocks eliminated");
47+
STATISTIC(NumBlocksElim, "Number of blocks eliminated");
48+
STATISTIC(NumCmpUses, "Number of uses of Cmp expressions replaced with uses of "
49+
"sunken Cmps");
50+
STATISTIC(NumCastUses, "Number of uses of Cast expressions replaced with uses "
51+
"of sunken Casts");
52+
STATISTIC(NumMemoryInsts, "Number of memory instructions whose address "
53+
"computations were sunk");
54+
STATISTIC(NumExtsMoved, "Number of [s|z]ext instructions combined with loads");
55+
STATISTIC(NumExtUses, "Number of uses of [s|z]ext instructions optimized");
4856

4957
static cl::opt<bool>
5058
CriticalEdgeSplit("cgp-critical-edge-splitting",
@@ -310,7 +318,7 @@ void CodeGenPrepare::EliminateMostlyEmptyBlock(BasicBlock *BB) {
310318
PFI->removeEdge(ProfileInfo::getEdge(BB, DestBB));
311319
}
312320
BB->eraseFromParent();
313-
++NumElim;
321+
++NumBlocksElim;
314322

315323
DEBUG(dbgs() << "AFTER:\n" << *DestBB << "\n\n\n");
316324
}
@@ -489,6 +497,7 @@ static bool OptimizeNoopCopyExpression(CastInst *CI, const TargetLowering &TLI){
489497

490498
// Replace a use of the cast with a use of the new cast.
491499
TheUse = InsertedCast;
500+
++NumCastUses;
492501
}
493502

494503
// If we removed all uses, nuke the cast.
@@ -546,6 +555,7 @@ static bool OptimizeCmpExpression(CmpInst *CI) {
546555

547556
// Replace a use of the cmp with a use of the new cmp.
548557
TheUse = InsertedCmp;
558+
++NumCmpUses;
549559
}
550560

551561
// If we removed all uses, nuke the cmp.
@@ -793,6 +803,7 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
793803
// we don't want to match some completely different instruction.
794804
SunkAddrs[Addr] = 0;
795805
}
806+
++NumMemoryInsts;
796807
return true;
797808
}
798809

@@ -858,6 +869,7 @@ bool CodeGenPrepare::MoveExtToFormExtLoad(Instruction *I) {
858869
// can fold it.
859870
I->removeFromParent();
860871
I->insertAfter(LI);
872+
++NumExtsMoved;
861873
return true;
862874
}
863875

@@ -929,7 +941,7 @@ bool CodeGenPrepare::OptimizeExtUses(Instruction *I) {
929941

930942
// Replace a use of the {s|z}ext source with a use of the result.
931943
TheUse = InsertedTrunc;
932-
944+
++NumExtUses;
933945
MadeChange = true;
934946
}
935947

0 commit comments

Comments
 (0)