Skip to content

Commit 417c476

Browse files
author
thk123
committed
Tidied up the changes introduced by context aware merging
1 parent 039cfb9 commit 417c476

File tree

2 files changed

+14
-43
lines changed

2 files changed

+14
-43
lines changed

src/analyses/variable-sensitivity/abstract_enviroment.cpp

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,7 @@ Function: abstract_environmentt::environment_diff
771771
std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
772772
const abstract_environmentt &first, const abstract_environmentt &second)
773773
{
774+
// Find all symbols who have different write locations in each map
774775
std::vector<symbol_exprt> symbols_diff;
775776
for (const auto &entry : first.map)
776777
{
@@ -782,19 +783,10 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
782783
// in the other
783784
// Since a set can assume at most one match
784785

785-
#if 0
786-
const auto location_matcher=
787-
[&](
788-
goto_programt::const_targett instruction,
789-
goto_programt::const_targett other_instruction)
790-
{
791-
return other_instruction->location_number<instruction->location_number;
792-
};
793-
#endif
794-
795-
796-
const abstract_objectt::locationst &a=entry.second->get_last_written_locations();
797-
const abstract_objectt::locationst &b=second_entry->second->get_last_written_locations();
786+
const abstract_objectt::locationst &first_write_locations=
787+
entry.second->get_last_written_locations();
788+
const abstract_objectt::locationst &second_write_locations=
789+
second_entry->second->get_last_written_locations();
798790

799791
class location_ordert
800792
{
@@ -803,21 +795,23 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
803795
goto_programt::const_targett instruction,
804796
goto_programt::const_targett other_instruction)
805797
{
806-
return instruction->location_number>other_instruction->location_number;
798+
return instruction->location_number>
799+
other_instruction->location_number;
807800
}
808801
};
809802

810-
typedef std::set<goto_programt::const_targett, location_ordert> sorted_locationst;
803+
typedef std::set<goto_programt::const_targett, location_ordert>
804+
sorted_locationst;
811805

812806
sorted_locationst lhs_location;
813-
for(const auto &entry:a)
807+
for(const auto &entry:first_write_locations)
814808
{
815809
lhs_location.insert(entry);
816810
}
817811

818812

819813
sorted_locationst rhs_location;
820-
for(const auto &entry:b)
814+
for(const auto &entry:second_write_locations)
821815
{
822816
rhs_location.insert(entry);
823817
}
@@ -830,23 +824,8 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
830824
rhs_location.cend(),
831825
std::inserter(intersection, intersection.end()),
832826
location_ordert());
833-
bool all_matched=intersection.size()==a.size() &&
834-
intersection.size()==b.size();
835-
836-
#if 0
837-
std::cout << entry.first.get_identifier() << ": {";
838-
for(const auto &entry:lhs_location)
839-
{
840-
std::cout << entry->location_number << ", ";
841-
}
842-
843-
std::cout << " } vs { ";
844-
for(const auto &entry:rhs_location)
845-
{
846-
std::cout << entry->location_number << ", ";
847-
}
848-
std::cout << " }" << std::endl;
849-
#endif
827+
bool all_matched=intersection.size()==first_write_locations.size() &&
828+
intersection.size()==second_write_locations.size();
850829

851830
if (!all_matched)
852831
{
@@ -855,6 +834,7 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
855834
}
856835
}
857836

837+
// Add any symbols that are only in the second map
858838
for(const auto &entry : second.map)
859839
{
860840
const auto &second_entry = first.map.find(entry.first);

src/analyses/variable-sensitivity/variable_sensitivity_domain.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Date: April 2016
1717
#include "variable_sensitivity_domain.h"
1818
#include <util/cprover_prefix.h>
1919

20-
#define DEBUG
21-
2220
#ifdef DEBUG
2321
#include <iostream>
2422
#endif
@@ -183,8 +181,6 @@ void variable_sensitivity_domaint::transform(
183181
throw "unrecognised instruction type";
184182
}
185183

186-
output(std::cout, ai, ns);
187-
188184
assert(abstract_state.verify());
189185
}
190186

@@ -282,11 +278,6 @@ bool variable_sensitivity_domaint::merge(
282278
<< to->location_number << std::endl;
283279
#endif
284280

285-
if(from->location_number==43)
286-
{
287-
288-
}
289-
290281
// Use the abstract_environment merge
291282
bool any_changes=abstract_state.merge(b.abstract_state);
292283

0 commit comments

Comments
 (0)