From 7aa9ebb5465726ae722e23aa706dda439dfd1882 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sun, 21 Jul 2013 08:37:58 +0000 Subject: [PATCH] Make the mem2reg interface use an ArrayRef as it keeps a copy of these to iterate over. llvm-svn: 186788 --- llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h | 6 +++--- llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h b/llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h index fde4b81..22f46e5 100644 --- a/llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h +++ b/llvm/include/llvm/Transforms/Utils/PromoteMemToReg.h @@ -15,7 +15,7 @@ #ifndef LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H #define LLVM_TRANSFORMS_UTILS_PROMOTEMEMTOREG_H -#include +#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 &Allocas, - DominatorTree &DT, AliasSetTracker *AST = 0); +void PromoteMemToReg(ArrayRef Allocas, DominatorTree &DT, + AliasSetTracker *AST = 0); } // End llvm namespace diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index 5ee812b..b4ee4cb 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -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 BBNumPreds; public: - PromoteMem2Reg(const std::vector &Allocas, DominatorTree &DT, + PromoteMem2Reg(ArrayRef 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 &Allocas, - DominatorTree &DT, AliasSetTracker *AST) { +void llvm::PromoteMemToReg(ArrayRef Allocas, DominatorTree &DT, + AliasSetTracker *AST) { // If there is nothing to do, bail out... if (Allocas.empty()) return; -- 2.7.4