[llvm] r306605 - Make OrderedInstructions and OrderedBasicBlock use AssertingVH, to try and catch mistakes

Xin Tong via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 15:12:22 PDT 2017


Author: trentxintong
Date: Wed Jun 28 15:12:22 2017
New Revision: 306605

URL: http://llvm.org/viewvc/llvm-project?rev=306605&view=rev
Log:
Make OrderedInstructions and OrderedBasicBlock use AssertingVH, to try and catch mistakes

Summary: Make OrderedInstructions and OrderedBasicBlock use AssertingVH to try and catch mistakes

Reviewers: efriedma

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D34780

Modified:
    llvm/trunk/include/llvm/Analysis/OrderedBasicBlock.h
    llvm/trunk/include/llvm/Transforms/Utils/OrderedInstructions.h

Modified: llvm/trunk/include/llvm/Analysis/OrderedBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/OrderedBasicBlock.h?rev=306605&r1=306604&r2=306605&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/OrderedBasicBlock.h (original)
+++ llvm/trunk/include/llvm/Analysis/OrderedBasicBlock.h Wed Jun 28 15:12:22 2017
@@ -25,6 +25,7 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/ValueHandle.h"
 
 namespace llvm {
 
@@ -34,7 +35,7 @@ class BasicBlock;
 class OrderedBasicBlock {
 private:
   /// \brief Map a instruction to its position in a BasicBlock.
-  SmallDenseMap<const Instruction *, unsigned, 32> NumberedInsts;
+  SmallDenseMap<AssertingVH<const Instruction>, unsigned, 32> NumberedInsts;
 
   /// \brief Keep track of last instruction inserted into \p NumberedInsts.
   /// It speeds up queries for uncached instructions by providing a start point

Modified: llvm/trunk/include/llvm/Transforms/Utils/OrderedInstructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/OrderedInstructions.h?rev=306605&r1=306604&r2=306605&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/OrderedInstructions.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/OrderedInstructions.h Wed Jun 28 15:12:22 2017
@@ -24,13 +24,14 @@
 #include "llvm/Analysis/OrderedBasicBlock.h"
 #include "llvm/IR/Dominators.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/ValueHandle.h"
 
 namespace llvm {
 
 class OrderedInstructions {
   /// Used to check dominance for instructions in same basic block.
-  mutable DenseMap<const BasicBlock *, std::unique_ptr<OrderedBasicBlock>>
-      OBBMap;
+  mutable DenseMap<AssertingVH<const BasicBlock>,
+                   std::unique_ptr<OrderedBasicBlock>> OBBMap;
 
   /// The dominator tree of the parent function.
   DominatorTree *DT;




More information about the llvm-commits mailing list