From 659cb8d2598bf87458fd92ada4641ce687a19ab2 Mon Sep 17 00:00:00 2001 From: Martin Mory Date: Fri, 17 Nov 2023 18:39:11 +0100 Subject: [PATCH] Fix global handling in type state analysis (#651) * fix global handling in type state analysis * Fix error due to update from dev * fix killing of globals: only kill if no declaration-only func is called --------- Co-authored-by: Martin Mory Co-authored-by: Fabian Schiebel --- .../DataFlow/IfdsIde/Problems/IDETypeStateAnalysis.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDETypeStateAnalysis.cpp b/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDETypeStateAnalysis.cpp index 3f20b5d97..8b2dfdcf9 100644 --- a/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDETypeStateAnalysis.cpp +++ b/lib/PhasarLLVM/DataFlow/IfdsIde/Problems/IDETypeStateAnalysis.cpp @@ -182,6 +182,7 @@ auto IDETypeStateAnalysisBase::getCallToRetFlowFunction( n_t CallSite, n_t /*RetSite*/, llvm::ArrayRef Callees) -> FlowFunctionPtrType { const auto *CS = llvm::cast(CallSite); + bool DeclarationOnlyCalleeFound = false; for (const auto *Callee : Callees) { std::string DemangledFname = llvm::demangle(Callee->getName().str()); // Generate the return value of factory functions from zero value @@ -189,6 +190,8 @@ auto IDETypeStateAnalysisBase::getCallToRetFlowFunction( return this->generateFromZero(CS); } + DeclarationOnlyCalleeFound |= Callee->isDeclaration(); + /// XXX: Revisit this: // Handle all functions that are not modeld with special semantics. @@ -209,6 +212,10 @@ auto IDETypeStateAnalysisBase::getCallToRetFlowFunction( } } } + if (!DeclarationOnlyCalleeFound) { + return killFlowIf( + [](d_t Source) { return llvm::isa(Source); }); + } return identityFlow(); }