diff options
Diffstat (limited to 'llvm/lib/Analysis/InstructionPrecedenceTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/InstructionPrecedenceTracking.cpp | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp b/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp index 415797d6a3783..c26cdf2266da8 100644 --- a/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp +++ b/llvm/lib/Analysis/InstructionPrecedenceTracking.cpp @@ -59,7 +59,7 @@ bool InstructionPrecedenceTracking::isPreceededBySpecialInstruction( const Instruction *Insn) { const Instruction *MaybeFirstSpecial = getFirstSpecialInstruction(Insn->getParent()); - return MaybeFirstSpecial && OI.dominates(MaybeFirstSpecial, Insn); + return MaybeFirstSpecial && MaybeFirstSpecial->comesBefore(Insn); } void InstructionPrecedenceTracking::fill(const BasicBlock *BB) { @@ -104,18 +104,14 @@ void InstructionPrecedenceTracking::insertInstructionTo(const Instruction *Inst, const BasicBlock *BB) { if (isSpecialInstruction(Inst)) FirstSpecialInsts.erase(BB); - OI.invalidateBlock(BB); } void InstructionPrecedenceTracking::removeInstruction(const Instruction *Inst) { if (isSpecialInstruction(Inst)) FirstSpecialInsts.erase(Inst->getParent()); - OI.invalidateBlock(Inst->getParent()); } void InstructionPrecedenceTracking::clear() { - for (auto It : FirstSpecialInsts) - OI.invalidateBlock(It.first); FirstSpecialInsts.clear(); #ifndef NDEBUG // The map should be valid after clearing (at least empty). @@ -130,26 +126,7 @@ bool ImplicitControlFlowTracking::isSpecialInstruction( // to avoid wrong assumptions of sort "if A is executed and B post-dominates // A, then B is also executed". This is not true is there is an implicit // control flow instruction (e.g. a guard) between them. - // - // TODO: Currently, isGuaranteedToTransferExecutionToSuccessor returns false - // for volatile stores and loads because they can trap. The discussion on - // whether or not it is correct is still ongoing. We might want to get rid - // of this logic in the future. Anyways, trapping instructions shouldn't - // introduce implicit control flow, so we explicitly allow them here. This - // must be removed once isGuaranteedToTransferExecutionToSuccessor is fixed. - if (isGuaranteedToTransferExecutionToSuccessor(Insn)) - return false; - if (isa<LoadInst>(Insn)) { - assert(cast<LoadInst>(Insn)->isVolatile() && - "Non-volatile load should transfer execution to successor!"); - return false; - } - if (isa<StoreInst>(Insn)) { - assert(cast<StoreInst>(Insn)->isVolatile() && - "Non-volatile store should transfer execution to successor!"); - return false; - } - return true; + return !isGuaranteedToTransferExecutionToSuccessor(Insn); } bool MemoryWriteTracking::isSpecialInstruction( |