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/CodeExtractor.cpp | |
| parent | d0e4e96dc17a6c1c6de3340842c80f0e187ba349 (diff) | |
Notes
Diffstat (limited to 'lib/Transforms/Utils/CodeExtractor.cpp')
| -rw-r--r-- | lib/Transforms/Utils/CodeExtractor.cpp | 12 | 
1 files changed, 6 insertions, 6 deletions
| diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index e6337722c8bd6..8c133ea7f5608 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -104,7 +104,7 @@ namespace {  /// region, we need to split the entry block of the region so that the PHI node  /// is easier to deal with.  void CodeExtractor::severSplitPHINodes(BasicBlock *&Header) { -  bool HasPredsFromRegion = false; +  unsigned NumPredsFromRegion = 0;    unsigned NumPredsOutsideRegion = 0;    if (Header != &Header->getParent()->getEntryBlock()) { @@ -116,7 +116,7 @@ void CodeExtractor::severSplitPHINodes(BasicBlock *&Header) {      // header block into two.      for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)        if (BlocksToExtract.count(PN->getIncomingBlock(i))) -        HasPredsFromRegion = true; +        ++NumPredsFromRegion;        else          ++NumPredsOutsideRegion; @@ -147,7 +147,7 @@ void CodeExtractor::severSplitPHINodes(BasicBlock *&Header) {    // Okay, now we need to adjust the PHI nodes and any branches from within the    // region to go to the new header block instead of the old header block. -  if (HasPredsFromRegion) { +  if (NumPredsFromRegion) {      PHINode *PN = cast<PHINode>(OldPred->begin());      // Loop over all of the predecessors of OldPred that are in the region,      // changing them to branch to NewBB instead. @@ -157,14 +157,14 @@ void CodeExtractor::severSplitPHINodes(BasicBlock *&Header) {          TI->replaceUsesOfWith(OldPred, NewBB);        } -    // Okay, everthing within the region is now branching to the right block, we +    // Okay, everything within the region is now branching to the right block, we      // just have to update the PHI nodes now, inserting PHI nodes into NewBB.      for (AfterPHIs = OldPred->begin(); isa<PHINode>(AfterPHIs); ++AfterPHIs) {        PHINode *PN = cast<PHINode>(AfterPHIs);        // Create a new PHI node in the new region, which has an incoming value        // from OldPred of PN. -      PHINode *NewPN = PHINode::Create(PN->getType(), PN->getName()+".ce", -                                       NewBB->begin()); +      PHINode *NewPN = PHINode::Create(PN->getType(), 1 + NumPredsFromRegion, +                                       PN->getName()+".ce", NewBB->begin());        NewPN->addIncoming(PN, OldPred);        // Loop over all of the incoming value in PN, moving them to NewPN if they | 
