[llvm-commits] [llvm] r58959 - /llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp

Chris Lattner sabre at nondot.org
Sun Nov 9 19:48:55 PST 2008


Author: lattner
Date: Sun Nov  9 21:48:55 2008
New Revision: 58959

URL: http://llvm.org/viewvc/llvm-project?rev=58959&view=rev
Log:
Fix an over aggressive assumption that struct decls will have a pointer to
an array that is empty.  Instead of requiring this array, allow a null pointer.
This shrinks all forward references of structs.

Modified:
    llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp

Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=58959&r1=58958&r2=58959&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Sun Nov  9 21:48:55 2008
@@ -363,7 +363,7 @@
     Field.resize(0);
     Constant *C = CI->getOperand(I++);
     GlobalVariable *GV = getGlobalVariable(C);
-    if (GV->hasInitializer()) {
+    if (GV && GV->hasInitializer()) {
       if (ConstantArray *CA = dyn_cast<ConstantArray>(GV->getInitializer())) {
         for (unsigned i = 0, N = CA->getNumOperands(); i < N; ++i) {
           GlobalVariable *GVE = getGlobalVariable(CA->getOperand(i));





More information about the llvm-commits mailing list