Skip to content

Commit

Permalink
Add AtomicRMW to ICF
Browse files Browse the repository at this point in the history
  • Loading branch information
Maqrkk committed Nov 1, 2023
1 parent 29810e7 commit eebf577
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions llvm/lib/CheerpUtils/IdenticalCodeFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,15 @@ bool IdenticalCodeFolding::equivalentInstruction(const llvm::Instruction* A, con
equivalentOperand(A->getOperand(0), B->getOperand(0)) &&
equivalentOperand(A->getOperand(1), B->getOperand(1)));
}
case Instruction::AtomicRMW:
{
const AtomicRMWInst* a = cast<AtomicRMWInst>(A);
const AtomicRMWInst* b = cast<AtomicRMWInst>(B);
return CacheAndReturn(equivalentType(a->getType(), b->getType()) &&
a->getOperation() == b->getOperation() &&
equivalentOperand(a->getPointerOperand(), b->getPointerOperand()) &&
equivalentOperand(a->getValOperand(), b->getValOperand()));
}
default:
{
#ifndef NDEBUG
Expand Down

0 comments on commit eebf577

Please sign in to comment.