Skip to content

Commit

Permalink
Some cleanup based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianbs96 committed Oct 21, 2024
1 parent b7dc060 commit b9e43c0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 39 deletions.
4 changes: 2 additions & 2 deletions include/phasar/DataFlow/IfdsIde/Solver/GenericSolverResults.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
#include <array>
#include <cstddef>
#include <cstring>
#include <new>
#include <set>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

namespace psr {

Expand Down Expand Up @@ -68,6 +66,8 @@ template <typename N, typename D, typename L> class GenericSolverResults final {
GenericSolverResults(const GenericSolverResults &) noexcept = default;
GenericSolverResults &
operator=(const GenericSolverResults &) noexcept = default;
GenericSolverResults(GenericSolverResults &&) noexcept = default;
GenericSolverResults &operator=(GenericSolverResults &&) noexcept = default;
~GenericSolverResults() = default;

[[nodiscard]] l_t resultAt(ByConstRef<n_t> Stmt, ByConstRef<d_t> Node) const {
Expand Down
24 changes: 1 addition & 23 deletions include/phasar/Utils/EquivalenceClassMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#ifndef PHASAR_UTILS_EQUIVALENCECLASSMAP_H
#define PHASAR_UTILS_EQUIVALENCECLASSMAP_H

/// XXX: Eventually get rid of this dependency:
#include "phasar/DataFlow/IfdsIde/EdgeFunction.h"

#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
Expand All @@ -21,10 +18,8 @@
#include <functional>
#include <initializer_list>
#include <iterator>
#include <memory>
#include <optional>
#include <set>
#include <vector>

namespace psr {

Expand Down Expand Up @@ -177,25 +172,8 @@ template <typename KeyT, typename ValueT> struct EquivalenceClassMap {
StorageT StoredData{};
};

namespace detail {
template <typename T> struct DefaultValueComparer : std::equal_to<T> {};
template <typename L>
struct DefaultValueComparer<std::shared_ptr<EdgeFunction<L>>> {
bool operator()(const std::shared_ptr<EdgeFunction<L>> &LHS,
const std::shared_ptr<EdgeFunction<L>> &RHS) const {
if (LHS == RHS) {
return true;
}
if (LHS == nullptr) {
return false;
}
return LHS->equal_to(RHS);
}
};
} // namespace detail

template <typename TKey, typename TValue,
typename ValueComparator = detail::DefaultValueComparer<TValue>>
typename ValueComparator = std::equal_to<TValue>>
class EquivalenceClassMapNG {
using SetTy = llvm::SmallDenseSet<TKey, 2>;

Expand Down
14 changes: 0 additions & 14 deletions unittests/PhasarLLVM/DataFlow/IfdsIde/IterativeIDESolverTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ using namespace psr;
/* ============== TEST FIXTURE ============== */
class IterativeIDESolverTest : public ::testing::Test {
protected:
// const std::string PathToLlFiles =
// unittest::PathToLLTestFiles + "control_flow/";

// void SetUp() override {
// boost::log::core::get()->set_logging_enabled(false); }

template <typename SolverConfigTy = IDESolverConfig>
void doAnalysis(const llvm::Twine &LlvmFilePath, bool PrintDump = false) {
LLVMProjectIRDB IRDB(unittest::PathToLLTestFiles + LlvmFilePath);
Expand All @@ -41,11 +35,6 @@ class IterativeIDESolverTest : public ::testing::Test {
Soundness::Soundy, /*IncludeGlobals*/ true);

IDELinearConstantAnalysis Problem(&IRDB, &ICFG, {"main"});
/// Unfortunately, the legacy solver does not compute any SolverResults if
/// value computation is turned off
// Problem.getIFDSIDESolverConfig().setComputeValues(false);
// Problem.getIFDSIDESolverConfig().setAutoAddZero(false);

IterativeIDESolver<IDELinearConstantAnalysis, SolverConfigTy> Solver(
&Problem, &ICFG);

Expand All @@ -69,8 +58,6 @@ class IterativeIDESolverTest : public ::testing::Test {
OldSolver.dumpResults();
}

// EXPECT_TRUE(
// Solver.getSolverResults().ifdsEqualWith(OldSolver.getSolverResults()));
checkEquality(OldSolver.getSolverResults(), Solver.getSolverResults(),
SolverConfigTy{});

Expand Down Expand Up @@ -156,7 +143,6 @@ TEST_F(IterativeIDESolverTest, IDESolverTestLoop) {
doAnalysis("control_flow/loop_cpp.ll");
}
TEST_F(IterativeIDESolverTest, IDELinearConstant_Call06) {
// Logger::initializeStderrLogger(SeverityLevel::DEBUG, "IterativeIDESolver");
doAnalysis("linear_constant/call_06_cpp.ll");
}
TEST_F(IterativeIDESolverTest, IDELinearConstant_Call07) {
Expand Down

0 comments on commit b9e43c0

Please sign in to comment.