[llvm-commits] [llvm] r69788 - /llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
Owen Anderson
resistor at mac.com
Wed Apr 22 01:09:15 PDT 2009
Author: resistor
Date: Wed Apr 22 03:09:13 2009
New Revision: 69788
URL: http://llvm.org/viewvc/llvm-project?rev=69788&view=rev
Log:
Use PredIteratorCache in LCSSA, which gives a 37% overall speedup on the testcase from PR3549. More improvements to come.
Modified:
llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
Modified: llvm/trunk/lib/Transforms/Utils/LCSSA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LCSSA.cpp?rev=69788&r1=69787&r2=69788&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LCSSA.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LCSSA.cpp Wed Apr 22 03:09:13 2009
@@ -40,6 +40,7 @@
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/PredIteratorCache.h"
#include <algorithm>
#include <map>
using namespace llvm;
@@ -55,6 +56,7 @@
LoopInfo *LI;
DominatorTree *DT;
std::vector<BasicBlock*> LoopBlocks;
+ PredIteratorCache PredCache;
virtual bool runOnLoop(Loop *L, LPPassManager &LPM);
@@ -104,6 +106,7 @@
/// runOnFunction - Process all loops in the function, inner-most out.
bool LCSSA::runOnLoop(Loop *L, LPPassManager &LPM) {
+ PredCache.clear();
LI = &LPM.getAnalysis<LoopInfo>();
DT = &getAnalysis<DominatorTree>();
@@ -163,7 +166,7 @@
Phi = PN;
// Add inputs from inside the loop for this PHI.
- for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI)
+ for (BasicBlock** PI = PredCache.GetPreds(BB); *PI; ++PI)
PN->addIncoming(Instr, *PI);
}
}
@@ -264,7 +267,7 @@
Phis.insert(std::make_pair(BB, PN));
// Fill in the incoming values for the block.
- for (pred_iterator PI = pred_begin(BBN), E = pred_end(BBN); PI != E; ++PI)
+ for (BasicBlock** PI = PredCache.GetPreds(BBN); *PI; ++PI)
PN->addIncoming(GetValueForBlock(DT->getNode(*PI), OrigInst, Phis), *PI);
return PN;
}
More information about the llvm-commits
mailing list