diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index f07291cc62c..80b7ca4f82d 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -1984,7 +1984,7 @@ public: }; template <> -struct OperandTraits : public OptionalOperandTraits<> { +struct OperandTraits : public VariadicOperandTraits<> { }; DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value) diff --git a/include/llvm/OperandTraits.h b/include/llvm/OperandTraits.h index 7c879c88f13..b614ccbc377 100644 --- a/include/llvm/OperandTraits.h +++ b/include/llvm/OperandTraits.h @@ -20,7 +20,7 @@ namespace llvm { //===----------------------------------------------------------------------===// -// FixedNumOperands Trait Class +// FixedNumOperand Trait Class //===----------------------------------------------------------------------===// /// FixedNumOperandTraits - determine the allocation regime of the Use array @@ -51,9 +51,12 @@ struct FixedNumOperandTraits { }; //===----------------------------------------------------------------------===// -// OptionalOperands Trait Class +// OptionalOperand Trait Class //===----------------------------------------------------------------------===// +/// OptionalOperandTraits - when the number of operands may change at runtime. +/// Naturally it may only decrease, because the allocations may not change. + template struct OptionalOperandTraits : public FixedNumOperandTraits { static unsigned operands(const User *U) { diff --git a/unittests/VMCore/InstructionsTest.cpp b/unittests/VMCore/InstructionsTest.cpp index 3823afc4429..15f894039f1 100644 --- a/unittests/VMCore/InstructionsTest.cpp +++ b/unittests/VMCore/InstructionsTest.cpp @@ -14,12 +14,12 @@ namespace llvm { namespace { -TEST(InstructionsTest, ReturnInst_0) { +TEST(InstructionsTest, ReturnInst) { LLVMContext &C(getGlobalContext()); - // reproduction recipe for PR6589 + // test for PR6589 const ReturnInst* r0 = ReturnInst::Create(C); - EXPECT_NE(r0->op_begin(), r0->op_end()); + EXPECT_EQ(r0->op_begin(), r0->op_end()); } } // end anonymous namespace