diff options
Diffstat (limited to 'llvm/include/llvm/Transforms/InstCombine/InstCombineWorklist.h')
-rw-r--r-- | llvm/include/llvm/Transforms/InstCombine/InstCombineWorklist.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/include/llvm/Transforms/InstCombine/InstCombineWorklist.h b/llvm/include/llvm/Transforms/InstCombine/InstCombineWorklist.h index 6c33bdbafbd2..3ed0a820db10 100644 --- a/llvm/include/llvm/Transforms/InstCombine/InstCombineWorklist.h +++ b/llvm/include/llvm/Transforms/InstCombine/InstCombineWorklist.h @@ -24,8 +24,8 @@ namespace llvm { /// InstCombineWorklist - This is the worklist management logic for /// InstCombine. class InstCombineWorklist { - SmallVector<Instruction*, 256> Worklist; - DenseMap<Instruction*, unsigned> WorklistMap; + SmallVector<Instruction *, 256> Worklist; + DenseMap<Instruction *, unsigned> WorklistMap; public: InstCombineWorklist() = default; @@ -38,6 +38,9 @@ public: /// Add - Add the specified instruction to the worklist if it isn't already /// in it. void Add(Instruction *I) { + assert(I); + assert(I->getParent() && "Instruction not inserted yet?"); + if (WorklistMap.insert(std::make_pair(I, Worklist.size())).second) { LLVM_DEBUG(dbgs() << "IC: ADD: " << *I << '\n'); Worklist.push_back(I); |