[llvm-commits] CVS: llvm/lib/Transforms/Utils/CodeExtractor.cpp SimplifyCFG.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Jan 28 16:38:39 PST 2005



Changes in directory llvm/lib/Transforms/Utils:

CodeExtractor.cpp updated: 1.35 -> 1.36
SimplifyCFG.cpp updated: 1.62 -> 1.63
---
Log message:

switchinst ctor now takes a hint for the number of cases that it will have.


---
Diffs of the changes:  (+3 -3)

 CodeExtractor.cpp |    2 +-
 SimplifyCFG.cpp   |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)


Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.35 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.36
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.35	Fri Nov 19 20:20:27 2004
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp	Fri Jan 28 18:38:26 2005
@@ -439,7 +439,7 @@
   // Now we can emit a switch statement using the call as a value.
   SwitchInst *TheSwitch =
     new SwitchInst(ConstantUInt::getNullValue(Type::UShortTy),
-                   codeReplacer, codeReplacer);
+                   codeReplacer, 0, codeReplacer);
 
   // Since there may be multiple exits from the original region, make the new
   // function return an unsigned, switch on that number.  This loop iterates


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.62 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.63
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.62	Sat Jan  1 10:02:12 2005
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp	Fri Jan 28 18:38:26 2005
@@ -518,7 +518,7 @@
         AddPredecessorToBlock(NewSuccessors[i], Pred, BB);
 
       // Now that the successors are updated, create the new Switch instruction.
-      SwitchInst *NewSI = new SwitchInst(CV, PredDefault, PTI);
+      SwitchInst *NewSI = new SwitchInst(CV, PredDefault, PredCases.size(),PTI);
       for (unsigned i = 0, e = PredCases.size(); i != e; ++i)
         NewSI->addCase(PredCases[i].first, PredCases[i].second);
 
@@ -1209,7 +1209,7 @@
           if (!TrueWhenEqual) std::swap(DefaultBB, EdgeBB);
           
           // Create the new switch instruction now.
-          SwitchInst *New = new SwitchInst(CompVal, DefaultBB, BI);
+          SwitchInst *New = new SwitchInst(CompVal, DefaultBB,Values.size(),BI);
           
           // Add all of the 'cases' to the switch instruction.
           for (unsigned i = 0, e = Values.size(); i != e; ++i)






More information about the llvm-commits mailing list