diff options
| author | Bill Wendling <isanbard@gmail.com> | 2012-04-26 00:38:42 +0000 | 
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2012-04-26 00:38:42 +0000 | 
| commit | 0156f44a68c58ac945ca51242dce85d0bfcffa08 (patch) | |
| tree | 2a061f195957f98263f0e4e7a2f8016f8e60a1bb /llvm/lib/VMCore | |
| parent | 6ca73133ca7bf41a7c13646f1c150051a62d75ed (diff) | |
| download | bcm5719-llvm-0156f44a68c58ac945ca51242dce85d0bfcffa08.tar.gz bcm5719-llvm-0156f44a68c58ac945ca51242dce85d0bfcffa08.zip | |
Don't forget to reset 'first operand' flag when we're setting the MDNodeOperand value.
llvm-svn: 155599
Diffstat (limited to 'llvm/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/Metadata.cpp | 13 | 
1 files changed, 8 insertions, 5 deletions
| diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp index 090b09a4ccd..f018f44d0ba 100644 --- a/llvm/lib/VMCore/Metadata.cpp +++ b/llvm/lib/VMCore/Metadata.cpp @@ -66,7 +66,11 @@ public:    MDNodeOperand(Value *V) : CallbackVH(V) {}    ~MDNodeOperand() {} -  void set(Value *V) { this->setValPtr(V); } +  void set(Value *V) { +    unsigned IsFirst = this->getValPtrInt(); +    this->setValPtr(V); +    this->setAsFirstOperand(IsFirst); +  }    /// setAsFirstOperand - Accessor method to mark the operand as the first in    /// the list. @@ -95,7 +99,7 @@ void MDNodeOperand::allUsesReplacedWith(Value *NV) {  static MDNodeOperand *getOperandPtr(MDNode *N, unsigned Op) {    // Use <= instead of < to permit a one-past-the-end address.    assert(Op <= N->getNumOperands() && "Invalid operand number"); -  return reinterpret_cast<MDNodeOperand*>(N+1)+Op; +  return reinterpret_cast<MDNodeOperand*>(N + 1) + Op;  }  void MDNode::replaceOperandWith(unsigned i, Value *Val) { @@ -122,7 +126,6 @@ MDNode::MDNode(LLVMContext &C, ArrayRef<Value*> Vals, bool isFunctionLocal)    }  } -  /// ~MDNode - Destroy MDNode.  MDNode::~MDNode() {    assert((getSubclassDataFromValue() & DestroyFlag) != 0 && @@ -247,7 +250,7 @@ MDNode *MDNode::getMDNode(LLVMContext &Context, ArrayRef<Value*> Vals,    }    // Coallocate space for the node and Operands together, then placement new. -  void *Ptr = malloc(sizeof(MDNode)+Vals.size()*sizeof(MDNodeOperand)); +  void *Ptr = malloc(sizeof(MDNode) + Vals.size() * sizeof(MDNodeOperand));    N = new (Ptr) MDNode(Context, Vals, isFunctionLocal);    // Cache the operand hash. @@ -275,7 +278,7 @@ MDNode *MDNode::getIfExists(LLVMContext &Context, ArrayRef<Value*> Vals) {  MDNode *MDNode::getTemporary(LLVMContext &Context, ArrayRef<Value*> Vals) {    MDNode *N = -    (MDNode *)malloc(sizeof(MDNode)+Vals.size()*sizeof(MDNodeOperand)); +    (MDNode *)malloc(sizeof(MDNode) + Vals.size() * sizeof(MDNodeOperand));    N = new (N) MDNode(Context, Vals, FL_No);    N->setValueSubclassData(N->getSubclassDataFromValue() |                            NotUniquedBit); | 

