diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:34:44 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:34:44 +0000 | 
| commit | 6b943ff3a3f8617113ecbf611cf0f8957e4e19d2 (patch) | |
| tree | fc5f365fb9035b2d0c622bbf06c9bbe8627d7279 /lib/Transforms/Utils/SSAUpdater.cpp | |
| parent | d0e4e96dc17a6c1c6de3340842c80f0e187ba349 (diff) | |
Notes
Diffstat (limited to 'lib/Transforms/Utils/SSAUpdater.cpp')
| -rw-r--r-- | lib/Transforms/Utils/SSAUpdater.cpp | 15 | 
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Transforms/Utils/SSAUpdater.cpp b/lib/Transforms/Utils/SSAUpdater.cpp index 3896d9851b26..2860c3e511a6 100644 --- a/lib/Transforms/Utils/SSAUpdater.cpp +++ b/lib/Transforms/Utils/SSAUpdater.cpp @@ -12,6 +12,7 @@  //===----------------------------------------------------------------------===//  #define DEBUG_TYPE "ssaupdater" +#include "llvm/Constants.h"  #include "llvm/Instructions.h"  #include "llvm/ADT/DenseMap.h"  #include "llvm/Analysis/InstructionSimplify.h" @@ -20,8 +21,10 @@  #include "llvm/Support/CFG.h"  #include "llvm/Support/Debug.h"  #include "llvm/Support/raw_ostream.h" +#include "llvm/Transforms/Utils/BasicBlockUtils.h"  #include "llvm/Transforms/Utils/SSAUpdater.h"  #include "llvm/Transforms/Utils/SSAUpdaterImpl.h" +  using namespace llvm;  typedef DenseMap<BasicBlock*, Value*> AvailableValsTy; @@ -170,8 +173,8 @@ Value *SSAUpdater::GetValueInMiddleOfBlock(BasicBlock *BB) {    }    // Ok, we have no way out, insert a new one now. -  PHINode *InsertedPHI = PHINode::Create(ProtoType, ProtoName, &BB->front()); -  InsertedPHI->reserveOperandSpace(PredValues.size()); +  PHINode *InsertedPHI = PHINode::Create(ProtoType, PredValues.size(), +                                         ProtoName, &BB->front());    // Fill in all the predecessors of the PHI.    for (unsigned i = 0, e = PredValues.size(); i != e; ++i) @@ -184,6 +187,9 @@ Value *SSAUpdater::GetValueInMiddleOfBlock(BasicBlock *BB) {      return V;    } +  // Set DebugLoc. +  InsertedPHI->setDebugLoc(GetFirstDebugLocInBasicBlock(BB)); +    // If the client wants to know about all new instructions, tell it.    if (InsertedPHIs) InsertedPHIs->push_back(InsertedPHI); @@ -289,9 +295,8 @@ public:    /// Reserve space for the operands but do not fill them in yet.    static Value *CreateEmptyPHI(BasicBlock *BB, unsigned NumPreds,                                 SSAUpdater *Updater) { -    PHINode *PHI = PHINode::Create(Updater->ProtoType, Updater->ProtoName, -                                   &BB->front()); -    PHI->reserveOperandSpace(NumPreds); +    PHINode *PHI = PHINode::Create(Updater->ProtoType, NumPreds, +                                   Updater->ProtoName, &BB->front());      return PHI;    }  | 
