From 780d2fe31929c597af6f41cd06dad75241c38ddf Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Mon, 15 Feb 2010 21:27:20 +0000 Subject: [PATCH] A function with no Module owner isn't materializable. This fixes F->dump() for functions not embedded within modules. llvm-svn: 96272 --- llvm/lib/VMCore/Globals.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/VMCore/Globals.cpp b/llvm/lib/VMCore/Globals.cpp index f149c446b43b..489ec650e071 100644 --- a/llvm/lib/VMCore/Globals.cpp +++ b/llvm/lib/VMCore/Globals.cpp @@ -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);