aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Instructions.h2
-rw-r--r--include/llvm/OperandTraits.h7
-rw-r--r--unittests/VMCore/InstructionsTest.cpp6
3 files changed, 9 insertions, 6 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index f07291cc62..80b7ca4f82 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -1984,7 +1984,7 @@ public:
};
template <>
-struct OperandTraits<ReturnInst> : public OptionalOperandTraits<> {
+struct OperandTraits<ReturnInst> : public VariadicOperandTraits<> {
};
DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ReturnInst, Value)
diff --git a/include/llvm/OperandTraits.h b/include/llvm/OperandTraits.h
index 7c879c88f1..b614ccbc37 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 <unsigned ARITY = 1>
struct OptionalOperandTraits : public FixedNumOperandTraits<ARITY> {
static unsigned operands(const User *U) {
diff --git a/unittests/VMCore/InstructionsTest.cpp b/unittests/VMCore/InstructionsTest.cpp
index 3823afc442..15f894039f 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