1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

Make the mem2reg interface use an ArrayRef as it keeps a copy of these

to iterate over.

llvm-svn: 186788
This commit is contained in:
Chandler Carruth 2013-07-21 08:37:58 +00:00
parent 82f1ff48e7
commit a549ad0c21
2 changed files with 9 additions and 8 deletions

View File

@ -15,7 +15,7 @@
#ifndef LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
#define LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H
#include <vector>
#include "llvm/ADT/ArrayRef.h"
namespace llvm {
@ -40,8 +40,8 @@ bool isAllocaPromotable(const AllocaInst *AI);
///
/// If AST is specified, the specified tracker is updated to reflect changes
/// made to the IR.
void PromoteMemToReg(const std::vector<AllocaInst*> &Allocas,
DominatorTree &DT, AliasSetTracker *AST = 0);
void PromoteMemToReg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
AliasSetTracker *AST = 0);
} // End llvm namespace

View File

@ -27,6 +27,7 @@
#define DEBUG_TYPE "mem2reg"
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/STLExtras.h"
@ -279,10 +280,10 @@ struct PromoteMem2Reg {
DenseMap<const BasicBlock *, unsigned> BBNumPreds;
public:
PromoteMem2Reg(const std::vector<AllocaInst *> &Allocas, DominatorTree &DT,
PromoteMem2Reg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
AliasSetTracker *AST)
: Allocas(Allocas), DT(DT), DIB(*DT.getRoot()->getParent()->getParent()),
AST(AST) {}
: Allocas(Allocas.begin(), Allocas.end()), DT(DT),
DIB(*DT.getRoot()->getParent()->getParent()), AST(AST) {}
void run();
@ -1089,8 +1090,8 @@ NextIteration:
goto NextIteration;
}
void llvm::PromoteMemToReg(const std::vector<AllocaInst *> &Allocas,
DominatorTree &DT, AliasSetTracker *AST) {
void llvm::PromoteMemToReg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
AliasSetTracker *AST) {
// If there is nothing to do, bail out...
if (Allocas.empty())
return;