summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-12-22 09:40:51 +0000
committerDuncan Sands <baldrick@free.fr>2010-12-22 09:40:51 +0000
commit3547d2ebd8afccb5560ceabb9d831af4558682ee (patch)
tree36e6e752b5fd38744bfb2861b3958a9b1f67d589 /llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
parent6f8a8f92b8f4e982786670ab3e91e44c64af21ba (diff)
downloadbcm5719-llvm-3547d2ebd8afccb5560ceabb9d831af4558682ee.tar.gz
bcm5719-llvm-3547d2ebd8afccb5560ceabb9d831af4558682ee.zip
Add some statistics, good for understanding how much more powerful
instcombine is compared to instsimplify. llvm-svn: 122397
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index c679ef4efa3..84d85b73c63 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud