Skip to content

SolverConfig Parametrization#430

Merged
pdschubert merged 9 commits intodevelopmentfrom
f-SolverConfigParams
Jan 12, 2022
Merged

SolverConfig Parametrization#430
pdschubert merged 9 commits intodevelopmentfrom
f-SolverConfigParams

Conversation

@fabianbs96
Copy link
Copy Markdown
Member

Add CLI parameters to the phasar-llvm tool in order to enable parametrization of the IFDSIDESolverConfig options

@fabianbs96 fabianbs96 requested a review from pdschubert October 22, 2021 14:38
@fabianbs96 fabianbs96 self-assigned this Oct 22, 2021
@fabianbs96 fabianbs96 marked this pull request as ready for review October 22, 2021 14:38
Comment on lines +137 to +139
if constexpr (has_setIFDSIDESolverConfig_v<ProblemDescription>) {
ProblemDesc.setIFDSIDESolverConfig(SolverConfig);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is always defined on IFDS and IDE problems. We can remove this check.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WholeProgramAnalysis is used for the Mono-analyses as well. They do not define that function

Comment on lines +75 to +81
template <typename T, typename = void>
struct has_setIFDSIDESolverConfig : std::false_type {};
template <typename T>
struct has_setIFDSIDESolverConfig<
T, decltype(std::declval<T>().setIFDSIDESolverConfig(
std::declval<IFDSIDESolverConfig>()))> : std::true_type {};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need that (cf. comment in the above).

Comment thread lib/PhasarLLVM/ControlFlow/LLVMBasedCFG.cpp Outdated
Comment thread lib/PhasarLLVM/ControlFlow/LLVMBasedCFG.cpp Outdated
Comment on lines +94 to +119

if (Successors.empty()) {
if (const auto *Branch = llvm::dyn_cast<llvm::BranchInst>(I);
Branch && isStaticVariableLazyInitializationBranch(Branch)) {
// Skip the "already initialized" case, such that the analysis is always
// aware of the initialized value.
const auto *NextInst = &Branch->getSuccessor(0)->front();
if (IgnoreDbgInstructions &&
llvm::isa<llvm::DbgInfoIntrinsic>(NextInst)) {
NextInst = NextInst->getNextNonDebugInstruction(false);
}
Successors.push_back(NextInst);

} else {
Successors.reserve(I->getNumSuccessors() + Successors.size());
std::transform(llvm::succ_begin(I), llvm::succ_end(I),
std::back_inserter(Successors),
[](const llvm::BasicBlock *BB) {
const llvm::Instruction *Succ = &BB->front();
if (llvm::isa<llvm::DbgInfoIntrinsic>(Succ)) {
Succ = Succ->getNextNonDebugInstruction(
false /*Only debug instructions*/);
}
return Succ;
});
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain the change to me, I don't quite get it. Thanks.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A static local variable is lazily initialized (i.e. the first time it is used). This results in a branch in the IR that skips the initialization. So, from the analysis' point of view, the initialization may be skipped all times the variable is used (we cannot analyze the branch condition). However, in reality, we know that (by specification) the variable must definitely be initialized before it is used.

This piece of code removes the "skip lazy initialization" branch from the CFG, such that the analysis knows, it already happened when the rest of the code uses that variable.

Comment thread lib/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSIDESolverConfig.cpp Outdated
Comment thread tools/phasar-llvm/phasar-llvm.cpp Outdated
Comment thread tools/phasar-llvm/phasar-llvm.cpp Outdated
@fabianbs96 fabianbs96 requested a review from pdschubert October 28, 2021 10:25
Comment thread include/phasar/Utils/TypeTraits.h Outdated
pdschubert and others added 2 commits January 12, 2022 09:48
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@pdschubert pdschubert merged commit 6ac85b2 into development Jan 12, 2022
@pdschubert pdschubert deleted the f-SolverConfigParams branch January 12, 2022 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants