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

llvm-svn: 306605
This commit is contained in:
Xin Tong 2017-06-28 22:12:22 +00:00
parent 4b450685d3
commit 21ef353622
2 changed files with 5 additions and 3 deletions

View 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

View File

@ -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;