From 3106b8b18b6fbeb77ac3f76b7179e2569bbffef9 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Fri, 17 Feb 2012 02:12:54 +0000 Subject: [PATCH] Remove redundant comment. Use a more efficient datatype. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150780 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/DemoteRegToStack.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/Transforms/Utils/DemoteRegToStack.cpp b/lib/Transforms/Utils/DemoteRegToStack.cpp index c2483ab43c9..99b58301634 100644 --- a/lib/Transforms/Utils/DemoteRegToStack.cpp +++ b/lib/Transforms/Utils/DemoteRegToStack.cpp @@ -6,21 +6,12 @@ // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// -// -// This file provide the function DemoteRegToStack(). This function takes a -// virtual register computed by an Instruction and replaces it with a slot in -// the stack frame, allocated via alloca. It returns the pointer to the -// AllocaInst inserted. After this function is called on an instruction, we are -// guaranteed that the only user of the instruction is a store that is -// immediately after it. -// -//===----------------------------------------------------------------------===// #include "llvm/Transforms/Utils/Local.h" #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Type.h" -#include +#include "llvm/ADT/DenseMap.h" using namespace llvm; /// DemoteRegToStack - This function takes a virtual register computed by an @@ -28,7 +19,7 @@ using namespace llvm; /// alloca. This allows the CFG to be changed around without fear of /// invalidating the SSA information for the value. It returns the pointer to /// the alloca inserted to create a stack slot for I. -AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads, +AllocaInst *llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads, Instruction *AllocaPoint) { if (I.use_empty()) { I.eraseFromParent(); @@ -59,7 +50,7 @@ AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads, // resulting PHI node will have multiple values (from each load) coming in // from the same block, which is illegal SSA form. For this reason, we // keep track of and reuse loads we insert. - std::map Loads; + DenseMap Loads; for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) if (PN->getIncomingValue(i) == &I) { Value *&V = Loads[PN->getIncomingBlock(i)]; @@ -105,7 +96,7 @@ AllocaInst* llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads, /// DemotePHIToStack - This function takes a virtual register computed by a PHI /// node and replaces it with a slot in the stack frame allocated via alloca. /// The PHI node is deleted. It returns the pointer to the alloca inserted. -AllocaInst* llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) { +AllocaInst *llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) { if (P->use_empty()) { P->eraseFromParent(); return 0; -- 2.11.0