diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2014-06-02 01:35:34 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2014-06-02 01:35:34 +0000 |
commit | aaffd7060995c7679e9cb71bb4b941edd59b5b59 (patch) | |
tree | 31ebbe8ac0a6653e480eded084aa592da000eded /llvm/lib | |
parent | 0021013b0ab2c480ac1c00042ff83f7290af2d30 (diff) | |
download | bcm5719-llvm-aaffd7060995c7679e9cb71bb4b941edd59b5b59.tar.gz bcm5719-llvm-aaffd7060995c7679e9cb71bb4b941edd59b5b59.zip |
Instruction::isIdenticalToWhenDefined(): Check getNumOperands() in advance of std::equal(op) to appease MSVC Debug build.
MSVC Debug build is confused with (possibly invalid) op_begin(), if op_begin() == op_end().
llvm-svn: 210000
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/Instruction.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp index 28cc4cb9f13..6becc1e43e1 100644 --- a/llvm/lib/IR/Instruction.cpp +++ b/llvm/lib/IR/Instruction.cpp @@ -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())) |