switchinst ctor now takes a hint for the number of cases that it will have.
authorChris Lattner <sabre@nondot.org>
Sat, 29 Jan 2005 00:38:26 +0000 (00:38 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 29 Jan 2005 00:38:26 +0000 (00:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19898 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/CodeExtractor.cpp
lib/Transforms/Utils/SimplifyCFG.cpp

index 3878ea2e675e02f5c3a56cd5c07bc6553b625922..5a040010059ebb98bbca9c5b24852c01736e0d10 100644 (file)
@@ -439,7 +439,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer,
   // 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 f4d02573cdc7eef9e49df2dd68fbb2156d78667d..5e282279e336abf6f41291d38f5e6bb98a9732b3 100644 (file)
@@ -518,7 +518,7 @@ static bool FoldValueComparisonIntoPredecessors(TerminatorInst *TI) {
         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 @@ bool llvm::SimplifyCFG(BasicBlock *BB) {
           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)