Convert StringMapEntry::Create to use StringRef instead of start/end pointers. Simpli...
[oota-llvm.git] / lib / IR / Instruction.cpp
index 28cc4cb9f136c4931fd0d1c791e29172b32f9bf5..6becc1e43e16ce6f44fa5a68390d8f37ca0b8001 100644 (file)
@@ -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()))