[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Jun 2 12:43:01 PDT 2003


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.43 -> 1.44

---
Log message:

* Make assertion message useful
* Kill dead conditional


---
Diffs of the changes:

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.43 llvm/lib/VMCore/Constants.cpp:1.44
--- llvm/lib/VMCore/Constants.cpp:1.43	Mon Jun  2 12:25:46 2003
+++ llvm/lib/VMCore/Constants.cpp	Mon Jun  2 12:42:47 2003
@@ -225,7 +225,8 @@
          "Invalid initializer vector for constant structure");
   Operands.reserve(V.size());
   for (unsigned i = 0, e = V.size(); i != e; ++i) {
-    assert(V[i]->getType() == ETypes[i]);
+    assert(V[i]->getType() == ETypes[i] &&
+           "Initializer for struct element doesn't match struct element type!");
     Operands.push_back(Use(V[i], this));
   }
 }
@@ -671,12 +672,10 @@
   if (OldTy == NewTy) return;
 
   // Make everyone now use a constant of the new type...
-  if (NewTy != OldTy) {
-    replaceAllUsesWith(ConstantPointerNull::get(cast<PointerType>(NewTy)));
+  replaceAllUsesWith(ConstantPointerNull::get(cast<PointerType>(NewTy)));
     
-    // This constant is now dead, destroy it.
-    destroyConstant();
-  }
+  // This constant is now dead, destroy it.
+  destroyConstant();
 }
 
 





More information about the llvm-commits mailing list