[llvm] r202821 - [Modules] Move ValueHandle into the IR library where Value itself lives.

Chandler Carruth chandlerc at gmail.com
Tue Mar 4 03:17:45 PST 2014


Author: chandlerc
Date: Tue Mar  4 05:17:44 2014
New Revision: 202821

URL: http://llvm.org/viewvc/llvm-project?rev=202821&view=rev
Log:
[Modules] Move ValueHandle into the IR library where Value itself lives.

Move the test for this class into the IR unittests as well.

This uncovers that ValueMap too is in the IR library. Ironically, the
unittest for ValueMap is useless in the Support library (honestly, so
was the ValueHandle test) and so it already lives in the IR unittests.
Mmmm, tasty layering.

Added:
    llvm/trunk/include/llvm/IR/ValueHandle.h
      - copied, changed from r202818, llvm/trunk/include/llvm/Support/ValueHandle.h
    llvm/trunk/unittests/IR/ValueHandleTest.cpp
      - copied, changed from r202818, llvm/trunk/unittests/Support/ValueHandleTest.cpp
Removed:
    llvm/trunk/include/llvm/Support/ValueHandle.h
    llvm/trunk/unittests/Support/ValueHandleTest.cpp
Modified:
    llvm/trunk/include/llvm/ADT/ValueMap.h
    llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
    llvm/trunk/include/llvm/Analysis/CallGraph.h
    llvm/trunk/include/llvm/Analysis/IVUsers.h
    llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h
    llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
    llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
    llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h
    llvm/trunk/include/llvm/CodeGen/LexicalScopes.h
    llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
    llvm/trunk/include/llvm/DIBuilder.h
    llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
    llvm/trunk/include/llvm/IR/IRBuilder.h
    llvm/trunk/include/llvm/IR/Value.h
    llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
    llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
    llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h
    llvm/trunk/lib/Analysis/InstructionSimplify.cpp
    llvm/trunk/lib/Analysis/LazyValueInfo.cpp
    llvm/trunk/lib/AsmParser/LLParser.h
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
    llvm/trunk/lib/ExecutionEngine/EventListenerCommon.h
    llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
    llvm/trunk/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
    llvm/trunk/lib/ExecutionEngine/JIT/JIT.h
    llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
    llvm/trunk/lib/IR/DebugInfo.cpp
    llvm/trunk/lib/IR/LLVMContextImpl.h
    llvm/trunk/lib/IR/Metadata.cpp
    llvm/trunk/lib/IR/Value.cpp
    llvm/trunk/lib/Target/PowerPC/PPCCTRLoops.cpp
    llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp
    llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
    llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp
    llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
    llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
    llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
    llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
    llvm/trunk/lib/Transforms/Utils/Local.cpp
    llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
    llvm/trunk/unittests/IR/CMakeLists.txt
    llvm/trunk/unittests/IR/MetadataTest.cpp
    llvm/trunk/unittests/Support/CMakeLists.txt

Modified: llvm/trunk/include/llvm/ADT/ValueMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ValueMap.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/ValueMap.h (original)
+++ llvm/trunk/include/llvm/ADT/ValueMap.h Tue Mar  4 05:17:44 2014
@@ -27,8 +27,8 @@
 #define LLVM_ADT_VALUEMAP_H
 
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/Mutex.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/type_traits.h"
 #include <iterator>
 

