diff options
author | Duncan Sands <baldrick@free.fr> | 2010-12-22 09:40:51 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-12-22 09:40:51 +0000 |
commit | a3c44a5280042dbc0cde995675c225ede4528c6e (patch) | |
tree | 2b981c33b1b2cdff312c59ac789e3618f61ee7ac /lib/Transforms/InstCombine/InstructionCombining.cpp | |
parent | 711042839cab1948366dfc69d1b866cc1a103444 (diff) |
Add some statistics, good for understanding how much more powerful
instcombine is compared to instsimplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122397 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstructionCombining.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index c679ef4efa..84d85b73c6 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -58,6 +58,8 @@ STATISTIC(NumCombined , "Number of insts combined"); STATISTIC(NumConstProp, "Number of constant folds"); STATISTIC(NumDeadInst , "Number of dead inst eliminated"); STATISTIC(NumSunkInst , "Number of instructions sunk"); +STATISTIC(NumFactor , "Number of factorizations"); +STATISTIC(NumReassoc , "Number of reassociations"); // Initialization Routines void llvm::initializeInstCombine(PassRegistry &Registry) { @@ -155,6 +157,7 @@ bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) { I.setOperand(0, A); I.setOperand(1, V); Changed = true; + ++NumReassoc; continue; } } @@ -171,6 +174,7 @@ bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) { I.setOperand(0, V); I.setOperand(1, C); Changed = true; + ++NumReassoc; continue; } } @@ -189,6 +193,7 @@ bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) { I.setOperand(0, V); I.setOperand(1, B); Changed = true; + ++NumReassoc; continue; } } @@ -205,6 +210,7 @@ bool InstCombiner::SimplifyAssociativeOrCommutative(BinaryOperator &I) { I.setOperand(0, B); I.setOperand(1, V); Changed = true; + ++NumReassoc; continue; } } @@ -321,8 +327,10 @@ Instruction *InstCombiner::SimplifyByFactorizing(BinaryOperator &I) { // operations "A op' B" and "C op' D" will be zapped since no longer used. if (!RHS && Op0->hasOneUse() && Op1->hasOneUse()) RHS = Builder->CreateBinOp(OuterOpcode, B, D, Op1->getName()); - if (RHS) + if (RHS) { + ++NumFactor; return BinaryOperator::Create(InnerOpcode, A, RHS); + } } // Does "(X op Y) op' Z" always equal "(X op' Z) op (Y op' Z)"? @@ -339,8 +347,10 @@ Instruction *InstCombiner::SimplifyByFactorizing(BinaryOperator &I) { // operations "A op' B" and "C op' D" will be zapped since no longer used. if (!LHS && Op0->hasOneUse() && Op1->hasOneUse()) LHS = Builder->CreateBinOp(OuterOpcode, A, C, Op0->getName()); - if (LHS) + if (LHS) { + ++NumFactor; return BinaryOperator::Create(InnerOpcode, LHS, B); + } } return 0; |