CallInst::getCalledFunction() may return a null function
[c11llvm.git] / isAtomicCall.hpp
index 11e5e68b77ee25a02d8a84ac4e39f7280d220b2f..a12761964986dd76fa2483af5bf6a3f31d397eb0 100644 (file)
@@ -6,6 +6,9 @@ bool isAtomicCall(Instruction *I)
 {
        if ( auto *CI = dyn_cast<CallInst>(I) ) {
                Function *fun = CI->getCalledFunction();
+               if (fun == NULL)
+                       return false;
+
                StringRef funName = fun->getName();
 
                if ( (CI->isTailCall() && funName.contains("atomic_")) ||