Skip to content

Commit 624a80e

Browse files
committed
Removal of make_shallow_copy and faster equality checks.
1 parent 06112eb commit 624a80e

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

src/taint-slicer/irept_instrument.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ Date: May 2017
1313

1414
#include <taint-slicer/irept_instrument.h>
1515

16-
irept make_shallow_copy(const irept irep)
16+
static bool are_equal(const irept l, const irept r)
1717
{
18-
irept result(irep.id());
19-
result.get_sub()=irep.get_sub();
20-
result.get_named_sub()=irep.get_named_sub();
21-
result.get_comments()=irep.get_comments();
22-
return result;
18+
return &l.read()==&r.read();
2319
}
2420

2521
irept instrument(const irept irep, const instrumenter_fnt &instrumenter)
@@ -30,7 +26,7 @@ irept instrument(const irept irep, const instrumenter_fnt &instrumenter)
3026
for(const irept sub : irep.get_sub())
3127
{
3228
new_sub.push_back(instrument(sub, instrumenter));
33-
if(new_sub.back()!=sub)
29+
if(!are_equal(new_sub.back(), sub))
3430
modified=true;
3531
}
3632

@@ -44,7 +40,7 @@ irept instrument(const irept irep, const instrumenter_fnt &instrumenter)
4440
instrument(name_sub.second, instrumenter)
4541
});
4642
assert(it_bool.second);
47-
if(it_bool.first->second!=name_sub.second)
43+
if(!are_equal(it_bool.first->second, name_sub.second))
4844
modified=true;
4945
}
5046

@@ -58,7 +54,7 @@ irept instrument(const irept irep, const instrumenter_fnt &instrumenter)
5854
instrument(name_sub.second, instrumenter)
5955
});
6056
assert(it_bool.second);
61-
if(it_bool.first->second!=name_sub.second)
57+
if(!are_equal(it_bool.first->second, name_sub.second))
6258
modified=true;
6359
}
6460

@@ -85,7 +81,7 @@ irept instrument_using_pivot(
8581
pit!=pivot.get_sub().cend() && iit!=irep.get_sub().cend(); ++pit, ++iit)
8682
{
8783
new_sub.push_back(instrument_using_pivot(*pit, *iit, instrumenter));
88-
if(new_sub.back()!=*iit)
84+
if(!are_equal(new_sub.back(), *iit))
8985
modified=true;
9086
}
9187

@@ -103,7 +99,7 @@ irept instrument_using_pivot(
10399
instrument_using_pivot(pit->second, iit->second, instrumenter)
104100
});
105101
assert(it_bool.second);
106-
if(it_bool.first->second!=iit->second)
102+
if(!are_equal(it_bool.first->second, iit->second))
107103
modified=true;
108104
}
109105

@@ -121,7 +117,7 @@ irept instrument_using_pivot(
121117
instrument_using_pivot(pit->second, iit->second, instrumenter)
122118
});
123119
assert(it_bool.second);
124-
if(it_bool.first->second!=iit->second)
120+
if(!are_equal(it_bool.first->second, iit->second))
125121
modified=true;
126122
}
127123

src/taint-slicer/irept_instrument.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,6 @@ typedef std::function<irept(irept, irept)> pivot_instrumenter_fnt;
2424

2525
/*******************************************************************\
2626
27-
Function:
28-
29-
Inputs:
30-
31-
Outputs:
32-
33-
Purpose:
34-
35-
\*******************************************************************/
36-
irept make_shallow_copy(const irept irep);
37-
38-
/*******************************************************************\
39-
4027
Function:
4128
4229
Inputs:

0 commit comments

Comments
 (0)