[llvm] r217749 - Fix DebugInfo replaceAllUsesWith.

Frederic Riss friss at apple.com
Mon Sep 15 00:50:43 PDT 2014


Author: friss
Date: Mon Sep 15 02:50:42 2014
New Revision: 217749

URL: http://llvm.org/viewvc/llvm-project?rev=217749&view=rev
Log:
Fix DebugInfo replaceAllUsesWith.

Summary:
replaceAllUsesWith had been modified to allow a DbgNode value to be
replaced by itself. In that case a new node is created by copying the
current DbgNode and the copy is used as replacement value.

When that copying happens, the value stored in this->DbgNode at the end
of RAUW would be a reference to the Node that has just been deleted.

This doesn't produce any bug right now, because the DI node on which we
call RAUW won't be used again.

Reviewers: dblaikie, echristo, aprantl

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5326

Modified:
    llvm/trunk/lib/IR/DebugInfo.cpp

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=217749&r1=217748&r2=217749&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Mon Sep 15 02:50:42 2014
@@ -384,7 +384,7 @@ void DIDescriptor::replaceAllUsesWith(LL
   const Value *V = cast_or_null<Value>(DN);
   Node->replaceAllUsesWith(const_cast<Value *>(V));
   MDNode::deleteTemporary(Node);
-  DbgNode = D;
+  DbgNode = DN;
 }
 
 /// replaceAllUsesWith - Replace all uses of the MDNode used by this





More information about the llvm-commits mailing list