summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-05-03 15:50:37 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-05-03 15:50:37 +0000
commit64425fe875b4e995da650fdad0c4355cafdf1547 (patch)
treece704eef7e01f2c6cc432e1cae95b3900fe1993a /llvm/lib/Transforms/IPO
parent80df4bb10f70ad56ecbe936c4275e9dd7e04c353 (diff)
downloadbcm5719-llvm-64425fe875b4e995da650fdad0c4355cafdf1547.tar.gz
bcm5719-llvm-64425fe875b4e995da650fdad0c4355cafdf1547.zip
SLPVectorizer: Lazily allocate the map for block numbering.
There is no point in creating it if we're not going to vectorize anything. Creating the map is expensive as it creates large values. No functionality change. llvm-svn: 207916
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r--llvm/lib/Transforms/IPO/GlobalOpt.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
index ce49b7f4a9c..3db0abf89f5 100644
--- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -42,6 +42,7 @@
#include "llvm/Transforms/Utils/GlobalStatus.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
#include <algorithm>
+#include <deque>
using namespace llvm;
#define DEBUG_TYPE "globalopt"
@@ -2166,7 +2167,7 @@ class Evaluator {
public:
Evaluator(const DataLayout *DL, const TargetLibraryInfo *TLI)
: DL(DL), TLI(TLI) {
- ValueStack.push_back(make_unique<DenseMap<Value*, Constant*>>());
+ ValueStack.emplace_back();
}
~Evaluator() {
@@ -2191,13 +2192,13 @@ public:
Constant *getVal(Value *V) {
if (Constant *CV = dyn_cast<Constant>(V)) return CV;
- Constant *R = ValueStack.back()->lookup(V);
+ Constant *R = ValueStack.back().lookup(V);
assert(R && "Reference to an uncomputed value!");
return R;
}
void setVal(Value *V, Constant *C) {
- (*ValueStack.back())[V] = C;
+ ValueStack.back()[V] = C;
}
const DenseMap<Constant*, Constant*> &getMutatedMemory() const {
@@ -2212,9 +2213,9 @@ private:
Constant *ComputeLoadResult(Constant *P);
/// ValueStack - As we compute SSA register values, we store their contents
- /// here. The back of the vector contains the current function and the stack
+ /// here. The back of the deque contains the current function and the stack
/// contains the values in the calling frames.
- SmallVector<std::unique_ptr<DenseMap<Value*, Constant*>>, 4> ValueStack;
+ std::deque<DenseMap<Value*, Constant*>> ValueStack;
/// CallStack - This is used to detect recursion. In pathological situations
/// we could hit exponential behavior, but at least there is nothing
@@ -2526,7 +2527,7 @@ bool Evaluator::EvaluateBlock(BasicBlock::iterator CurInst,
Constant *RetVal = nullptr;
// Execute the call, if successful, use the return value.
- ValueStack.push_back(make_unique<DenseMap<Value *, Constant *>>());
+ ValueStack.emplace_back();
if (!EvaluateFunction(Callee, RetVal, Formals)) {
DEBUG(dbgs() << "Failed to evaluate function.\n");
return false;
OpenPOWER on IntegriCloud