28 "ipt-expensive-asserts",
29 cl::desc(
"Perform expensive assert validation on every query to Instruction" 30 " Precedence Tracking"),
45 if (FirstSpecialInsts.find(BB) == FirstSpecialInsts.end()) {
47 assert(FirstSpecialInsts.find(BB) != FirstSpecialInsts.end() &&
"Must be!");
49 return FirstSpecialInsts[BB];
61 return MaybeFirstSpecial && OI.
dominates(MaybeFirstSpecial, Insn);
64 void InstructionPrecedenceTracking::fill(
const BasicBlock *BB) {
65 FirstSpecialInsts.erase(BB);
68 FirstSpecialInsts[BB] = &
I;
73 FirstSpecialInsts[BB] =
nullptr;
77 void InstructionPrecedenceTracking::validate(
const BasicBlock *BB)
const {
78 auto It = FirstSpecialInsts.find(BB);
80 if (It == FirstSpecialInsts.end())
85 assert(It->second == &Insn &&
86 "Cached first special instruction is wrong!");
90 assert(It->second ==
nullptr &&
91 "Block is marked as having special instructions but in fact it has " 95 void InstructionPrecedenceTracking::validateAll()
const {
97 for (
auto &It : FirstSpecialInsts)
105 FirstSpecialInsts.erase(BB);
111 FirstSpecialInsts.erase(Inst->
getParent());
116 for (
auto It : FirstSpecialInsts)
118 FirstSpecialInsts.clear();
141 if (isa<LoadInst>(Insn)) {
143 "Non-volatile load should transfer execution to successor!");
146 if (isa<StoreInst>(Insn)) {
148 "Non-volatile store should transfer execution to successor!");
This class represents lattice values for constants.
bool dominates(const Instruction *, const Instruction *) const
Return true if first instruction dominates the second.
bool mayWriteToMemory() const
Return true if this instruction may modify memory.
void clear()
Invalidates all information from this tracking.
bool hasSpecialInstructions(const BasicBlock *BB)
Returns true iff at least one instruction from the basic block BB is special.
static cl::opt< bool > ExpensiveAsserts("ipt-expensive-asserts", cl::desc("Perform expensive assert validation on every query to Instruction" " Precedence Tracking"), cl::init(false), cl::Hidden)
virtual bool isSpecialInstruction(const Instruction *Insn) const
A predicate that defines whether or not the instruction Insn is considered special and needs to be tr...
initializer< Ty > init(const Ty &Val)
bool isGuaranteedToTransferExecutionToSuccessor(const Instruction *I)
Return true if this function can prove that the instruction I will always transfer execution to one o...
LLVM Basic Block Representation.
virtual bool isSpecialInstruction(const Instruction *Insn) const
A predicate that defines whether or not the instruction Insn is considered special and needs to be tr...
void invalidateBlock(const BasicBlock *BB)
Invalidate the OrderedBasicBlock cache when its basic block changes.
const Instruction * getFirstSpecialInstruction(const BasicBlock *BB)
Returns the topmost special instruction from the block BB.
void insertInstructionTo(const Instruction *Inst, const BasicBlock *BB)
Notifies this tracking that we are going to insert a new instruction Inst to the basic block BB...
void removeInstruction(const Instruction *Inst)
Notifies this tracking that we are going to remove the instruction Inst It makes all necessary update...
bool isPreceededBySpecialInstruction(const Instruction *Insn)
Returns true iff the first special instruction of Insn's block exists and dominates Insn...
virtual bool isSpecialInstruction(const Instruction *Insn) const =0
A predicate that defines whether or not the instruction Insn is considered special and needs to be tr...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isVolatile(Instruction *Inst)
const BasicBlock * getParent() const