A function with no Module owner isn't materializable. This fixes F->dump() for
authorNick Lewycky <nicholas@mxc.ca>
Mon, 15 Feb 2010 21:27:20 +0000 (21:27 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Mon, 15 Feb 2010 21:27:20 +0000 (21:27 +0000)
functions not embedded within modules.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96272 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Globals.cpp

index f149c446b43b440eb2c9082f7f5e52389e1d8100..489ec650e0715695577e851f0544ab9d47c57621 100644 (file)
@@ -44,10 +44,10 @@ static bool removeDeadUsersOfConstant(const Constant *C) {
 }
 
 bool GlobalValue::isMaterializable() const {
-  return getParent()->isMaterializable(this);
+  return getParent() && getParent()->isMaterializable(this);
 }
 bool GlobalValue::isDematerializable() const {
-  return getParent()->isDematerializable(this);
+  return getParent() && getParent()->isDematerializable(this);
 }
 bool GlobalValue::Materialize(std::string *ErrInfo) {
   return getParent()->Materialize(this, ErrInfo);