[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Nov 8 18:50:20 PST 2002


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.65 -> 1.66

---
Log message:

Fix warning


---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.65 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.66
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.65	Mon Nov  4 10:43:32 2002
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Fri Nov  8 18:49:43 2002
@@ -724,13 +724,15 @@
   if (AI.isArrayAllocation())    // Check C != 1
     if (const ConstantUInt *C = dyn_cast<ConstantUInt>(AI.getArraySize())) {
       const Type *NewTy = ArrayType::get(AI.getAllocatedType(), C->getValue());
-      AllocationInst *New;
+      AllocationInst *New = 0;
 
       // Create and insert the replacement instruction...
       if (isa<MallocInst>(AI))
         New = new MallocInst(NewTy, 0, AI.getName(), &AI);
-      else if (isa<AllocaInst>(AI))
+      else {
+        assert(isa<AllocaInst>(AI) && "Unknown type of allocation inst!");
         New = new AllocaInst(NewTy, 0, AI.getName(), &AI);
+      }
       
       // Scan to the end of the allocation instructions, to skip over a block of
       // allocas if possible...





More information about the llvm-commits mailing list