Lines Matching refs:Inst

87   Instruction *Inst;  member
89 SimpleValue(Instruction *I) : Inst(I) { in SimpleValue()
94 return Inst == DenseMapInfo<Instruction *>::getEmptyKey() || in isSentinel()
95 Inst == DenseMapInfo<Instruction *>::getTombstoneKey(); in isSentinel()
98 static bool canHandle(Instruction *Inst) { in canHandle()
100 if (CallInst *CI = dyn_cast<CallInst>(Inst)) in canHandle()
102 return isa<CastInst>(Inst) || isa<BinaryOperator>(Inst) || in canHandle()
103 isa<GetElementPtrInst>(Inst) || isa<CmpInst>(Inst) || in canHandle()
104 isa<SelectInst>(Inst) || isa<ExtractElementInst>(Inst) || in canHandle()
105 isa<InsertElementInst>(Inst) || isa<ShuffleVectorInst>(Inst) || in canHandle()
106 isa<ExtractValueInst>(Inst) || isa<InsertValueInst>(Inst); in canHandle()
130 Instruction *Inst = Val.Inst; in getHashValue() local
132 if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(Inst)) { in getHashValue()
141 if (CmpInst *CI = dyn_cast<CmpInst>(Inst)) { in getHashValue()
145 if (Inst->getOperand(0) > Inst->getOperand(1)) { in getHashValue()
149 return hash_combine(Inst->getOpcode(), Pred, LHS, RHS); in getHashValue()
157 SelectPatternFlavor SPF = matchSelectPattern(Inst, A, B).Flavor; in getHashValue()
163 return hash_combine(Inst->getOpcode(), SPF, A, B); in getHashValue()
167 return hash_combine(Inst->getOpcode(), SPF, A, B); in getHashValue()
170 if (CastInst *CI = dyn_cast<CastInst>(Inst)) in getHashValue()
173 if (const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(Inst)) in getHashValue()
177 if (const InsertValueInst *IVI = dyn_cast<InsertValueInst>(Inst)) in getHashValue()
182 assert((isa<CallInst>(Inst) || isa<BinaryOperator>(Inst) || in getHashValue()
183 isa<GetElementPtrInst>(Inst) || isa<SelectInst>(Inst) || in getHashValue()
184 isa<ExtractElementInst>(Inst) || isa<InsertElementInst>(Inst) || in getHashValue()
185 isa<ShuffleVectorInst>(Inst)) && in getHashValue()
190 Inst->getOpcode(), in getHashValue()
191 hash_combine_range(Inst->value_op_begin(), Inst->value_op_end())); in getHashValue()
195 Instruction *LHSI = LHS.Inst, *RHSI = RHS.Inst; in isEqual()
259 Instruction *Inst; member
261 CallValue(Instruction *I) : Inst(I) { in CallValue()
266 return Inst == DenseMapInfo<Instruction *>::getEmptyKey() || in isSentinel()
267 Inst == DenseMapInfo<Instruction *>::getTombstoneKey(); in isSentinel()
270 static bool canHandle(Instruction *Inst) { in canHandle()
272 if (Inst->getType()->isVoidTy()) in canHandle()
275 CallInst *CI = dyn_cast<CallInst>(Inst); in canHandle()
302 Instruction *Inst = Val.Inst; in getHashValue() local
305 Inst->getOpcode(), in getHashValue()
306 hash_combine_range(Inst->value_op_begin(), Inst->value_op_end())); in getHashValue()
310 Instruction *LHSI = LHS.Inst, *RHSI = RHS.Inst; in isEqual()
375 LoadValue(Instruction *Inst, unsigned Generation, unsigned MatchingId, in LoadValue()
377 : DefInst(Inst), Generation(Generation), MatchingId(MatchingId), in LoadValue()
490 ParseMemoryInst(Instruction *Inst, const TargetTransformInfo &TTI) in ParseMemoryInst() argument
491 : Inst(Inst) { in ParseMemoryInst()
492 if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) in ParseMemoryInst()
499 return isa<LoadInst>(Inst); in isLoad()
504 return isa<StoreInst>(Inst); in isStore()
510 return Inst->isAtomic(); in isAtomic()
517 if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) { in isUnordered()
519 } else if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { in isUnordered()
523 return !Inst->isAtomic(); in isUnordered()
530 if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) { in isVolatile()
532 } else if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { in isVolatile()
540 if (auto *LI = dyn_cast<LoadInst>(Inst)) in isInvariantLoad()
545 bool isMatchingMemLoc(const ParseMemoryInst &Inst) const { in isMatchingMemLoc()
546 return (getPointerOperand() == Inst.getPointerOperand() && in isMatchingMemLoc()
547 getMatchingId() == Inst.getMatchingId()); in isMatchingMemLoc()
563 return getLoadStorePointerOperand(Inst); in getPointerOperand()
568 return Inst->mayReadFromMemory(); in mayReadFromMemory()
573 return Inst->mayWriteToMemory(); in mayWriteToMemory()
579 Instruction *Inst; member in __anonb85134700311::EarlyCSE::ParseMemoryInst
587 Value *getOrCreateResult(Value *Inst, Type *ExpectedType) const { in getOrCreateResult() argument
588 if (auto *LI = dyn_cast<LoadInst>(Inst)) in getOrCreateResult()
590 if (auto *SI = dyn_cast<StoreInst>(Inst)) in getOrCreateResult()
592 assert(isa<IntrinsicInst>(Inst) && "Instruction not supported"); in getOrCreateResult()
593 return TTI.getOrCreateResultFromMemIntrinsic(cast<IntrinsicInst>(Inst), in getOrCreateResult()
604 void removeMSSA(Instruction *Inst) { in removeMSSA() argument
614 if (MemoryAccess *MA = MSSA->getMemoryAccess(Inst)) { in removeMSSA()
806 Instruction *Inst = &*I++; in processNode() local
809 if (isInstructionTriviallyDead(Inst, &TLI)) { in processNode()
810 LLVM_DEBUG(dbgs() << "EarlyCSE DCE: " << *Inst << '\n'); in processNode()
815 if (!salvageDebugInfo(*Inst)) in processNode()
816 replaceDbgUsesWithUndef(Inst); in processNode()
817 removeMSSA(Inst); in processNode()
818 Inst->eraseFromParent(); in processNode()
828 if (match(Inst, m_Intrinsic<Intrinsic::assume>())) { in processNode()
830 dyn_cast<Instruction>(cast<CallInst>(Inst)->getArgOperand(0)); in processNode()
832 LLVM_DEBUG(dbgs() << "EarlyCSE considering assumption: " << *Inst in processNode()
836 LLVM_DEBUG(dbgs() << "EarlyCSE skipping assumption: " << *Inst << '\n'); in processNode()
841 if (match(Inst, m_Intrinsic<Intrinsic::sideeffect>())) { in processNode()
842 LLVM_DEBUG(dbgs() << "EarlyCSE skipping sideeffect: " << *Inst << '\n'); in processNode()
859 if (match(Inst, m_Intrinsic<Intrinsic::invariant_start>())) { in processNode()
861 if (!Inst->use_empty()) in processNode()
863 auto *CI = cast<CallInst>(Inst); in processNode()
871 if (isGuard(Inst)) { in processNode()
873 dyn_cast<Instruction>(cast<CallInst>(Inst)->getArgOperand(0))) { in processNode()
881 << "EarlyCSE removing guard: " << *Inst << '\n'); in processNode()
882 removeMSSA(Inst); in processNode()
883 Inst->eraseFromParent(); in processNode()
888 cast<CallInst>(Inst)->setArgOperand(0, KnownCond); in processNode()
905 if (Value *V = SimplifyInstruction(Inst, SQ)) { in processNode()
906 LLVM_DEBUG(dbgs() << "EarlyCSE Simplify: " << *Inst << " to: " << *V in processNode()
912 if (!Inst->use_empty()) { in processNode()
913 Inst->replaceAllUsesWith(V); in processNode()
916 if (isInstructionTriviallyDead(Inst, &TLI)) { in processNode()
917 removeMSSA(Inst); in processNode()
918 Inst->eraseFromParent(); in processNode()
930 if (SimpleValue::canHandle(Inst)) { in processNode()
932 if (Value *V = AvailableValues.lookup(Inst)) { in processNode()
933 LLVM_DEBUG(dbgs() << "EarlyCSE CSE: " << *Inst << " to: " << *V in processNode()
940 I->andIRFlags(Inst); in processNode()
941 Inst->replaceAllUsesWith(V); in processNode()
942 removeMSSA(Inst); in processNode()
943 Inst->eraseFromParent(); in processNode()
950 AvailableValues.insert(Inst, Inst); in processNode()
954 ParseMemoryInst MemInst(Inst, TTI); in processNode()
970 auto MemLoc = MemoryLocation::get(Inst); in processNode()
989 (isOperatingOnInvariantMemAt(Inst, InVal.Generation) || in processNode()
991 InVal.DefInst, Inst))) { in processNode()
992 Value *Op = getOrCreateResult(InVal.DefInst, Inst->getType()); in processNode()
994 LLVM_DEBUG(dbgs() << "EarlyCSE CSE LOAD: " << *Inst in processNode()
1000 if (!Inst->use_empty()) in processNode()
1001 Inst->replaceAllUsesWith(Op); in processNode()
1002 removeMSSA(Inst); in processNode()
1003 Inst->eraseFromParent(); in processNode()
1013 LoadValue(Inst, CurrentGeneration, MemInst.getMatchingId(), in processNode()
1025 if ((Inst->mayReadFromMemory() || Inst->mayThrow()) && in processNode()
1030 if (CallValue::canHandle(Inst)) { in processNode()
1033 std::pair<Instruction *, unsigned> InVal = AvailableCalls.lookup(Inst); in processNode()
1036 Inst)) { in processNode()
1037 LLVM_DEBUG(dbgs() << "EarlyCSE CSE CALL: " << *Inst in processNode()
1043 if (!Inst->use_empty()) in processNode()
1044 Inst->replaceAllUsesWith(InVal.first); in processNode()
1045 removeMSSA(Inst); in processNode()
1046 Inst->eraseFromParent(); in processNode()
1054 Inst, std::pair<Instruction *, unsigned>(Inst, CurrentGeneration)); in processNode()
1063 if (FenceInst *FI = dyn_cast<FenceInst>(Inst)) in processNode()
1065 assert(Inst->mayReadFromMemory() && "relied on to prevent DSE above"); in processNode()
1077 InVal.DefInst == getOrCreateResult(Inst, InVal.DefInst->getType()) && in processNode()
1081 (isOperatingOnInvariantMemAt(Inst, InVal.Generation) || in processNode()
1083 InVal.DefInst, Inst))) { in processNode()
1093 LLVM_DEBUG(dbgs() << "EarlyCSE DSE (writeback): " << *Inst << '\n'); in processNode()
1098 removeMSSA(Inst); in processNode()
1099 Inst->eraseFromParent(); in processNode()
1111 if (Inst->mayWriteToMemory()) { in processNode()
1129 << " due to: " << *Inst << '\n'); in processNode()
1150 LoadValue(Inst, CurrentGeneration, MemInst.getMatchingId(), in processNode()
1161 LastStore = Inst; in processNode()