Fix an over aggressive assumption that struct decls will have a pointer to
[oota-llvm.git] / lib / CodeGen / MachineModuleInfo.cpp
index 4b64901bd4e2d18b481a310fc93e6a5c36cd40f8..9e0e9025a4b98950a7ddcfaf8bf5788f3956b7a7 100644 (file)
@@ -363,7 +363,7 @@ public:
     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));