Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strong update for translating phi #1263

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 37 additions & 44 deletions svf/lib/AbstractExecution/SVFIR2ItvExeState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,41 +759,34 @@ void SVFIR2ItvExeState::translateLoad(const LoadStmt *load)
{
VAddrs &addrs = getVAddrs(rhs);
assert(!addrs.empty());
for (const auto &addr: addrs)
{
u32_t objId = getInternalID(addr);
if (inLocToIValTable(objId))
_es[lhs] = IntervalValue::bottom();
else if (inLocToAddrsTable(objId))
_es.getVAddrs(lhs).setBottom();
break;
}
IntervalValue rhsItv = IntervalValue::bottom();
AddressValue rhsAddr;
bool isItv = false, isAddr = false;
for (const auto &addr: addrs)
{
u32_t objId = getInternalID(addr);
if (inLocToIValTable(objId))
{
if (!inVarToIValTable(lhs))
{
_es[lhs] = _es.load(addr);
}
else
{
_es[lhs].join_with(_es.load(addr));
}
rhsItv.join_with(_es.load(addr));
isItv = true;
}
else if (inLocToAddrsTable(objId))
{
if (!inVarToAddrsTable(lhs))
{
_es.getVAddrs(lhs) = _es.loadVAddrs(addr);
}
else
{
_es.getVAddrs(lhs).join_with(_es.loadVAddrs(addr));
}
rhsAddr.join_with(_es.loadVAddrs(addr));
isAddr = true;
} else {
// rhs not in table
}
}
if (isItv) {
// lhs var is an integer
_es[lhs] = rhsItv;
} else if (isAddr) {
// lhs var is an address
_es.getVAddrs(lhs) = rhsAddr;
} else {
// rhs not in table
}
}
}

Expand Down Expand Up @@ -911,34 +904,34 @@ void SVFIR2ItvExeState::translateSelect(const SelectStmt *select)
void SVFIR2ItvExeState::translatePhi(const PhiStmt *phi)
{
u32_t res = phi->getResID();
IntervalValue rhsItv = IntervalValue::bottom();
AddressValue rhsAddr;
bool isItv = false, isAddr = false;
for (u32_t i = 0; i < phi->getOpVarNum(); i++)
{
NodeID curId = phi->getOpVarID(i);
if (inVarToIValTable(curId))
{
const IntervalValue &cur = _es[curId];
if (!inVarToIValTable(res))
{
_es[res] = cur;
}
else
{
_es[res].join_with(cur);
}
rhsItv.join_with(_es[curId]);
isItv = true;
}
else if (inVarToAddrsTable(curId))
{
assert(!getVAddrs(curId).empty());
const VAddrs &cur = getVAddrs(curId);
if (!inVarToAddrsTable(res))
{
_es.getVAddrs(res) = cur;
}
else
{
_es.getVAddrs(res).join_with(cur);
}
}
rhsAddr.join_with(getVAddrs(curId));
isAddr = true;
} else {
// rhs not in the table
}
}
if (isItv) {
// res var is an integer
_es[res] = rhsItv;
} else if (isAddr) {
// res var is an address
_es.getVAddrs(res) = rhsAddr;
} else {
// rhs not in table
}
}

Expand Down
Loading