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 | df1913982b1d09b6cf01bc10f8ca97f50bb22a1b (patch) | |
tree | da8a4684b122595c6eeb22067226a0bb987bef7f /lib/IR | |
parent | 10ecbcbbf0babd0129ad066a51cbf948ff7a870c (diff) | |
download | llvm-df1913982b1d09b6cf01bc10f8ca97f50bb22a1b.tar.gz llvm-df1913982b1d09b6cf01bc10f8ca97f50bb22a1b.tar.bz2 llvm-df1913982b1d09b6cf01bc10f8ca97f50bb22a1b.tar.xz |
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().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210000 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r-- | lib/IR/Instruction.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/IR/Instruction.cpp b/lib/IR/Instruction.cpp index 28cc4cb9f1..6becc1e43e 100644 --- a/lib/IR/Instruction.cpp +++ b/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())) |