changes to make it compatible with 64bit gcc
llvm-svn: 2792
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp
index 237c458..35189e3 100644
--- a/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -21,6 +21,7 @@
#include <algorithm>
#include <iostream>
using std::cerr;
+using std::vector;
static Statistic<> NumBlockRemoved("adce\t\t- Number of basic blocks removed");
static Statistic<> NumInstRemoved ("adce\t\t- Number of instructions removed");
diff --git a/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
index ab6059a..b180950 100644
--- a/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
+++ b/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
@@ -66,6 +66,7 @@
// uses the last ptr2 generated in the loop and a single index.
// If any index is (uint) 0, we omit the getElementPtr instruction.
//
+
void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) {
MemAccessInst &MAI = cast<MemAccessInst>(*BBI);
BasicBlock *BB = MAI.getParent();
@@ -74,10 +75,11 @@
// Remove the instruction from the stream
BB->getInstList().remove(BBI);
- vector<Instruction*> NewInsts;
+ std::vector<Instruction*> NewInsts;
// Process each index except the last one.
//
+
User::const_op_iterator OI = MAI.idx_begin(), OE = MAI.idx_end();
for (; OI+1 != OE; ++OI) {
assert(isa<PointerType>(LastPtr->getType()));
@@ -92,8 +94,10 @@
// and the next index is a structure offset (i.e., not an array offset),
// we need to include an initial [0] to index into the pointer.
//
- vector<Value*> Indices;
+
+ std::vector<Value*> Indices;
const PointerType *PtrTy = cast<PointerType>(LastPtr->getType());
+
if (isa<StructType>(PtrTy->getElementType())
&& !PtrTy->indexValid(*OI))
Indices.push_back(Constant::getNullValue(Type::UIntTy));
@@ -117,6 +121,7 @@
NewInsts.push_back(cast<Instruction>(LastPtr));
++NumAdded;
}
+
// Instruction 2: nextPtr2 = cast nextPtr1 to NextPtrTy
// This is not needed if the two types are identical.
@@ -134,7 +139,8 @@
const PointerType *PtrTy = cast<PointerType>(LastPtr->getType());
// First, get the final index vector. As above, we may need an initial [0].
- vector<Value*> Indices;
+
+ std::vector<Value*> Indices;
if (isa<StructType>(PtrTy->getElementType())
&& !PtrTy->indexValid(*OI))
Indices.push_back(Constant::getNullValue(Type::UIntTy));
@@ -156,6 +162,7 @@
assert(0 && "Unrecognized memory access instruction");
}
NewInsts.push_back(NewI);
+
// Replace all uses of the old instruction with the new
MAI.replaceAllUsesWith(NewI);
diff --git a/llvm/lib/Transforms/Scalar/GCSE.cpp b/llvm/lib/Transforms/Scalar/GCSE.cpp
index 850e65a..56bb191 100644
--- a/llvm/lib/Transforms/Scalar/GCSE.cpp
+++ b/llvm/lib/Transforms/Scalar/GCSE.cpp
@@ -23,6 +23,9 @@
#include "llvm/Support/CFG.h"
#include "Support/StatisticReporter.h"
#include <algorithm>
+using std::set;
+using std::map;
+
static Statistic<> NumInstRemoved("gcse\t\t- Number of instructions removed");
static Statistic<> NumLoadRemoved("gcse\t\t- Number of loads removed");
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index 7a32315..4913a89 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -16,6 +16,7 @@
#include "llvm/Support/CFG.h"
#include "Support/STLExtras.h"
#include "Support/StatisticReporter.h"
+#include <iostream>
static Statistic<> NumRemoved ("indvars\t\t- Number of aux indvars removed");
static Statistic<> NumInserted("indvars\t\t- Number of cannonical indvars added");
@@ -114,7 +115,7 @@
Changed = true;
}
- DEBUG(cerr << "Induction variables:\n");
+ DEBUG(std::cerr << "Induction variables:\n");
// Get the current loop iteration count, which is always the value of the
// cannonical phi node...
@@ -127,7 +128,7 @@
for (unsigned i = 0; i < IndVars.size(); ++i) {
InductionVariable *IV = &IndVars[i];
- DEBUG(cerr << IV);
+ DEBUG(std::cerr << IV);
// Don't modify the cannonical indvar or unrecognized indvars...
if (IV != Cannonical && IV->InductionType != InductionVariable::Unknown) {
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 98de447..99ee45e 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -25,6 +25,7 @@
#include "Support/STLExtras.h"
#include "Support/StatisticReporter.h"
#include <algorithm>
+using std::string;
static Statistic<> NumHoistedNPH("licm\t\t- Number of insts hoisted to multiple"
" loop preds (bad, no loop pre-header)");