Skip to content

Commit

Permalink
Instruction::isIdenticalToWhenDefined(): Check getNumOperands() in ad…
Browse files Browse the repository at this point in the history
…vance of std::equal(op) to appease MSVC Debug build.

MSVC Debug build is confused with (possibly invalid) op_begin(), if op_begin() == op_end().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210000 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chapuni committed Jun 2, 2014
1 parent 10ecbcb commit df19139
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/IR/Instruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ bool Instruction::isIdenticalToWhenDefined(const Instruction *I) const {
getType() != I->getType())
return false;

// If both instructions have no operands, they are identical.
if (getNumOperands() == 0 && I->getNumOperands() == 0)
return haveSameSpecialState(this, I);

// We have two instructions of identical opcode and #operands. Check to see
// if all operands are the same.
if (!std::equal(op_begin(), op_end(), I->op_begin()))
Expand Down

0 comments on commit df19139

Please sign in to comment.