summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-01-31 06:57:53 +0000
committerBill Wendling <isanbard@gmail.com>2012-01-31 06:57:53 +0000
commit8a33312948c9bfd95332a61943d23c0e5c9ef747 (patch)
tree616ce2853b537a42f10d0dbad1a767eac95de990 /llvm/lib/Transforms
parentb85e40f7381f7d65a9b8fa88744df9d7d7cbf19c (diff)
downloadbcm5719-llvm-8a33312948c9bfd95332a61943d23c0e5c9ef747.tar.gz
bcm5719-llvm-8a33312948c9bfd95332a61943d23c0e5c9ef747.zip
Cache the size of the vector instead of calling .size() all over the place.
llvm-svn: 149368
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index e2617ed3d28..6e928b798a3 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1278,14 +1278,14 @@ bool GVN::processNonLocalLoad(LoadInst *LI) {
// If we had to process more than one hundred blocks to find the
// dependencies, this load isn't worth worrying about. Optimizing
// it will be too expensive.
- if (Deps.size() > 100)
+ unsigned NumDeps = Deps.size();
+ if (NumDeps > 100)
return false;
// If we had a phi translation failure, we'll have a single entry which is a
// clobber in the current block. Reject this early.
- if (Deps.size() == 1
- && !Deps[0].getResult().isDef() && !Deps[0].getResult().isClobber())
- {
+ if (NumDeps == 1 &&
+ !Deps[0].getResult().isDef() && !Deps[0].getResult().isClobber()) {
DEBUG(
dbgs() << "GVN: non-local load ";
WriteAsOperand(dbgs(), LI);
@@ -1301,7 +1301,7 @@ bool GVN::processNonLocalLoad(LoadInst *LI) {
SmallVector<AvailableValueInBlock, 16> ValuesPerBlock;
SmallVector<BasicBlock*, 16> UnavailableBlocks;
- for (unsigned i = 0, e = Deps.size(); i != e; ++i) {
+ for (unsigned i = 0, e = NumDeps; i != e; ++i) {
BasicBlock *DepBB = Deps[i].getBB();
MemDepResult DepInfo = Deps[i].getResult();
OpenPOWER on IntegriCloud