[llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp

John Criswell criswell at cs.uiuc.edu
Mon Oct 25 11:30:23 PDT 2004



Changes in directory llvm/lib/Target/CBackend:

Writer.cpp updated: 1.205 -> 1.206
---
Log message:

Modified switch generation so that only the phi values associated with the
destination basic block are copied.


---
Diffs of the changes:  (+2 -1)

Index: llvm/lib/Target/CBackend/Writer.cpp
diff -u llvm/lib/Target/CBackend/Writer.cpp:1.205 llvm/lib/Target/CBackend/Writer.cpp:1.206
--- llvm/lib/Target/CBackend/Writer.cpp:1.205	Wed Oct 20 09:38:39 2004
+++ llvm/lib/Target/CBackend/Writer.cpp	Mon Oct 25 13:30:09 2004
@@ -1194,11 +1194,11 @@
 }
 
 void CWriter::visitSwitchInst(SwitchInst &SI) {
-  printPHICopiesForSuccessors(SI.getParent(), 0);
 
   Out << "  switch (";
   writeOperand(SI.getOperand(0));
   Out << ") {\n  default:\n";
+  printPHICopiesForSuccessor (SI.getParent(), SI.getDefaultDest(), 2);
   printBranchToBlock(SI.getParent(), SI.getDefaultDest(), 2);
   Out << ";\n";
   for (unsigned i = 2, e = SI.getNumOperands(); i != e; i += 2) {
@@ -1206,6 +1206,7 @@
     writeOperand(SI.getOperand(i));
     Out << ":\n";
     BasicBlock *Succ = cast<BasicBlock>(SI.getOperand(i+1));
+    printPHICopiesForSuccessor (SI.getParent(), Succ, 2);
     printBranchToBlock(SI.getParent(), Succ, 2);
     if (Succ == SI.getParent()->getNext())
       Out << "    break;\n";






More information about the llvm-commits mailing list