diff options
author | Chris Lattner <sabre@nondot.org> | 2003-04-23 19:15:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-04-23 19:15:13 +0000 |
commit | 5bc7eb5fd8ab840209e92b4d58a91c361567ecee (patch) | |
tree | 2479ab4b610c904e75aef92068cfedd4c6c270aa /llvm/lib/CWriter/Writer.cpp | |
parent | 5cc1270689c88cea32e6546ed5dd981faae900e7 (diff) | |
download | bcm5719-llvm-5bc7eb5fd8ab840209e92b4d58a91c361567ecee.tar.gz bcm5719-llvm-5bc7eb5fd8ab840209e92b4d58a91c361567ecee.zip |
Fix problem where labels were being incorrectly elided, and fix problem
where PHI copies where not emitted for the default label of switch insts
llvm-svn: 5882
Diffstat (limited to 'llvm/lib/CWriter/Writer.cpp')
-rw-r--r-- | llvm/lib/CWriter/Writer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/CWriter/Writer.cpp b/llvm/lib/CWriter/Writer.cpp index f9ddc7d8c41..b9e27acf57f 100644 --- a/llvm/lib/CWriter/Writer.cpp +++ b/llvm/lib/CWriter/Writer.cpp @@ -817,7 +817,8 @@ void CWriter::printFunction(Function *F) { for (Value::use_iterator UI = BB->use_begin(), UE = BB->use_end(); UI != UE; ++UI) if (TerminatorInst *TI = dyn_cast<TerminatorInst>(*UI)) - if (TI != Prev->getTerminator()) { + if (TI != Prev->getTerminator() || + isa<SwitchInst>(Prev->getTerminator())) { NeedsLabel = true; break; } @@ -867,8 +868,8 @@ void CWriter::visitReturnInst(ReturnInst &I) { void CWriter::visitSwitchInst(SwitchInst &SI) { Out << " switch ("; writeOperand(SI.getOperand(0)); - Out << ") {\n default: goto "; - writeOperand(SI.getDefaultDest()); + Out << ") {\n default:\n"; + printBranchToBlock(SI.getParent(), SI.getDefaultDest(), 2); Out << ";\n"; for (unsigned i = 2, e = SI.getNumOperands(); i != e; i += 2) { Out << " case "; |