getUnderlyingObject can return null, handle this.
authorChris Lattner <sabre@nondot.org>
Thu, 24 Jan 2008 19:07:10 +0000 (19:07 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 24 Jan 2008 19:07:10 +0000 (19:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46318 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/BasicAliasAnalysis.cpp

index 381298b86ea9bf091e3785d05434831c5e92f88c..be8fe07f2c97c245c5c8a79ab6b6e7f671d62477 100644 (file)
@@ -245,8 +245,9 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
   if (!isa<Constant>(P)) {
     const Value *Object = getUnderlyingObject(P);
     // Allocations and byval arguments are "new" objects.
-    if (isa<AllocationInst>(Object) ||
-        (isa<Argument>(Object) && cast<Argument>(Object)->hasByValAttr())) {
+    if (Object &&
+        (isa<AllocationInst>(Object) ||
+         (isa<Argument>(Object) && cast<Argument>(Object)->hasByValAttr()))) {
       // Okay, the pointer is to a stack allocated object.  If we can prove that
       // the pointer never "escapes", then we know the call cannot clobber it,
       // because it simply can't get its address.