Skip to content

Commit c467946

Browse files
authored
[IR] Improve code in isIdenticalToWhenDefined (NFC) (llvm#151881)
Prefer llvm::equal() over std::equal().
1 parent 8a55d46 commit c467946

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/IR/Instruction.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -942,14 +942,13 @@ bool Instruction::isIdenticalToWhenDefined(const Instruction *I,
942942

943943
// We have two instructions of identical opcode and #operands. Check to see
944944
// if all operands are the same.
945-
if (!std::equal(op_begin(), op_end(), I->op_begin()))
945+
if (!equal(operands(), I->operands()))
946946
return false;
947947

948948
// WARNING: this logic must be kept in sync with EliminateDuplicatePHINodes()!
949-
if (const PHINode *thisPHI = dyn_cast<PHINode>(this)) {
950-
const PHINode *otherPHI = cast<PHINode>(I);
951-
return std::equal(thisPHI->block_begin(), thisPHI->block_end(),
952-
otherPHI->block_begin());
949+
if (const PHINode *Phi = dyn_cast<PHINode>(this)) {
950+
const PHINode *OtherPhi = cast<PHINode>(I);
951+
return equal(Phi->blocks(), OtherPhi->blocks());
953952
}
954953

955954
return this->hasSameSpecialState(I, /*IgnoreAlignment=*/false,

0 commit comments

Comments
 (0)