[llvm] r218182 - Using a deque to manage the stack of nodes is faster here.
Lenny Maiorani
lenny at colorado.edu
Sat Sep 20 06:29:21 PDT 2014
Author: lenny
Date: Sat Sep 20 08:29:20 2014
New Revision: 218182
URL: http://llvm.org/viewvc/llvm-project?rev=218182&view=rev
Log:
Using a deque to manage the stack of nodes is faster here.
Vector is slow due to many reallocations as the size regularly changes in
unpredictable ways. See the investigation provided on the mailing list for
more information:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120116/135228.html
Modified:
llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp?rev=218182&r1=218181&r2=218182&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/EarlyCSE.cpp Sat Sep 20 08:29:20 2014
@@ -26,7 +26,7 @@
#include "llvm/Support/RecyclingAllocator.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Transforms/Utils/Local.h"
-#include <vector>
+#include <deque>
using namespace llvm;
#define DEBUG_TYPE "early-cse"
@@ -560,7 +560,11 @@ bool EarlyCSE::runOnFunction(Function &F
if (skipOptnoneFunction(F))
return false;
- std::vector<StackNode *> nodesToProcess;
+ // Note, deque is being used here because there is significant performance gains
+ // over vector when the container becomes very large due to the specific access
+ // patterns. For more information see the mailing list discussion on this:
+ // http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120116/135228.html
+ std::deque<StackNode *> nodesToProcess;
DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>();
DL = DLP ? &DLP->getDataLayout() : nullptr;
More information about the llvm-commits
mailing list