]> granicus.if.org Git - llvm/commitdiff
Make OrderedInstructions and OrderedBasicBlock use AssertingVH, to try and catch...
authorXin Tong <trent.xin.tong@gmail.com>
Wed, 28 Jun 2017 22:12:22 +0000 (22:12 +0000)
committerXin Tong <trent.xin.tong@gmail.com>
Wed, 28 Jun 2017 22:12:22 +0000 (22:12 +0000)
Summary: Make OrderedInstructions and OrderedBasicBlock use AssertingVH to try and catch mistakes

Reviewers: efriedma

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306605 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/OrderedBasicBlock.h
include/llvm/Transforms/Utils/OrderedInstructions.h

index 2e716af1f60ddbbf77f92dbeebb80a1ab337c6d8..dc0d3263b675d2c513bc8657f3dbecf06fc2d7db 100644 (file)
@@ -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
index 64c6bcb68b189c4aa943011b241d9cc9305aa0f8..5f0aece83dc64174f55e83d33424e39e8f35de63 100644 (file)
 #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;