Skip to content

Commit

Permalink
fix killing of globals: only kill if no declaration-only func is called
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Mory committed Nov 17, 2023
1 parent 1b1a809 commit 1b7e660
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,16 @@ auto IDETypeStateAnalysisBase::getCallToRetFlowFunction(
n_t CallSite, n_t /*RetSite*/, llvm::ArrayRef<f_t> Callees)
-> FlowFunctionPtrType {
const auto *CS = llvm::cast<llvm::CallBase>(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
if (isFactoryFunction(DemangledFname)) {
return this->generateFromZero(CS);
}

DeclarationOnlyCalleeFound |= Callee->isDeclaration();

/// XXX: Revisit this:

// Handle all functions that are not modeld with special semantics.
Expand All @@ -207,10 +210,12 @@ auto IDETypeStateAnalysisBase::getCallToRetFlowFunction(
return killManyFlows(getWMAliasesAndAllocas(Arg.get()));
}
}
return killFlowIf(
[](d_t Source) { return llvm::isa<llvm::Constant>(Source); });
}
}
if (!DeclarationOnlyCalleeFound) {
return killFlowIf(
[](d_t Source) { return llvm::isa<llvm::Constant>(Source); });
}
return identityFlow();
}

Expand Down

0 comments on commit 1b7e660

Please sign in to comment.