summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2012-06-22 07:35:13 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2012-06-22 07:35:13 +0000
commitfcfa633bf8ed18c113225d82250bcfd82310c137 (patch)
treedcc655bfde1116bf838d08bd52b9d2218cbf2ac2 /llvm/lib/VMCore/Instructions.cpp
parentc6bff718c245df0524fede9ddacdd708aef8328d (diff)
downloadbcm5719-llvm-fcfa633bf8ed18c113225d82250bcfd82310c137.tar.gz
bcm5719-llvm-fcfa633bf8ed18c113225d82250bcfd82310c137.zip
Performance optimizations:
- SwitchInst: case values stored separately from Operands List. It allows to make faster access to individual case value numbers or ranges. - Optimized IntItem, added APInt value caching. - Optimized IntegersSubsetGeneric: added optimizations for cases when subset is single number or when subset consists from single numbers only. On my machine these optimizations gave about 4-6% of compile-time improvement. llvm-svn: 158979
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r--llvm/lib/VMCore/Instructions.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp
index 26cc6322da7..30fa9fed10e 100644
--- a/llvm/lib/VMCore/Instructions.cpp
+++ b/llvm/lib/VMCore/Instructions.cpp
@@ -3158,6 +3158,7 @@ SwitchInst::SwitchInst(const SwitchInst &SI)
OL[i] = InOL[i];
OL[i+1] = InOL[i+1];
}
+ TheSubsets = SI.TheSubsets;
SubclassOptionalData = SI.SubclassOptionalData;
}
@@ -3186,8 +3187,11 @@ void SwitchInst::addCase(IntegersSubset& OnVal, BasicBlock *Dest) {
// Initialize some new operands.
assert(OpNo+1 < ReservedSpace && "Growing didn't work!");
NumOperands = OpNo+2;
- CaseIt Case(this, NewCaseIdx);
- Case.setValueEx(OnVal);
+
+ SubsetsIt TheSubsetsIt = TheSubsets.insert(TheSubsets.end(), OnVal);
+
+ CaseIt Case(this, NewCaseIdx, TheSubsetsIt);
+ Case.updateCaseValueOperand(OnVal);
Case.setSuccessor(Dest);
}
@@ -3210,6 +3214,11 @@ void SwitchInst::removeCase(CaseIt i) {
// Nuke the last value.
OL[NumOps-2].set(0);
OL[NumOps-2+1].set(0);
+
+ // Do the same with TheCases collection:
+ *i.SubsetIt = TheSubsets.back();
+ TheSubsets.pop_back();
+
NumOperands = NumOps-2;
}
OpenPOWER on IntegriCloud