Skip to content

Commit

Permalink
fixed LLVMAliasSetSerializationTest
Browse files Browse the repository at this point in the history
  • Loading branch information
mxHuber committed Apr 17, 2024
1 parent 16bbf2a commit 47bf183
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
3 changes: 1 addition & 2 deletions lib/PhasarLLVM/Pointer/LLVMAliasSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,6 @@ LLVMAliasSetData LLVMAliasSet::getLLVMAliasSetData() const {
LLVMAliasSetData Data;

/// Serialize the AliasSets
auto &AliasSetsDataPosition = Data.AliasSets.emplace_back();

for (const AliasSetTy *PTS : Owner.getAllAliasSets()) {

std::vector<std::string> PtsJson{};
Expand All @@ -739,6 +737,7 @@ LLVMAliasSetData LLVMAliasSet::getLLVMAliasSetData() const {
}
}
if (!PtsJson.empty()) {
auto &AliasSetsDataPosition = Data.AliasSets.emplace_back();
for (const auto &Curr : PtsJson) {
AliasSetsDataPosition.push_back(Curr);
}
Expand Down
10 changes: 0 additions & 10 deletions unittests/PhasarLLVM/Pointer/LLVMAliasSetSerializationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ static SetTy makeSet(const nlohmann::json &J) {
}

static void checkSer(const nlohmann::json &Ser, const GroundTruthTy &Gt) {

ASSERT_TRUE(Ser.count("AliasSets"));
ASSERT_TRUE(Ser.count("AnalyzedFunctions"));

Expand Down Expand Up @@ -77,20 +76,11 @@ static void analyze(llvm::StringRef File, const GroundTruthTy &Gt,
ValueAnnotationPass::resetValueID();
LLVMProjectIRDB IRDB(unittest::PathToLLTestFiles + File);

// llvm::outs() << *IRDB.getWPAModule() << '\n';

LLVMAliasSet PTS(&IRDB, false);
LLVMTypeHierarchy TH(IRDB);
LLVMBasedICFG ICF(&IRDB, CallGraphAnalysisType::OTF, {EntryPoint.str()}, &TH,
&PTS);

auto Ser = PTS.getAsJson();
checkSer(Ser, Gt);

LLVMAliasSet Deser(&IRDB, Ser);
checkDeser(*IRDB.getModule(), PTS, Deser);

// printAsJson serialization
std::string SerString;
llvm::raw_string_ostream StringStream(SerString);
PTS.printAsJson(StringStream);
Expand Down

0 comments on commit 47bf183

Please sign in to comment.