Modified: llvm/trunk/include/llvm/Analysis/AliasSetTracker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AliasSetTracker.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AliasSetTracker.h (original)
+++ llvm/trunk/include/llvm/Analysis/AliasSetTracker.h Tue Mar  4 05:17:44 2014
@@ -20,7 +20,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/ilist.h"
 #include "llvm/ADT/ilist_node.h"
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/IR/ValueHandle.h"
 #include <vector>
 
 namespace llvm {

Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
+++ llvm/trunk/include/llvm/Analysis/CallGraph.h Tue Mar  4 05:17:44 2014
@@ -57,9 +57,9 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/IR/CallSite.h"
 #include "llvm/IR/Function.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/IncludeFile.h"
-#include "llvm/Support/ValueHandle.h"
 #include <map>
 
 namespace llvm {

Modified: llvm/trunk/include/llvm/Analysis/IVUsers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IVUsers.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/IVUsers.h (original)
+++ llvm/trunk/include/llvm/Analysis/IVUsers.h Tue Mar  4 05:17:44 2014
@@ -17,7 +17,7 @@
 
 #include "llvm/Analysis/LoopPass.h"
 #include "llvm/Analysis/ScalarEvolutionNormalization.h"
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/IR/ValueHandle.h"
 
 namespace llvm {
 

Modified: llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h (original)
+++ llvm/trunk/include/llvm/Analysis/MemoryBuiltins.h Tue Mar  4 05:17:44 2014
@@ -19,10 +19,10 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/InstVisitor.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/TargetFolder.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
 class CallInst;

Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h Tue Mar  4 05:17:44 2014
@@ -20,8 +20,8 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
   class Function;

Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Tue Mar  4 05:17:44 2014
@@ -26,11 +26,11 @@
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/ConstantRange.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/ValueHandle.h"
 #include <map>
 
 namespace llvm {

Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolutionExpander.h Tue Mar  4 05:17:44 2014
@@ -17,8 +17,8 @@
 #include "llvm/Analysis/ScalarEvolutionExpressions.h"
 #include "llvm/Analysis/ScalarEvolutionNormalization.h"
 #include "llvm/IR/IRBuilder.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/TargetFolder.h"
-#include "llvm/Support/ValueHandle.h"
 #include <set>
 
 namespace llvm {

Modified: llvm/trunk/include/llvm/CodeGen/LexicalScopes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LexicalScopes.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LexicalScopes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LexicalScopes.h Tue Mar  4 05:17:44 2014
@@ -22,8 +22,8 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/Metadata.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/DebugLoc.h"
-#include "llvm/Support/ValueHandle.h"
 #include <utility>
 namespace llvm {
 

Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Tue Mar  4 05:17:44 2014
@@ -36,13 +36,13 @@
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/Metadata.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MachineLocation.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/DataTypes.h"
 #include "llvm/Support/DebugLoc.h"
 #include "llvm/Support/Dwarf.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
 

Modified: llvm/trunk/include/llvm/DIBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DIBuilder.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DIBuilder.h (original)
+++ llvm/trunk/include/llvm/DIBuilder.h Tue Mar  4 05:17:44 2014
@@ -18,8 +18,8 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/DebugInfo.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
   class BasicBlock;

Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Tue Mar  4 05:17:44 2014
@@ -19,10 +19,10 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/ValueMap.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/MC/MCCodeGenInfo.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Mutex.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetOptions.h"
 #include <map>

Modified: llvm/trunk/include/llvm/IR/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRBuilder.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/IR/IRBuilder.h Tue Mar  4 05:17:44 2014
@@ -23,9 +23,9 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/CBindingWrapping.h"
 #include "llvm/Support/ConstantFolder.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
   class MDNode;

Modified: llvm/trunk/include/llvm/IR/Value.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Value.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Value.h (original)
+++ llvm/trunk/include/llvm/IR/Value.h Tue Mar  4 05:17:44 2014
@@ -61,7 +61,7 @@ typedef StringMapEntry<Value*> ValueName
 /// Every value has a "use list" that keeps track of which other Values are
 /// using this Value.  A Value can also have an arbitrary number of ValueHandle
 /// objects that watch it and listen to RAUW and Destroy events.  See
-/// llvm/Support/ValueHandle.h for details.
+/// llvm/IR/ValueHandle.h for details.
 ///
 /// @brief LLVM Value Representation
 class Value {

Copied: llvm/trunk/include/llvm/IR/ValueHandle.h (from r202818, llvm/trunk/include/llvm/Support/ValueHandle.h)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/ValueHandle.h?p2=llvm/trunk/include/llvm/IR/ValueHandle.h&p1=llvm/trunk/include/llvm/Support/ValueHandle.h&r1=202818&r2=202821&rev=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ValueHandle.h (original)
+++ llvm/trunk/include/llvm/IR/ValueHandle.h Tue Mar  4 05:17:44 2014
@@ -1,4 +1,4 @@
-//===- llvm/Support/ValueHandle.h - Value Smart Pointer classes -*- C++ -*-===//
+//===- ValueHandle.h - Value Smart Pointer classes --------------*- C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -11,8 +11,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_SUPPORT_VALUEHANDLE_H
-#define LLVM_SUPPORT_VALUEHANDLE_H
+#ifndef LLVM_IR_VALUEHANDLE_H
+#define LLVM_IR_VALUEHANDLE_H
 
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/PointerIntPair.h"

Removed: llvm/trunk/include/llvm/Support/ValueHandle.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ValueHandle.h?rev=202820&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/ValueHandle.h (original)
+++ llvm/trunk/include/llvm/Support/ValueHandle.h (removed)
@@ -1,380 +0,0 @@
-//===- llvm/Support/ValueHandle.h - Value Smart Pointer classes -*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the ValueHandle class and its sub-classes.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_VALUEHANDLE_H
-#define LLVM_SUPPORT_VALUEHANDLE_H
-
-#include "llvm/ADT/DenseMapInfo.h"
-#include "llvm/ADT/PointerIntPair.h"
-#include "llvm/IR/Value.h"
-
-namespace llvm {
-class ValueHandleBase;
-template<typename From> struct simplify_type;
-
-// ValueHandleBase** is only 4-byte aligned.
-template<>
-class PointerLikeTypeTraits<ValueHandleBase**> {
-public:
-  static inline void *getAsVoidPointer(ValueHandleBase** P) { return P; }
-  static inline ValueHandleBase **getFromVoidPointer(void *P) {
-    return static_cast<ValueHandleBase**>(P);
-  }
-  enum { NumLowBitsAvailable = 2 };
-};
-
-/// ValueHandleBase - This is the common base class of value handles.
-/// ValueHandle's are smart pointers to Value's that have special behavior when
-/// the value is deleted or ReplaceAllUsesWith'd.  See the specific handles
-/// below for details.
-///
-class ValueHandleBase {
-  friend class Value;
-protected:
-  /// HandleBaseKind - This indicates what sub class the handle actually is.
-  /// This is to avoid having a vtable for the light-weight handle pointers. The
-  /// fully general Callback version does have a vtable.
-  enum HandleBaseKind {
-    Assert,
-    Callback,
-    Tracking,
-    Weak
-  };
-
-private:
-  PointerIntPair<ValueHandleBase**, 2, HandleBaseKind> PrevPair;
-  ValueHandleBase *Next;
-
-  // A subclass may want to store some information along with the value
-  // pointer. Allow them to do this by making the value pointer a pointer-int
-  // pair. The 'setValPtrInt' and 'getValPtrInt' methods below give them this
-  // access.
-  PointerIntPair<Value*, 2> VP;
-
-  ValueHandleBase(const ValueHandleBase&) LLVM_DELETED_FUNCTION;
-public:
-  explicit ValueHandleBase(HandleBaseKind Kind)
-    : PrevPair(0, Kind), Next(0), VP(0, 0) {}
-  ValueHandleBase(HandleBaseKind Kind, Value *V)
-    : PrevPair(0, Kind), Next(0), VP(V, 0) {
-    if (isValid(VP.getPointer()))
-      AddToUseList();
-  }
-  ValueHandleBase(HandleBaseKind Kind, const ValueHandleBase &RHS)
-    : PrevPair(0, Kind), Next(0), VP(RHS.VP) {
-    if (isValid(VP.getPointer()))
-      AddToExistingUseList(RHS.getPrevPtr());
-  }
-  ~ValueHandleBase() {
-    if (isValid(VP.getPointer()))
-      RemoveFromUseList();
-  }
-
-  Value *operator=(Value *RHS) {
-    if (VP.getPointer() == RHS) return RHS;
-    if (isValid(VP.getPointer())) RemoveFromUseList();
-    VP.setPointer(RHS);
-    if (isValid(VP.getPointer())) AddToUseList();
-    return RHS;
-  }
-
-  Value *operator=(const ValueHandleBase &RHS) {
-    if (VP.getPointer() == RHS.VP.getPointer()) return RHS.VP.getPointer();
-    if (isValid(VP.getPointer())) RemoveFromUseList();
-    VP.setPointer(RHS.VP.getPointer());
-    if (isValid(VP.getPointer())) AddToExistingUseList(RHS.getPrevPtr());
-    return VP.getPointer();
-  }
-
-  Value *operator->() const { return getValPtr(); }
-  Value &operator*() const { return *getValPtr(); }
-
-protected:
-  Value *getValPtr() const { return VP.getPointer(); }
-
-  void setValPtrInt(unsigned K) { VP.setInt(K); }
-  unsigned getValPtrInt() const { return VP.getInt(); }
-
-  static bool isValid(Value *V) {
-    return V &&
-           V != DenseMapInfo<Value *>::getEmptyKey() &&
-           V != DenseMapInfo<Value *>::getTombstoneKey();
-  }
-
-public:
-  // Callbacks made from Value.
-  static void ValueIsDeleted(Value *V);
-  static void ValueIsRAUWd(Value *Old, Value *New);
-
-private:
-  // Internal implementation details.
-  ValueHandleBase **getPrevPtr() const { return PrevPair.getPointer(); }
-  HandleBaseKind getKind() const { return PrevPair.getInt(); }
-  void setPrevPtr(ValueHandleBase **Ptr) { PrevPair.setPointer(Ptr); }
-
-  /// AddToExistingUseList - Add this ValueHandle to the use list for VP, where
-  /// List is the address of either the head of the list or a Next node within
-  /// the existing use list.
-  void AddToExistingUseList(ValueHandleBase **List);
-
-  /// AddToExistingUseListAfter - Add this ValueHandle to the use list after
-  /// Node.
-  void AddToExistingUseListAfter(ValueHandleBase *Node);
-
-  /// AddToUseList - Add this ValueHandle to the use list for VP.
-  void AddToUseList();
-  /// RemoveFromUseList - Remove this ValueHandle from its current use list.
-  void RemoveFromUseList();
-};
-
-/// WeakVH - This is a value handle that tries hard to point to a Value, even
-/// across RAUW operations, but will null itself out if the value is destroyed.
-/// this is useful for advisory sorts of information, but should not be used as
-/// the key of a map (since the map would have to rearrange itself when the
-/// pointer changes).
-class WeakVH : public ValueHandleBase {
-public:
-  WeakVH() : ValueHandleBase(Weak) {}
-  WeakVH(Value *P) : ValueHandleBase(Weak, P) {}
-  WeakVH(const WeakVH &RHS)
-    : ValueHandleBase(Weak, RHS) {}
-
-  Value *operator=(Value *RHS) {
-    return ValueHandleBase::operator=(RHS);
-  }
-  Value *operator=(const ValueHandleBase &RHS) {
-    return ValueHandleBase::operator=(RHS);
-  }
-
-  operator Value*() const {
-    return getValPtr();
-  }
-};
-
-// Specialize simplify_type to allow WeakVH to participate in
-// dyn_cast, isa, etc.
-template<> struct simplify_type<WeakVH> {
-  typedef Value* SimpleType;
-  static SimpleType getSimplifiedValue(WeakVH &WVH) {
-    return WVH;
-  }
-};
-
-/// AssertingVH - This is a Value Handle that points to a value and asserts out
-/// if the value is destroyed while the handle is still live.  This is very
-/// useful for catching dangling pointer bugs and other things which can be
-/// non-obvious.  One particularly useful place to use this is as the Key of a
-/// map.  Dangling pointer bugs often lead to really subtle bugs that only occur
-/// if another object happens to get allocated to the same address as the old
-/// one.  Using an AssertingVH ensures that an assert is triggered as soon as
-/// the bad delete occurs.
-///
-/// Note that an AssertingVH handle does *not* follow values across RAUW
-/// operations.  This means that RAUW's need to explicitly update the
-/// AssertingVH's as it moves.  This is required because in non-assert mode this
-/// class turns into a trivial wrapper around a pointer.
-template <typename ValueTy>
-class AssertingVH
-#ifndef NDEBUG
-  : public ValueHandleBase
-#endif
-  {
-
-#ifndef NDEBUG
-  ValueTy *getValPtr() const {
-    return static_cast<ValueTy*>(ValueHandleBase::getValPtr());
-  }
-  void setValPtr(ValueTy *P) {
-    ValueHandleBase::operator=(GetAsValue(P));
-  }
-#else
-  ValueTy *ThePtr;
-  ValueTy *getValPtr() const { return ThePtr; }
-  void setValPtr(ValueTy *P) { ThePtr = P; }
-#endif
-
-  // Convert a ValueTy*, which may be const, to the type the base
-  // class expects.
-  static Value *GetAsValue(Value *V) { return V; }
-  static Value *GetAsValue(const Value *V) { return const_cast<Value*>(V); }
-
-public:
-#ifndef NDEBUG
-  AssertingVH() : ValueHandleBase(Assert) {}
-  AssertingVH(ValueTy *P) : ValueHandleBase(Assert, GetAsValue(P)) {}
-  AssertingVH(const AssertingVH &RHS) : ValueHandleBase(Assert, RHS) {}
-#else
-  AssertingVH() : ThePtr(0) {}
-  AssertingVH(ValueTy *P) : ThePtr(P) {}
-#endif
-
-  operator ValueTy*() const {
-    return getValPtr();
-  }
-
-  ValueTy *operator=(ValueTy *RHS) {
-    setValPtr(RHS);
-    return getValPtr();
-  }
-  ValueTy *operator=(const AssertingVH<ValueTy> &RHS) {
-    setValPtr(RHS.getValPtr());
-    return getValPtr();
-  }
-
-  ValueTy *operator->() const { return getValPtr(); }
-  ValueTy &operator*() const { return *getValPtr(); }
-};
-
-// Specialize DenseMapInfo to allow AssertingVH to participate in DenseMap.
-template<typename T>
-struct DenseMapInfo<AssertingVH<T> > {
-  typedef DenseMapInfo<T*> PointerInfo;
-  static inline AssertingVH<T> getEmptyKey() {
-    return AssertingVH<T>(PointerInfo::getEmptyKey());
-  }
-  static inline T* getTombstoneKey() {
-    return AssertingVH<T>(PointerInfo::getTombstoneKey());
-  }
-  static unsigned getHashValue(const AssertingVH<T> &Val) {
-    return PointerInfo::getHashValue(Val);
-  }
-  static bool isEqual(const AssertingVH<T> &LHS, const AssertingVH<T> &RHS) {
-    return LHS == RHS;
-  }
-};
-  
-template <typename T>
-struct isPodLike<AssertingVH<T> > {
-#ifdef NDEBUG
-  static const bool value = true;
-#else
-  static const bool value = false;
-#endif
-};
-
-
-/// TrackingVH - This is a value handle that tracks a Value (or Value subclass),
-/// even across RAUW operations.
-///
-/// TrackingVH is designed for situations where a client needs to hold a handle
-/// to a Value (or subclass) across some operations which may move that value,
-/// but should never destroy it or replace it with some unacceptable type.
-///
-/// It is an error to do anything with a TrackingVH whose value has been
-/// destroyed, except to destruct it.
-///
-/// It is an error to attempt to replace a value with one of a type which is
-/// incompatible with any of its outstanding TrackingVHs.
-template<typename ValueTy>
-class TrackingVH : public ValueHandleBase {
-  void CheckValidity() const {
-    Value *VP = ValueHandleBase::getValPtr();
-
-    // Null is always ok.
-    if (!VP) return;
-
-    // Check that this value is valid (i.e., it hasn't been deleted). We
-    // explicitly delay this check until access to avoid requiring clients to be
-    // unnecessarily careful w.r.t. destruction.
-    assert(ValueHandleBase::isValid(VP) && "Tracked Value was deleted!");
-
-    // Check that the value is a member of the correct subclass. We would like
-    // to check this property on assignment for better debugging, but we don't
-    // want to require a virtual interface on this VH. Instead we allow RAUW to
-    // replace this value with a value of an invalid type, and check it here.
-    assert(isa<ValueTy>(VP) &&
-           "Tracked Value was replaced by one with an invalid type!");
-  }
-
-  ValueTy *getValPtr() const {
-    CheckValidity();
-    return (ValueTy*)ValueHandleBase::getValPtr();
-  }
-  void setValPtr(ValueTy *P) {
-    CheckValidity();
-    ValueHandleBase::operator=(GetAsValue(P));
-  }
-
-  // Convert a ValueTy*, which may be const, to the type the base
-  // class expects.
-  static Value *GetAsValue(Value *V) { return V; }
-  static Value *GetAsValue(const Value *V) { return const_cast<Value*>(V); }
-
-public:
-  TrackingVH() : ValueHandleBase(Tracking) {}
-  TrackingVH(ValueTy *P) : ValueHandleBase(Tracking, GetAsValue(P)) {}
-  TrackingVH(const TrackingVH &RHS) : ValueHandleBase(Tracking, RHS) {}
-
-  operator ValueTy*() const {
-    return getValPtr();
-  }
-
-  ValueTy *operator=(ValueTy *RHS) {
-    setValPtr(RHS);
-    return getValPtr();
-  }
-  ValueTy *operator=(const TrackingVH<ValueTy> &RHS) {
-    setValPtr(RHS.getValPtr());
-    return getValPtr();
-  }
-
-  ValueTy *operator->() const { return getValPtr(); }
-  ValueTy &operator*() const { return *getValPtr(); }
-};
-
-/// CallbackVH - This is a value handle that allows subclasses to define
-/// callbacks that run when the underlying Value has RAUW called on it or is
-/// destroyed.  This class can be used as the key of a map, as long as the user
-/// takes it out of the map before calling setValPtr() (since the map has to
-/// rearrange itself when the pointer changes).  Unlike ValueHandleBase, this
-/// class has a vtable and a virtual destructor.
-class CallbackVH : public ValueHandleBase {
-  virtual void anchor();
-protected:
-  CallbackVH(const CallbackVH &RHS)
-    : ValueHandleBase(Callback, RHS) {}
-
-  virtual ~CallbackVH() {}
-
-  void setValPtr(Value *P) {
-    ValueHandleBase::operator=(P);
-  }
-
-public:
-  CallbackVH() : ValueHandleBase(Callback) {}
-  CallbackVH(Value *P) : ValueHandleBase(Callback, P) {}
-
-  operator Value*() const {
-    return getValPtr();
-  }
-
-  /// Called when this->getValPtr() is destroyed, inside ~Value(), so you may
-  /// call any non-virtual Value method on getValPtr(), but no subclass methods.
-  /// If WeakVH were implemented as a CallbackVH, it would use this method to
-  /// call setValPtr(NULL).  AssertingVH would use this method to cause an
-  /// assertion failure.
-  ///
-  /// All implementations must remove the reference from this object to the
-  /// Value that's being destroyed.
-  virtual void deleted() { setValPtr(NULL); }
-
-  /// Called when this->getValPtr()->replaceAllUsesWith(new_value) is called,
-  /// _before_ any of the uses have actually been replaced.  If WeakVH were
-  /// implemented as a CallbackVH, it would use this method to call
-  /// setValPtr(new_value).  AssertingVH would do nothing in this method.
-  virtual void allUsesReplacedWith(Value *) {}
-};
-
-} // End llvm namespace
-
-#endif

Modified: llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Cloning.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/Cloning.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/Cloning.h Tue Mar  4 05:17:44 2014
@@ -21,7 +21,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/ValueMap.h"
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
 
 namespace llvm {

Modified: llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterImpl.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterImpl.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/SSAUpdaterImpl.h Tue Mar  4 05:17:44 2014
@@ -17,9 +17,9 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
 

Modified: llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/SimplifyIndVar.h Tue Mar  4 05:17:44 2014
@@ -16,8 +16,8 @@
 #ifndef LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H
 #define LLVM_TRANSFORMS_UTILS_SIMPLIFYINDVAR_H
 
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
 

Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Tue Mar  4 05:17:44 2014
@@ -30,8 +30,8 @@
 #include "llvm/IR/GlobalAlias.h"
 #include "llvm/IR/Operator.h"
 #include "llvm/IR/PatternMatch.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/ConstantRange.h"
-#include "llvm/Support/ValueHandle.h"
 using namespace llvm;
 using namespace llvm::PatternMatch;
 

Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Tue Mar  4 05:17:44 2014
@@ -23,10 +23,10 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/PatternMatch.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/ConstantRange.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetLibraryInfo.h"
 #include <map>

Modified: llvm/trunk/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.h (original)
+++ llvm/trunk/lib/AsmParser/LLParser.h Tue Mar  4 05:17:44 2014
@@ -22,7 +22,7 @@
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Operator.h"
 #include "llvm/IR/Type.h"
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/IR/ValueHandle.h"
 #include <map>
 
 namespace llvm {

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h Tue Mar  4 05:17:44 2014
@@ -21,7 +21,7 @@
 #include "llvm/IR/Attributes.h"
 #include "llvm/IR/OperandTraits.h"
 #include "llvm/IR/Type.h"
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/system_error.h"
 #include <vector>
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Mar  4 05:17:44 2014
@@ -29,6 +29,7 @@
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCStreamer.h"
@@ -42,7 +43,6 @@
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Timer.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Target/TargetFrameLowering.h"
 #include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetMachine.h"

Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Tue Mar  4 05:17:44 2014
@@ -32,10 +32,10 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/PatternMatch.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetLibraryInfo.h"
 #include "llvm/Target/TargetLowering.h"

Modified: llvm/trunk/lib/ExecutionEngine/EventListenerCommon.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/EventListenerCommon.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/EventListenerCommon.h (original)
+++ llvm/trunk/lib/ExecutionEngine/EventListenerCommon.h Tue Mar  4 05:17:44 2014
@@ -17,8 +17,8 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/DebugInfo.h"
 #include "llvm/IR/Metadata.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
 

Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Tue Mar  4 05:17:44 2014
@@ -24,13 +24,13 @@
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/MutexGuard.h"
 #include "llvm/Support/TargetRegistry.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
 #include <cmath>

Modified: llvm/trunk/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp Tue Mar  4 05:17:44 2014
@@ -28,7 +28,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/Errno.h"
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/IR/ValueHandle.h"
 #include "EventListenerCommon.h"
 #include "IntelJITEventsWrapper.h"
 

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.h (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.h Tue Mar  4 05:17:44 2014
@@ -15,8 +15,8 @@
 #define JIT_H
 
 #include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/PassManager.h"
-#include "llvm/Support/ValueHandle.h"
 
 namespace llvm {
 

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Tue Mar  4 05:17:44 2014
@@ -35,13 +35,13 @@
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Disassembler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Memory.h"
 #include "llvm/Support/MutexGuard.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetInstrInfo.h"
 #include "llvm/Target/TargetJITInfo.h"

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Tue Mar  4 05:17:44 2014
@@ -24,9 +24,9 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Intrinsics.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Dwarf.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 using namespace llvm::dwarf;

Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.h Tue Mar  4 05:17:44 2014
@@ -30,7 +30,7 @@
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Metadata.h"
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/IR/ValueHandle.h"
 #include <vector>
 
 namespace llvm {

Modified: llvm/trunk/lib/IR/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Metadata.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Metadata.cpp (original)
+++ llvm/trunk/lib/IR/Metadata.cpp Tue Mar  4 05:17:44 2014
@@ -22,9 +22,9 @@
 #include "llvm/IR/Instruction.h"
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/ConstantRange.h"
 #include "llvm/Support/LeakDetector.h"
-#include "llvm/Support/ValueHandle.h"
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//

Modified: llvm/trunk/lib/IR/Value.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Value.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Value.cpp (original)
+++ llvm/trunk/lib/IR/Value.cpp Tue Mar  4 05:17:44 2014
@@ -23,12 +23,12 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/IR/ValueSymbolTable.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/LeakDetector.h"
 #include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/ValueHandle.h"
 #include <algorithm>
 using namespace llvm;
 

Modified: llvm/trunk/lib/Target/PowerPC/PPCCTRLoops.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCCTRLoops.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCCTRLoops.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCCTRLoops.cpp Tue Mar  4 05:17:44 2014
@@ -39,10 +39,10 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/PassSupport.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetLibraryInfo.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"

Modified: llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreLowerThreadLocal.cpp Tue Mar  4 05:17:44 2014
@@ -20,10 +20,10 @@
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Intrinsics.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/NoFolder.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 
 #define DEBUG_TYPE "xcore-lower-thread-local"

Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Tue Mar  4 05:17:44 2014
@@ -32,11 +32,11 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetLibraryInfo.h"
 #include "llvm/Transforms/Utils/GlobalStatus.h"

Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Tue Mar  4 05:17:44 2014
@@ -59,10 +59,10 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include <vector>
 using namespace llvm;

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Tue Mar  4 05:17:44 2014
@@ -47,10 +47,10 @@
 #include "llvm/IR/GetElementPtrTypeIterator.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/PatternMatch.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Target/TargetLibraryInfo.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include <algorithm>

Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Tue Mar  4 05:17:44 2014
@@ -27,10 +27,10 @@
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetLibraryInfo.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Mar  4 05:17:44 2014
@@ -68,9 +68,9 @@
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Utils/Local.h"

Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Tue Mar  4 05:17:44 2014
@@ -33,10 +33,10 @@
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include <algorithm>

Modified: llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp Tue Mar  4 05:17:44 2014
@@ -67,10 +67,10 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
 #include "llvm/Transforms/Utils/Local.h"

Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Tue Mar  4 05:17:44 2014
@@ -24,8 +24,8 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Type.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include <algorithm>

Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Tue Mar  4 05:17:44 2014
@@ -36,10 +36,10 @@
 #include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/MathExtras.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 

Modified: llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp Tue Mar  4 05:17:44 2014
@@ -41,10 +41,10 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/Type.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Utils/Local.h"
 #include <algorithm>

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Tue Mar  4 05:17:44 2014
@@ -78,12 +78,12 @@
 #include "llvm/IR/PatternMatch.h"
 #include "llvm/IR/Type.h"
 #include "llvm/IR/Value.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/IR/Verifier.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/BranchProbability.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetLibraryInfo.h"
 #include "llvm/Transforms/Scalar.h"

Modified: llvm/trunk/unittests/IR/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/CMakeLists.txt?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/CMakeLists.txt (original)
+++ llvm/trunk/unittests/IR/CMakeLists.txt Tue Mar  4 05:17:44 2014
@@ -19,6 +19,7 @@ set(IRSources
   PatternMatch.cpp
   TypeBuilderTest.cpp
   TypesTest.cpp
+  ValueHandleTest.cpp
   ValueMapTest.cpp
   ValueTest.cpp
   VerifierTest.cpp

Modified: llvm/trunk/unittests/IR/MetadataTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/MetadataTest.cpp?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/MetadataTest.cpp (original)
+++ llvm/trunk/unittests/IR/MetadataTest.cpp Tue Mar  4 05:17:44 2014
@@ -13,7 +13,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Type.h"
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/Support/raw_ostream.h"
 #include "gtest/gtest.h"
 using namespace llvm;

Copied: llvm/trunk/unittests/IR/ValueHandleTest.cpp (from r202818, llvm/trunk/unittests/Support/ValueHandleTest.cpp)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ValueHandleTest.cpp?p2=llvm/trunk/unittests/IR/ValueHandleTest.cpp&p1=llvm/trunk/unittests/Support/ValueHandleTest.cpp&r1=202818&r2=202821&rev=202821&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/ValueHandleTest.cpp (original)
+++ llvm/trunk/unittests/IR/ValueHandleTest.cpp Tue Mar  4 05:17:44 2014
@@ -1,4 +1,4 @@
-//===- llvm/unittest/Support/ValueHandleTest.cpp - ValueHandle tests --------===//
+//===- ValueHandleTest.cpp - ValueHandle tests ----------------------------===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Support/ValueHandle.h"
+#include "llvm/IR/ValueHandle.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Instructions.h"

Modified: llvm/trunk/unittests/Support/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CMakeLists.txt?rev=202821&r1=202820&r2=202821&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Support/CMakeLists.txt Tue Mar  4 05:17:44 2014
@@ -35,7 +35,6 @@ add_llvm_unittest(SupportTests
   ThreadLocalTest.cpp
   TimeValueTest.cpp
   UnicodeTest.cpp
-  ValueHandleTest.cpp
   YAMLIOTest.cpp
   YAMLParserTest.cpp
   formatted_raw_ostream_test.cpp

Removed: llvm/trunk/unittests/Support/ValueHandleTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ValueHandleTest.cpp?rev=202820&view=auto
==============================================================================
--- llvm/trunk/unittests/Support/ValueHandleTest.cpp (original)
+++ llvm/trunk/unittests/Support/ValueHandleTest.cpp (removed)
@@ -1,408 +0,0 @@
-//===- llvm/unittest/Support/ValueHandleTest.cpp - ValueHandle tests --------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/ValueHandle.h"
-#include "llvm/ADT/OwningPtr.h"
-#include "llvm/IR/Constants.h"
-#include "llvm/IR/Instructions.h"
-#include "llvm/IR/LLVMContext.h"
-#include "gtest/gtest.h"
-#include <memory>
-
-using namespace llvm;
-
-namespace {
-
-class ValueHandle : public testing::Test {
-protected:
-  Constant *ConstantV;
-  std::auto_ptr<BitCastInst> BitcastV;
-
-  ValueHandle() :
-    ConstantV(ConstantInt::get(Type::getInt32Ty(getGlobalContext()), 0)),
-    BitcastV(new BitCastInst(ConstantV, Type::getInt32Ty(getGlobalContext()))) {
-  }
-};
-
-class ConcreteCallbackVH : public CallbackVH {
-public:
-  ConcreteCallbackVH(Value *V) : CallbackVH(V) {}
-};
-
-TEST_F(ValueHandle, WeakVH_BasicOperation) {
-  WeakVH WVH(BitcastV.get());
-  EXPECT_EQ(BitcastV.get(), WVH);
-  WVH = ConstantV;
-  EXPECT_EQ(ConstantV, WVH);
-
-  // Make sure I can call a method on the underlying Value.  It
-  // doesn't matter which method.
-  EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), WVH->getType());
-  EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), (*WVH).getType());
-}
-
-TEST_F(ValueHandle, WeakVH_Comparisons) {
-  WeakVH BitcastWVH(BitcastV.get());
-  WeakVH ConstantWVH(ConstantV);
-
-  EXPECT_TRUE(BitcastWVH == BitcastWVH);
-  EXPECT_TRUE(BitcastV.get() == BitcastWVH);
-  EXPECT_TRUE(BitcastWVH == BitcastV.get());
-  EXPECT_FALSE(BitcastWVH == ConstantWVH);
-
-  EXPECT_TRUE(BitcastWVH != ConstantWVH);
-  EXPECT_TRUE(BitcastV.get() != ConstantWVH);
-  EXPECT_TRUE(BitcastWVH != ConstantV);
-  EXPECT_FALSE(BitcastWVH != BitcastWVH);
-
-  // Cast to Value* so comparisons work.
-  Value *BV = BitcastV.get();
-  Value *CV = ConstantV;
-  EXPECT_EQ(BV < CV, BitcastWVH < ConstantWVH);
-  EXPECT_EQ(BV <= CV, BitcastWVH <= ConstantWVH);
-  EXPECT_EQ(BV > CV, BitcastWVH > ConstantWVH);
-  EXPECT_EQ(BV >= CV, BitcastWVH >= ConstantWVH);
-
-  EXPECT_EQ(BV < CV, BitcastV.get() < ConstantWVH);
-  EXPECT_EQ(BV <= CV, BitcastV.get() <= ConstantWVH);
-  EXPECT_EQ(BV > CV, BitcastV.get() > ConstantWVH);
-  EXPECT_EQ(BV >= CV, BitcastV.get() >= ConstantWVH);
-
-  EXPECT_EQ(BV < CV, BitcastWVH < ConstantV);
-  EXPECT_EQ(BV <= CV, BitcastWVH <= ConstantV);
-  EXPECT_EQ(BV > CV, BitcastWVH > ConstantV);
-  EXPECT_EQ(BV >= CV, BitcastWVH >= ConstantV);
-}
-
-TEST_F(ValueHandle, WeakVH_FollowsRAUW) {
-  WeakVH WVH(BitcastV.get());
-  WeakVH WVH_Copy(WVH);
-  WeakVH WVH_Recreated(BitcastV.get());
-  BitcastV->replaceAllUsesWith(ConstantV);
-  EXPECT_EQ(ConstantV, WVH);
-  EXPECT_EQ(ConstantV, WVH_Copy);
-  EXPECT_EQ(ConstantV, WVH_Recreated);
-}
-
-TEST_F(ValueHandle, WeakVH_NullOnDeletion) {
-  WeakVH WVH(BitcastV.get());
-  WeakVH WVH_Copy(WVH);
-  WeakVH WVH_Recreated(BitcastV.get());
-  BitcastV.reset();
-  Value *null_value = NULL;
-  EXPECT_EQ(null_value, WVH);
-  EXPECT_EQ(null_value, WVH_Copy);
-  EXPECT_EQ(null_value, WVH_Recreated);
-}
-
-
-TEST_F(ValueHandle, AssertingVH_BasicOperation) {
-  AssertingVH<CastInst> AVH(BitcastV.get());
-  CastInst *implicit_to_exact_type = AVH;
-  (void)implicit_to_exact_type;  // Avoid warning.
-
-  AssertingVH<Value> GenericAVH(BitcastV.get());
-  EXPECT_EQ(BitcastV.get(), GenericAVH);
-  GenericAVH = ConstantV;
-  EXPECT_EQ(ConstantV, GenericAVH);
-
-  // Make sure I can call a method on the underlying CastInst.  It
-  // doesn't matter which method.
-  EXPECT_FALSE(AVH->mayWriteToMemory());
-  EXPECT_FALSE((*AVH).mayWriteToMemory());
-}
-
-TEST_F(ValueHandle, AssertingVH_Const) {
-  const CastInst *ConstBitcast = BitcastV.get();
-  AssertingVH<const CastInst> AVH(ConstBitcast);
-  const CastInst *implicit_to_exact_type = AVH;
-  (void)implicit_to_exact_type;  // Avoid warning.
-}
-
-TEST_F(ValueHandle, AssertingVH_Comparisons) {
-  AssertingVH<Value> BitcastAVH(BitcastV.get());
-  AssertingVH<Value> ConstantAVH(ConstantV);
-
-  EXPECT_TRUE(BitcastAVH == BitcastAVH);
-  EXPECT_TRUE(BitcastV.get() == BitcastAVH);
-  EXPECT_TRUE(BitcastAVH == BitcastV.get());
-  EXPECT_FALSE(BitcastAVH == ConstantAVH);
-
-  EXPECT_TRUE(BitcastAVH != ConstantAVH);
-  EXPECT_TRUE(BitcastV.get() != ConstantAVH);
-  EXPECT_TRUE(BitcastAVH != ConstantV);
-  EXPECT_FALSE(BitcastAVH != BitcastAVH);
-
-  // Cast to Value* so comparisons work.
-  Value *BV = BitcastV.get();
-  Value *CV = ConstantV;
-  EXPECT_EQ(BV < CV, BitcastAVH < ConstantAVH);
-  EXPECT_EQ(BV <= CV, BitcastAVH <= ConstantAVH);
-  EXPECT_EQ(BV > CV, BitcastAVH > ConstantAVH);
-  EXPECT_EQ(BV >= CV, BitcastAVH >= ConstantAVH);
-
-  EXPECT_EQ(BV < CV, BitcastV.get() < ConstantAVH);
-  EXPECT_EQ(BV <= CV, BitcastV.get() <= ConstantAVH);
-  EXPECT_EQ(BV > CV, BitcastV.get() > ConstantAVH);
-  EXPECT_EQ(BV >= CV, BitcastV.get() >= ConstantAVH);
-
-  EXPECT_EQ(BV < CV, BitcastAVH < ConstantV);
-  EXPECT_EQ(BV <= CV, BitcastAVH <= ConstantV);
-  EXPECT_EQ(BV > CV, BitcastAVH > ConstantV);
-  EXPECT_EQ(BV >= CV, BitcastAVH >= ConstantV);
-}
-
-TEST_F(ValueHandle, AssertingVH_DoesNotFollowRAUW) {
-  AssertingVH<Value> AVH(BitcastV.get());
-  BitcastV->replaceAllUsesWith(ConstantV);
-  EXPECT_EQ(BitcastV.get(), AVH);
-}
-
-#ifdef NDEBUG
-
-TEST_F(ValueHandle, AssertingVH_ReducesToPointer) {
-  EXPECT_EQ(sizeof(CastInst *), sizeof(AssertingVH<CastInst>));
-}
-
-#else  // !NDEBUG
-
-#ifdef GTEST_HAS_DEATH_TEST
-
-TEST_F(ValueHandle, AssertingVH_Asserts) {
-  AssertingVH<Value> AVH(BitcastV.get());
-  EXPECT_DEATH({BitcastV.reset();},
-               "An asserting value handle still pointed to this value!");
-  AssertingVH<Value> Copy(AVH);
-  AVH = NULL;
-  EXPECT_DEATH({BitcastV.reset();},
-               "An asserting value handle still pointed to this value!");
-  Copy = NULL;
-  BitcastV.reset();
-}
-
-#endif  // GTEST_HAS_DEATH_TEST
-
-#endif  // NDEBUG
-
-TEST_F(ValueHandle, CallbackVH_BasicOperation) {
-  ConcreteCallbackVH CVH(BitcastV.get());
-  EXPECT_EQ(BitcastV.get(), CVH);
-  CVH = ConstantV;
-  EXPECT_EQ(ConstantV, CVH);
-
-  // Make sure I can call a method on the underlying Value.  It
-  // doesn't matter which method.
-  EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), CVH->getType());
-  EXPECT_EQ(Type::getInt32Ty(getGlobalContext()), (*CVH).getType());
-}
-
-TEST_F(ValueHandle, CallbackVH_Comparisons) {
-  ConcreteCallbackVH BitcastCVH(BitcastV.get());
-  ConcreteCallbackVH ConstantCVH(ConstantV);
-
-  EXPECT_TRUE(BitcastCVH == BitcastCVH);
-  EXPECT_TRUE(BitcastV.get() == BitcastCVH);
-  EXPECT_TRUE(BitcastCVH == BitcastV.get());
-  EXPECT_FALSE(BitcastCVH == ConstantCVH);
-
-  EXPECT_TRUE(BitcastCVH != ConstantCVH);
-  EXPECT_TRUE(BitcastV.get() != ConstantCVH);
-  EXPECT_TRUE(BitcastCVH != ConstantV);
-  EXPECT_FALSE(BitcastCVH != BitcastCVH);
-
-  // Cast to Value* so comparisons work.
-  Value *BV = BitcastV.get();
-  Value *CV = ConstantV;
-  EXPECT_EQ(BV < CV, BitcastCVH < ConstantCVH);
-  EXPECT_EQ(BV <= CV, BitcastCVH <= ConstantCVH);
-  EXPECT_EQ(BV > CV, BitcastCVH > ConstantCVH);
-  EXPECT_EQ(BV >= CV, BitcastCVH >= ConstantCVH);
-
-  EXPECT_EQ(BV < CV, BitcastV.get() < ConstantCVH);
-  EXPECT_EQ(BV <= CV, BitcastV.get() <= ConstantCVH);
-  EXPECT_EQ(BV > CV, BitcastV.get() > ConstantCVH);
-  EXPECT_EQ(BV >= CV, BitcastV.get() >= ConstantCVH);
-
-  EXPECT_EQ(BV < CV, BitcastCVH < ConstantV);
-  EXPECT_EQ(BV <= CV, BitcastCVH <= ConstantV);
-  EXPECT_EQ(BV > CV, BitcastCVH > ConstantV);
-  EXPECT_EQ(BV >= CV, BitcastCVH >= ConstantV);
-}
-
-TEST_F(ValueHandle, CallbackVH_CallbackOnDeletion) {
-  class RecordingVH : public CallbackVH {
-  public:
-    int DeletedCalls;
-    int AURWCalls;
-
-    RecordingVH() : DeletedCalls(0), AURWCalls(0) {}
-    RecordingVH(Value *V) : CallbackVH(V), DeletedCalls(0), AURWCalls(0) {}
-
-  private:
-    virtual void deleted() { DeletedCalls++; CallbackVH::deleted(); }
-    virtual void allUsesReplacedWith(Value *) { AURWCalls++; }
-  };
-
-  RecordingVH RVH;
-  RVH = BitcastV.get();
-  EXPECT_EQ(0, RVH.DeletedCalls);
-  EXPECT_EQ(0, RVH.AURWCalls);
-  BitcastV.reset();
-  EXPECT_EQ(1, RVH.DeletedCalls);
-  EXPECT_EQ(0, RVH.AURWCalls);
-}
-
-TEST_F(ValueHandle, CallbackVH_CallbackOnRAUW) {
-  class RecordingVH : public CallbackVH {
-  public:
-    int DeletedCalls;
-    Value *AURWArgument;
-
-    RecordingVH() : DeletedCalls(0), AURWArgument(NULL) {}
-    RecordingVH(Value *V)
-      : CallbackVH(V), DeletedCalls(0), AURWArgument(NULL) {}
-
-  private:
-    virtual void deleted() { DeletedCalls++; CallbackVH::deleted(); }
-    virtual void allUsesReplacedWith(Value *new_value) {
-      EXPECT_EQ(NULL, AURWArgument);
-      AURWArgument = new_value;
-    }
-  };
-
-  RecordingVH RVH;
-  RVH = BitcastV.get();
-  EXPECT_EQ(0, RVH.DeletedCalls);
-  EXPECT_EQ(NULL, RVH.AURWArgument);
-  BitcastV->replaceAllUsesWith(ConstantV);
-  EXPECT_EQ(0, RVH.DeletedCalls);
-  EXPECT_EQ(ConstantV, RVH.AURWArgument);
-}
-
-TEST_F(ValueHandle, CallbackVH_DeletionCanRAUW) {
-  class RecoveringVH : public CallbackVH {
-  public:
-    int DeletedCalls;
-    Value *AURWArgument;
-    LLVMContext *Context;
-
-    RecoveringVH() : DeletedCalls(0), AURWArgument(NULL), 
-                     Context(&getGlobalContext()) {}
-    RecoveringVH(Value *V)
-      : CallbackVH(V), DeletedCalls(0), AURWArgument(NULL), 
-        Context(&getGlobalContext()) {}
-
-  private:
-    virtual void deleted() {
-      getValPtr()->replaceAllUsesWith(Constant::getNullValue(Type::getInt32Ty(getGlobalContext())));
-      setValPtr(NULL);
-    }
-    virtual void allUsesReplacedWith(Value *new_value) {
-      ASSERT_TRUE(NULL != getValPtr());
-      EXPECT_EQ(1U, getValPtr()->getNumUses());
-      EXPECT_EQ(NULL, AURWArgument);
-      AURWArgument = new_value;
-    }
-  };
-
-  // Normally, if a value has uses, deleting it will crash.  However, we can use
-  // a CallbackVH to remove the uses before the check for no uses.
-  RecoveringVH RVH;
-  RVH = BitcastV.get();
-  std::auto_ptr<BinaryOperator> BitcastUser(
-    BinaryOperator::CreateAdd(RVH, 
-                              Constant::getNullValue(Type::getInt32Ty(getGlobalContext()))));
-  EXPECT_EQ(BitcastV.get(), BitcastUser->getOperand(0));
-  BitcastV.reset();  // Would crash without the ValueHandler.
-  EXPECT_EQ(Constant::getNullValue(Type::getInt32Ty(getGlobalContext())), RVH.AURWArgument);
-  EXPECT_EQ(Constant::getNullValue(Type::getInt32Ty(getGlobalContext())),
-            BitcastUser->getOperand(0));
-}
-
-TEST_F(ValueHandle, DestroyingOtherVHOnSameValueDoesntBreakIteration) {
-  // When a CallbackVH modifies other ValueHandles in its callbacks,
-  // that shouldn't interfere with non-modified ValueHandles receiving
-  // their appropriate callbacks.
-  //
-  // We create the active CallbackVH in the middle of a palindromic
-  // arrangement of other VHs so that the bad behavior would be
-  // triggered in whichever order callbacks run.
-
-  class DestroyingVH : public CallbackVH {
-  public:
-    OwningPtr<WeakVH> ToClear[2];
-    DestroyingVH(Value *V) {
-      ToClear[0].reset(new WeakVH(V));
-      setValPtr(V);
-      ToClear[1].reset(new WeakVH(V));
-    }
-    virtual void deleted() {
-      ToClear[0].reset();
-      ToClear[1].reset();
-      CallbackVH::deleted();
-    }
-    virtual void allUsesReplacedWith(Value *) {
-      ToClear[0].reset();
-      ToClear[1].reset();
-    }
-  };
-
-  {
-    WeakVH ShouldBeVisited1(BitcastV.get());
-    DestroyingVH C(BitcastV.get());
-    WeakVH ShouldBeVisited2(BitcastV.get());
-
-    BitcastV->replaceAllUsesWith(ConstantV);
-    EXPECT_EQ(ConstantV, static_cast<Value*>(ShouldBeVisited1));
-    EXPECT_EQ(ConstantV, static_cast<Value*>(ShouldBeVisited2));
-  }
-
-  {
-    WeakVH ShouldBeVisited1(BitcastV.get());
-    DestroyingVH C(BitcastV.get());
-    WeakVH ShouldBeVisited2(BitcastV.get());
-
-    BitcastV.reset();
-    EXPECT_EQ(NULL, static_cast<Value*>(ShouldBeVisited1));
-    EXPECT_EQ(NULL, static_cast<Value*>(ShouldBeVisited2));
-  }
-}
-
-TEST_F(ValueHandle, AssertingVHCheckedLast) {
-  // If a CallbackVH exists to clear out a group of AssertingVHs on
-  // Value deletion, the CallbackVH should get a chance to do so
-  // before the AssertingVHs assert.
-
-  class ClearingVH : public CallbackVH {
-  public:
-    AssertingVH<Value> *ToClear[2];
-    ClearingVH(Value *V,
-               AssertingVH<Value> &A0, AssertingVH<Value> &A1)
-      : CallbackVH(V) {
-      ToClear[0] = &A0;
-      ToClear[1] = &A1;
-    }
-
-    virtual void deleted() {
-      *ToClear[0] = 0;
-      *ToClear[1] = 0;
-      CallbackVH::deleted();
-    }
-  };
-
-  AssertingVH<Value> A1, A2;
-  A1 = BitcastV.get();
-  ClearingVH C(BitcastV.get(), A1, A2);
-  A2 = BitcastV.get();
-  // C.deleted() should run first, clearing the two AssertingVHs,
-  // which should prevent them from asserting.
-  BitcastV.reset();
-}
-
-}





More information about the llvm-commits mailing list