Skip to content

Commit

Permalink
WIP: SimpLL: inverse condition check users
Browse files Browse the repository at this point in the history
  • Loading branch information
PLukas2018 committed Nov 4, 2023
1 parent 1f09f9c commit 18946b5
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions diffkemp/simpll/DifferentialFunctionComparator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,28 @@ int DifferentialFunctionComparator::cmpOperations(
// It is sufficient to compare the predicates here since the
// operands are compared in cmpBasicBlocks.
if (CmpL->getPredicate() == CmpR->getInversePredicate()) {
PREP_LOG("inv-cond-add", L, R);
inverseConditions.emplace(L, R);
LOG_KEEP_FORCE(0);
return 0;
// TODO check users of cmp instructions
int canIgnore = 1;
for (auto user : CmpL->users()) {
// FIXME recursive
auto userInstruction = dyn_cast<Instruction>(user);
if (! (isa<BranchInst>(user) || isLogicalNot(userInstruction))) {
canIgnore = 0;
}
}
for (auto user : CmpR->users()) {
auto userInstruction = dyn_cast<Instruction>(user);
// FIXME recursive
if (! (isa<BranchInst>(user) || isLogicalNot(userInstruction))) {
canIgnore = 0;
}
}
if (canIgnore) {
PREP_LOG("inv-cond-add", L, R);
inverseConditions.emplace(L, R);
LOG_KEEP_FORCE(0);
return 0;
}
}
}
}
Expand Down

0 comments on commit 18946b5

Please sign in to comment.