diff options
author | Owen Anderson <resistor@mac.com> | 2006-06-12 07:10:16 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2006-06-12 07:10:16 +0000 |
commit | 0ac336965e279efbe6befb82a01acd5df98c273f (patch) | |
tree | de64c48ee313d58dd9b94d54145cbace672a0c19 /llvm/lib/Transforms/Utils/LCSSA.cpp | |
parent | ecb8036e601431e8dc1397cc11c09fd038aef5a9 (diff) | |
download | bcm5719-llvm-0ac336965e279efbe6befb82a01acd5df98c273f.tar.gz bcm5719-llvm-0ac336965e279efbe6befb82a01acd5df98c273f.zip |
Fix for 2006-06-26-MultipleExitsSingleBlock.
If a single exit block has multiple predecessors within the loop, it will
appear in the exit blocks list more than once. LCSSA needs to take that into
account so that it doesn't double process that exit block.
llvm-svn: 28750
Diffstat (limited to 'llvm/lib/Transforms/Utils/LCSSA.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LCSSA.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp index ed02c977430..ac540c9aaac 100644 --- a/llvm/lib/Transforms/Utils/LCSSA.cpp +++ b/llvm/lib/Transforms/Utils/LCSSA.cpp @@ -155,13 +155,16 @@ void LCSSA::processInstruction(Instruction* Instr, std::vector<PHINode*> workList; for (std::vector<BasicBlock*>::const_iterator BBI = exitBlocks.begin(), - BBE = exitBlocks.end(); BBI != BBE; ++BBI) - if (DT->getNode(Instr->getParent())->dominates(DT->getNode(*BBI))) { - PHINode *phi = new PHINode(Instr->getType(), Instr->getName()+".lcssa", + BBE = exitBlocks.end(); BBI != BBE; ++BBI) { + Instruction*& phi = Phis[*BBI]; + if (phi == 0 && + DT->getNode(Instr->getParent())->dominates(DT->getNode(*BBI))) { + phi = new PHINode(Instr->getType(), Instr->getName()+".lcssa", (*BBI)->begin()); - workList.push_back(phi); + workList.push_back(cast<PHINode>(phi)); Phis[*BBI] = phi; } + } // Phi nodes that need to have their incoming values filled. std::vector<PHINode*> needIncomingValues; |