[llvm] r303442 - BasicAA: Uninserted instructions have no parent, and notDifferentParent explicitly allows for this case, but getParent crashes when handed one.

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Fri May 19 12:01:21 PDT 2017


Author: dannyb
Date: Fri May 19 14:01:21 2017
New Revision: 303442

URL: http://llvm.org/viewvc/llvm-project?rev=303442&view=rev
Log:
BasicAA: Uninserted instructions have no parent, and notDifferentParent explicitly allows for this case, but getParent crashes when handed one.

Modified:
    llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=303442&r1=303441&r2=303442&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Fri May 19 14:01:21 2017
@@ -683,8 +683,11 @@ static bool isIntrinsicCall(ImmutableCal
 
 #ifndef NDEBUG
 static const Function *getParent(const Value *V) {
-  if (const Instruction *inst = dyn_cast<Instruction>(V))
+  if (const Instruction *inst = dyn_cast<Instruction>(V)) {
+    if (!inst->getParent())
+      return nullptr;
     return inst->getParent()->getParent();
+  }
 
   if (const Argument *arg = dyn_cast<Argument>(V))
     return arg->getParent();




More information about the llvm-commits mailing list