|
reference, declaration → definition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
|
Derived Classes
include/llvm/IR/InstrTypes.h 57 class UnaryInstruction : public Instruction {
188 class BinaryOperator : public Instruction {
722 class CmpInst : public Instruction {
1105 class CallBase : public Instruction {
2134 class FuncletPadInst : public Instruction {
include/llvm/IR/Instructions.h 325 class StoreInst : public Instruction {
460 class FenceInst : public Instruction {
536 class AtomicCmpXchgInst : public Instruction {
699 class AtomicRMWInst : public Instruction {
881 class GetElementPtrInst : public Instruction {
1715 class SelectInst : public Instruction {
1850 class ExtractElementInst : public Instruction {
1914 class InsertElementInst : public Instruction {
1977 class ShuffleVectorInst : public Instruction {
2403 class InsertValueInst : public Instruction {
2546 class PHINode : public Instruction {
2791 class LandingPadInst : public Instruction {
2893 class ReturnInst : public Instruction {
2975 class BranchInst : public Instruction {
3119 class SwitchInst : public Instruction {
3521 class IndirectBrInst : public Instruction {
4162 class ResumeInst : public Instruction {
4219 class CatchSwitchInst : public Instruction {
4485 class CatchReturnInst : public Instruction {
4566 class CleanupReturnInst : public Instruction {
4671 class UnreachableInst : public Instruction {
Declarations
include/llvm/Analysis/CFG.h 25 class Instruction;
include/llvm/Analysis/CaptureTracking.h 21 class Instruction;
include/llvm/Analysis/CodeMetrics.h 25 class Instruction;
include/llvm/Analysis/ConstantFolding.h 32 class Instruction;
include/llvm/Analysis/DemandedBits.h 36 class Instruction;
include/llvm/Analysis/DivergenceAnalysis.h 27 class Instruction;
include/llvm/Analysis/IVUsers.h 26 class Instruction;
include/llvm/Analysis/IndirectCallPromotionAnalysis.h 20 class Instruction;
include/llvm/Analysis/LazyValueInfo.h 26 class Instruction;
include/llvm/Analysis/MemoryBuiltins.h 42 class Instruction;
include/llvm/Analysis/MemoryDependenceAnalysis.h 41 class Instruction;
include/llvm/Analysis/MemorySSA.h 111 class Instruction;
include/llvm/Analysis/MemorySSAUpdater.h 59 class Instruction;
include/llvm/Analysis/MustExecute.h 36 class Instruction;
include/llvm/Analysis/OrderedBasicBlock.h 30 class Instruction;
include/llvm/Analysis/ScalarEvolution.h 62 class Instruction;
include/llvm/CodeGen/FunctionLoweringInfo.h 41 class Instruction;
include/llvm/CodeGen/GlobalISel/IRTranslator.h 42 class Instruction;
include/llvm/CodeGen/StackProtector.h 31 class Instruction;
include/llvm/CodeGen/WinEHFuncInfo.h 30 class Instruction;
include/llvm/FuzzMutate/IRMutator.h 25 class Instruction;
include/llvm/IR/AssemblyAnnotationWriter.h 23 class Instruction;
include/llvm/IR/AutoUpgrade.h 22 class Instruction;
include/llvm/IR/DIBuilder.h 36 class Instruction;
include/llvm/IR/DiagnosticInfo.h 36 class Instruction;
include/llvm/IR/Dominators.h 31 class Instruction;
include/llvm/IR/Instruction.def 211 HANDLE_USER_INST (58, UserOp1, Instruction) // May be used internally in a pass
212 HANDLE_USER_INST (59, UserOp2, Instruction) // Internal to passes only
include/llvm/IR/LLVMContext.h 30 class Instruction;
include/llvm/IR/SymbolTableListTraits.h 39 class Instruction;
include/llvm/IR/Value.h 44 class Instruction;
include/llvm/IR/ValueSymbolTable.h 29 class Instruction;
include/llvm/IR/Verifier.h 32 class Instruction;
include/llvm/ProfileData/InstrProf.h 52 class Instruction;
include/llvm/Transforms/Instrumentation/PGOInstrumentation.h 26 class Instruction;
include/llvm/Transforms/Scalar/ConstantHoisting.h 59 class Instruction;
include/llvm/Transforms/Scalar/JumpThreading.h 39 class Instruction;
include/llvm/Transforms/Scalar/MemCpyOptimizer.h 30 class Instruction;
include/llvm/Transforms/Scalar/NaryReassociate.h 94 class Instruction;
include/llvm/Transforms/Scalar/Reassociate.h 39 class Instruction;
include/llvm/Transforms/Scalar/SROA.h 29 class Instruction;
include/llvm/Transforms/Utils/BasicBlockUtils.h 33 class Instruction;
include/llvm/Transforms/Utils/Cloning.h 42 class Instruction;
include/llvm/Transforms/Utils/CodeExtractor.h 34 class Instruction;
include/llvm/Transforms/Utils/FunctionComparator.h 37 class Instruction;
include/llvm/Transforms/Utils/Local.h 49 class Instruction;
include/llvm/Transforms/Utils/LowerMemIntrinsics.h 20 class Instruction;
include/llvm/Transforms/Utils/PredicateInfo.h 90 class Instruction;
include/llvm/Transforms/Utils/SSAUpdater.h 23 class Instruction;
include/llvm/Transforms/Utils/SimplifyLibCalls.h 26 class Instruction;
include/llvm/Transforms/Utils/VNCoercion.h 30 class Instruction;
include/llvm/Transforms/Utils/ValueMapper.h 27 class Instruction;
include/llvm/Transforms/Vectorize/SLPVectorizer.h 39 class Instruction;
lib/AsmParser/LLParser.h 34 class Instruction;
lib/Bitcode/Reader/MetadataLoader.h 28 class Instruction;
lib/Bitcode/Writer/ValueEnumerator.h 33 class Instruction;
lib/CodeGen/SafeStackColoring.h 25 class Instruction;
lib/Target/AArch64/AArch64TargetTransformInfo.h 32 class Instruction;
lib/Target/ARM/ARMISelLowering.h 43 class Instruction;
lib/Target/ARM/ARMTargetTransformInfo.h 34 class Instruction;
lib/Transforms/ObjCARC/DependencyAnalysis.h 30 class Instruction;
lib/Transforms/ObjCARC/PtrState.h 26 class Instruction;
tools/bugpoint/BugDriver.h 35 class Instruction;
tools/clang/lib/CodeGen/CGLoopInfo.h 25 class Instruction;
tools/clang/lib/CodeGen/SanitizerMetadata.h 21 class Instruction;
tools/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h 34 class Instruction;
tools/llvm-diff/DiffLog.h 20 class Instruction;
tools/llvm-diff/DifferenceEngine.h 25 class Instruction;
References
examples/BrainF/BrainF.cpp 99 BB->getInstList().push_back(cast<Instruction>(ptr_arr));
examples/ModuleMaker/ModuleMaker.cpp 54 Instruction *Add = BinaryOperator::Create(Instruction::Add, Two, Three,
54 Instruction *Add = BinaryOperator::Create(Instruction::Add, Two, Three,
examples/ParallelJIT/ParallelJIT.cpp 71 Instruction *Add = BinaryOperator::CreateAdd(One, ArgX, "addresult", BB);
include/llvm/ADT/ArrayRef.h 108 const ArrayRef<U *> &A,
110 std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
118 const SmallVectorTemplateCommon<U *, DummyT> &Vec,
120 std::is_convertible<U *const *, T const *>::value>::type * = nullptr)
include/llvm/ADT/DenseMapInfo.h 39 static inline T* getEmptyKey() {
41 Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
45 static inline T* getTombstoneKey() {
47 Val <<= PointerLikeTypeTraits<T*>::NumLowBitsAvailable;
51 static unsigned getHashValue(const T *PtrVal) {
56 static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; }
56 static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; }
include/llvm/ADT/ilist.h 65 void addNodeToList(NodeTy *) {}
66 void removeNodeFromList(NodeTy *) {}
82 struct ilist_node_traits : ilist_alloc_traits<NodeTy>,
83 ilist_callback_traits<NodeTy> {};
89 struct ilist_traits : public ilist_node_traits<NodeTy> {};
96 template <class T> T &make();
106 static Yes &test(U *I, decltype(I->getNext(&make<NodeT>())) * = 0);
136 static Yes &test(U *I, decltype(I->createNode(make<NodeT>())) * = 0);
144 static const bool value = HasGetNext<TraitsT, NodeT>::value ||
146 HasCreateNode<TraitsT, NodeT>::value;
389 : public iplist_impl<simple_ilist<T, Options...>, ilist_traits<T>> {
389 : public iplist_impl<simple_ilist<T, Options...>, ilist_traits<T>> {
include/llvm/ADT/ilist_node.h 150 typename ilist_detail::compute_node_options<T, Options...>::type> {
256 class ilist_node_with_parent : public ilist_node<NodeTy, Options...> {
274 NodeTy *getPrevNode() {
283 const NodeTy *getPrevNode() const {
288 NodeTy *getNextNode() {
297 const NodeTy *getNextNode() const {
include/llvm/ADT/ilist_node_options.h 108 typedef T value_type;
109 typedef T *pointer;
110 typedef T &reference;
111 typedef const T *const_pointer;
112 typedef const T &const_reference;
122 typedef node_options<T, extract_sentinel_tracking<Options...>::value,
include/llvm/ADT/iterator.h 68 : public std::iterator<IteratorCategoryT, T, DifferenceTypeT, PointerT,
206 : public iterator_facade_base<DerivedT, IteratorCategoryT, T,
include/llvm/ADT/simple_ilist.h 79 : ilist_detail::compute_node_options<T, Options...>::type::list_base_type,
81 typename ilist_detail::compute_node_options<T, Options...>::type> {
85 typename ilist_detail::compute_node_options<T, Options...>::type;
include/llvm/Analysis/AliasAnalysis.h 623 ModRefInfo getModRefInfo(const Instruction *I,
630 ModRefInfo getModRefInfo(const Instruction *I, const Value *P,
637 ModRefInfo getModRefInfo(Instruction *I, const CallBase *Call);
650 ModRefInfo callCapturesBefore(const Instruction *I,
655 ModRefInfo callCapturesBefore(const Instruction *I, const Value *P,
681 bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
681 bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
686 bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
686 bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2,
697 ModRefInfo getModRefInfo(Instruction *I, const CallBase *Call2,
719 ModRefInfo getModRefInfo(const Instruction *I,
731 case Instruction::VAArg:
733 case Instruction::Load:
735 case Instruction::Store:
737 case Instruction::Fence:
739 case Instruction::AtomicCmpXchg:
741 case Instruction::AtomicRMW:
743 case Instruction::Call:
745 case Instruction::Invoke:
747 case Instruction::CatchPad:
749 case Instruction::CatchRet:
795 ModRefInfo getModRefInfo(const Instruction *I,
799 ModRefInfo getModRefInfo(Instruction *I, const CallBase *Call2) {
include/llvm/Analysis/AliasSetTracker.h 198 Instruction *getUnknownInst(unsigned i) const {
200 return cast_or_null<Instruction>(UnknownInsts[i]);
233 Instruction* getUniqueInstruction();
301 void addUnknownInst(Instruction *I, AliasAnalysis &AA);
303 void removeUnknownInst(AliasSetTracker &AST, Instruction *I) {
320 bool aliasesUnknownInst(const Instruction *Inst, AliasAnalysis &AA) const;
383 void add(Instruction *I); // Dispatch to one of the other add methods...
386 void addUnknown(Instruction *I);
457 AliasSet *findAliasSetForUnknownInst(Instruction *Inst);
include/llvm/Analysis/CFG.h 47 bool isCriticalEdge(const Instruction *TI, unsigned SuccNum,
49 bool isCriticalEdge(const Instruction *TI, const BasicBlock *Succ,
68 const Instruction *From, const Instruction *To,
68 const Instruction *From, const Instruction *To,
include/llvm/Analysis/CFGPrinter.h 152 const Instruction *TI = Node->getTerminator();
include/llvm/Analysis/CFLAliasAnalysisUtils.h 45 if (auto *Inst = dyn_cast<Instruction>(Val)) {
include/llvm/Analysis/CGSCCPassManager.h 593 for (Instruction &I : instructions(N.getFunction()))
include/llvm/Analysis/CaptureTracking.h 61 bool StoreCaptures, const Instruction *I,
include/llvm/Analysis/ConstantFolding.h 46 Constant *ConstantFoldInstruction(Instruction *I, const DataLayout &DL,
61 Constant *ConstantFoldInstOperands(Instruction *I, ArrayRef<Constant *> Ops,
include/llvm/Analysis/DDG.h 40 using InstructionListType = SmallVectorImpl<Instruction *>;
73 bool collectInstructions(llvm::function_ref<bool(Instruction *)> const &Pred,
104 SimpleDDGNode(Instruction &I);
132 Instruction *getFirstInstruction() const { return getInstructions().front(); }
133 Instruction *getLastInstruction() const { return getInstructions().back(); }
155 SmallVector<Instruction *, 2> InstList;
281 DDGNode &createFineGrainedNode(Instruction &I) final override {
include/llvm/Analysis/DemandedBits.h 54 APInt getDemandedBits(Instruction *I);
57 bool isInstructionDead(Instruction *I);
66 void determineLiveOperandBits(const Instruction *UserI,
78 SmallPtrSet<Instruction*, 32> Visited;
79 DenseMap<Instruction *, APInt> AliveBits;
include/llvm/Analysis/DependenceAnalysis.h 76 Dependence(Instruction *Source,
77 Instruction *Destination) :
108 Instruction *getSrc() const { return Src; }
112 Instruction *getDst() const { return Dst; }
201 Instruction *Src, *Dst;
216 FullDependence(Instruction *Src, Instruction *Dst, bool LoopIndependent,
216 FullDependence(Instruction *Src, Instruction *Dst, bool LoopIndependent,
287 std::unique_ptr<Dependence> depends(Instruction *Src,
288 Instruction *Dst,
508 void establishNestingLevels(const Instruction *Src,
509 const Instruction *Dst);
927 bool tryDelinearize(Instruction *Src, Instruction *Dst,
927 bool tryDelinearize(Instruction *Src, Instruction *Dst,
include/llvm/Analysis/DependenceGraphBuilder.h 82 virtual NodeType &createFineGrainedNode(Instruction &I) = 0;
100 using InstToNodeMap = DenseMap<Instruction *, NodeType *>;
include/llvm/Analysis/DivergenceAnalysis.h 57 bool inRegion(const Instruction &I) const;
85 bool updateTerminator(const Instruction &Term) const;
94 bool updateNormalInstruction(const Instruction &Inst) const;
140 void propagateBranchDivergence(const Instruction &Term);
175 std::vector<const Instruction *> Worklist;
include/llvm/Analysis/IVDescriptors.h 91 RecurrenceDescriptor(Value *Start, Instruction *Exit, RecurrenceKind K,
93 Instruction *UAI, Type *RT, bool Signed,
94 SmallPtrSetImpl<Instruction *> &CI)
104 InstDesc(bool IsRecur, Instruction *I, Instruction *UAI = nullptr)
104 InstDesc(bool IsRecur, Instruction *I, Instruction *UAI = nullptr)
108 InstDesc(Instruction *I, MinMaxRecurrenceKind K, Instruction *UAI = nullptr)
108 InstDesc(Instruction *I, MinMaxRecurrenceKind K, Instruction *UAI = nullptr)
116 Instruction *getUnsafeAlgebraInst() { return UnsafeAlgebraInst; }
120 Instruction *getPatternInst() { return PatternLastInst; }
127 Instruction *PatternLastInst;
131 Instruction *UnsafeAlgebraInst;
139 static InstDesc isRecurrenceInstr(Instruction *I, RecurrenceKind Kind,
143 static bool hasMultipleUsesOf(Instruction *I,
144 SmallPtrSetImpl<Instruction *> &Insts,
148 static bool areAllUsesIn(Instruction *I, SmallPtrSetImpl<Instruction *> &Set);
148 static bool areAllUsesIn(Instruction *I, SmallPtrSetImpl<Instruction *> &Set);
153 static InstDesc isMinMaxSelectCmpPattern(Instruction *I, InstDesc &Prev);
157 static InstDesc isConditionalRdxPattern(RecurrenceKind Kind, Instruction *I);
196 DenseMap<Instruction *, Instruction *> &SinkAfter,
196 DenseMap<Instruction *, Instruction *> &SinkAfter,
207 Instruction *getLoopExitInstr() { return LoopExitInstr; }
214 Instruction *getUnsafeAlgebraInst() { return UnsafeAlgebraInst; }
231 SmallPtrSet<Instruction *, 8> &getCastInsts() { return CastInsts; }
241 Instruction *LoopExitInstr = nullptr;
250 Instruction *UnsafeAlgebraInst = nullptr;
256 SmallPtrSet<Instruction *, 8> CastInsts;
296 SmallVectorImpl<Instruction *> *CastsToIgnore = nullptr);
324 Instruction *getUnsafeAlgebraInst() {
334 Instruction::BinaryOps getInductionOpcode() const {
336 : Instruction::BinaryOpsEnd;
342 const SmallVectorImpl<Instruction *> &getCastInsts() const {
350 SmallVectorImpl<Instruction *> *Casts = nullptr);
362 SmallVector<Instruction *, 2> RedundantCasts;
include/llvm/Analysis/IVUsers.h 40 IVStrideUse(IVUsers *P, Instruction* U, Value *O)
45 Instruction *getUser() const {
46 return cast<Instruction>(getValPtr());
50 void setUser(Instruction *NewUser) {
100 SmallPtrSet<Instruction*, 16> Processed;
129 bool AddUsersIfInteresting(Instruction *I);
131 IVStrideUse &AddUser(Instruction *User, Value *Operand);
150 bool isIVUserOrOperand(Instruction *Inst) const {
162 bool AddUsersImpl(Instruction *I, SmallPtrSetImpl<Loop*> &SimpleLoopNests);
include/llvm/Analysis/IndirectCallPromotionAnalysis.h 38 uint32_t getProfitablePromotionCandidates(const Instruction *Inst,
61 getPromotionCandidatesForInstruction(const Instruction *I, uint32_t &NumVals,
include/llvm/Analysis/IndirectCallVisitor.h 21 std::vector<Instruction *> IndirectCalls;
31 inline std::vector<Instruction *> findIndirectCalls(Function &F) {
include/llvm/Analysis/InstructionPrecedenceTracking.h 32 DenseMap<const BasicBlock *, const Instruction *> FirstSpecialInsts;
57 const Instruction *getFirstSpecialInstruction(const BasicBlock *BB);
65 bool isPreceededBySpecialInstruction(const Instruction *Insn);
72 virtual bool isSpecialInstruction(const Instruction *Insn) const = 0;
80 void insertInstructionTo(const Instruction *Inst, const BasicBlock *BB);
84 void removeInstruction(const Instruction *Inst);
104 const Instruction *getFirstICFI(const BasicBlock *BB) {
115 bool isDominatedByICFIFromSameBlock(const Instruction *Insn) {
119 virtual bool isSpecialInstruction(const Instruction *Insn) const;
128 const Instruction *getFirstMemoryWrite(const BasicBlock *BB) {
140 bool isDominatedByMemoryWriteFromSameBlock(const Instruction *Insn) {
144 virtual bool isSpecialInstruction(const Instruction *Insn) const;
include/llvm/Analysis/InstructionSimplify.h 65 MDNode *getMetadata(const Instruction *I, unsigned KindID) const {
77 template <class InstT> bool hasNoSignedWrap(const InstT *Op) const {
95 const Instruction *CxtI = nullptr;
102 SimplifyQuery(const DataLayout &DL, const Instruction *CXTI = nullptr)
108 const Instruction *CXTI = nullptr, bool UseInstrInfo = true)
110 SimplifyQuery getWithInstruction(Instruction *I) const {
264 Value *SimplifyInstruction(Instruction *I, const SimplifyQuery &Q,
277 Instruction *I, Value *SimpleV, const TargetLibraryInfo *TLI = nullptr,
279 SmallSetVector<Instruction *, 8> *UnsimplifiedUsers = nullptr);
287 bool recursivelySimplifyInstruction(Instruction *I,
include/llvm/Analysis/LazyCallGraph.h 1098 if (Instruction *I = dyn_cast<Instruction>(U))
1098 if (Instruction *I = dyn_cast<Instruction>(U))
include/llvm/Analysis/LazyValueInfo.h 73 Instruction *CxtI = nullptr);
79 Instruction *CxtI);
83 Constant *getConstant(Value *V, BasicBlock *BB, Instruction *CxtI = nullptr);
88 ConstantRange getConstantRange(Value *V, BasicBlock *BB, Instruction *CxtI = nullptr);
93 Instruction *CxtI = nullptr);
100 Instruction *CxtI = nullptr);
include/llvm/Analysis/Loads.h 32 const Instruction *CtxI = nullptr,
42 const Instruction *CtxI = nullptr,
51 const Instruction *CtxI = nullptr,
64 Instruction *ScanFrom = nullptr,
88 Instruction *ScanFrom = nullptr,
include/llvm/Analysis/LoopAccessAnalysis.h 156 Instruction *getSource(const LoopAccessInfo &LAI) const;
158 Instruction *getDestination(const LoopAccessInfo &LAI) const;
174 const SmallVectorImpl<Instruction *> &Instrs) const;
238 const SmallVectorImpl<Instruction *> &getMemoryInstructions() const {
244 DenseMap<Instruction *, unsigned> generateInstructionOrderMap() const {
245 DenseMap<Instruction *, unsigned> OrderMap;
254 SmallVector<Instruction *, 4> getInstructionsForAccess(Value *Ptr,
271 SmallVector<Instruction *, 16> InstMap;
557 std::pair<Instruction *, Instruction *>
557 std::pair<Instruction *, Instruction *>
558 addRuntimeChecks(Instruction *Loc) const;
565 std::pair<Instruction *, Instruction *>
565 std::pair<Instruction *, Instruction *>
566 addRuntimeChecks(Instruction *Loc,
580 SmallVector<Instruction *, 4> getInstructionsForAccess(Value *Ptr,
623 Instruction *Instr = nullptr);
778 inline Instruction *MemoryDepChecker::Dependence::getSource(
783 inline Instruction *MemoryDepChecker::Dependence::getDestination(
include/llvm/Analysis/LoopCacheAnalysis.h 49 IndexedReference(Instruction &StoreOrLoadInst, const LoopInfo &LI,
128 Instruction &StoreOrLoadInst;
include/llvm/Analysis/LoopInfo.h 131 template <class InstT> bool contains(const InstT *Inst) const {
535 bool hasLoopInvariantOperands(const Instruction *I) const;
546 Instruction *InsertPt = nullptr,
558 bool makeLoopInvariant(Instruction *I, bool &Changed,
559 Instruction *InsertPt = nullptr,
629 Instruction &getStepInst() const { return StepInst; }
683 LoopBounds(const Loop &Loop, Value &I, Instruction &SI, Value *SV, Value &F,
694 Instruction &StepInst;
1070 bool replacementPreservesLCSSAForm(Instruction *From, Value *To) {
1073 Instruction *I = dyn_cast<Instruction>(To);
1073 Instruction *I = dyn_cast<Instruction>(To);
1096 bool movementPreservesLCSSAForm(Instruction *Inst, Instruction *NewLoc) {
1096 bool movementPreservesLCSSAForm(Instruction *Inst, Instruction *NewLoc) {
1129 auto *UI = cast<Instruction>(U.getUser());
1129 auto *UI = cast<Instruction>(U.getUser());
1146 auto *DefI = dyn_cast<Instruction>(U.get());
1146 auto *DefI = dyn_cast<Instruction>(U.get());
include/llvm/Analysis/LoopUnrollAnalyzer.h 84 bool simplifyInstWithSCEV(Instruction *I);
86 bool visitInstruction(Instruction &I) { return simplifyInstWithSCEV(&I); }
include/llvm/Analysis/MemoryBuiltins.h 232 SmallPtrSet<Instruction *, 8> SeenInsts;
274 SizeOffsetType visitInstruction(Instruction &I);
300 SmallPtrSet<Instruction *, 8> InsertedInstructions;
340 SizeOffsetEvalType visitInstruction(Instruction &I);
include/llvm/Analysis/MemoryDependenceAnalysis.h 118 DepType, PointerSumTypeMember<Invalid, Instruction *>,
119 PointerSumTypeMember<Clobber, Instruction *>,
120 PointerSumTypeMember<Def, Instruction *>,
131 static MemDepResult getDef(Instruction *Inst) {
135 static MemDepResult getClobber(Instruction *Inst) {
177 Instruction *getInst() const {
202 static MemDepResult getDirty(Instruction *Inst) {
278 using LocalDepMapType = DenseMap<Instruction *, MemDepResult>;
319 DenseMap<Instruction *, SmallPtrSet<const Value*, 4>>;
333 DenseMap<Instruction *, SmallPtrSet<ValueIsLoadPair, 4>>;
344 using NonLocalDepMapType = DenseMap<Instruction *, PerInstNLInfo>;
351 DenseMap<Instruction *, SmallPtrSet<Instruction *, 4>>;
351 DenseMap<Instruction *, SmallPtrSet<Instruction *, 4>>;
387 MemDepResult getDependency(Instruction *QueryInst,
415 void getNonLocalPointerDependency(Instruction *QueryInst,
420 void removeInstruction(Instruction *InstToRemove);
453 Instruction *QueryInst = nullptr,
460 Instruction *QueryInst, unsigned *Limit,
490 bool getNonLocalPointerDepFromBB(Instruction *QueryInst,
497 MemDepResult GetNonLocalInfoForBlock(Instruction *QueryInst,
504 void verifyRemoved(Instruction *Inst) const;
include/llvm/Analysis/MemoryLocation.h 204 static MemoryLocation get(const Instruction *Inst) {
207 static Optional<MemoryLocation> getOrNone(const Instruction *Inst) {
209 case Instruction::Load:
211 case Instruction::Store:
213 case Instruction::VAArg:
215 case Instruction::AtomicCmpXchg:
217 case Instruction::AtomicRMW:
include/llvm/Analysis/MemorySSA.h 254 Instruction *getMemoryInst() const { return MemoryInstruction; }
285 DeleteValueTy DeleteValue, Instruction *MI, BasicBlock *BB,
310 Instruction *MemoryInstruction;
323 MemoryUse(LLVMContext &C, MemoryAccess *DMA, Instruction *MI, BasicBlock *BB)
381 MemoryDef(LLVMContext &C, MemoryAccess *DMA, Instruction *MI, BasicBlock *BB,
720 MemoryUseOrDef *getMemoryAccess(const Instruction *I) const {
833 MemoryUseOrDef *createDefinedAccess(Instruction *, MemoryAccess *,
859 MemoryUseOrDef *createNewAccess(Instruction *, AliasAnalysisType *,
1025 MemoryAccess *getClobberingMemoryAccess(const Instruction *I) {
include/llvm/Analysis/MemorySSAUpdater.h 159 Instruction *Start);
175 Instruction *Start);
203 MemoryAccess *createMemoryAccessInBB(Instruction *I, MemoryAccess *Definition,
217 MemoryUseOrDef *createMemoryAccessBefore(Instruction *I,
220 MemoryUseOrDef *createMemoryAccessAfter(Instruction *I,
235 void removeMemoryAccess(const Instruction *I, bool OptimizePhis = false) {
252 void changeToUnreachable(const Instruction *I);
268 void moveAllAccesses(BasicBlock *From, BasicBlock *To, Instruction *Start);
include/llvm/Analysis/MustExecute.h 91 virtual bool isGuaranteedToExecute(const Instruction &Inst,
116 virtual bool isGuaranteedToExecute(const Instruction &Inst,
145 virtual bool isGuaranteedToExecute(const Instruction &Inst,
156 bool doesNotWriteMemoryBefore(const Instruction &I, const Loop *CurLoop)
162 void insertInstructionTo(const Instruction *Inst, const BasicBlock *BB);
167 void removeInstruction(const Instruction *Inst);
269 typedef const Instruction *value_type;
271 typedef const Instruction **pointer;
272 typedef const Instruction *&reference;
322 const Instruction *&operator*() { return CurInst; }
323 const Instruction *getCurrentInst() const { return CurInst; }
326 bool count(const Instruction *I) const { return Visited.count(I); }
329 using VisitedSetTy = DenseSet<const Instruction *>;
332 MustBeExecutedIterator(ExplorerTy &Explorer, const Instruction *I);
335 void reset(const Instruction *I);
341 const Instruction *advance();
353 const Instruction *CurInst;
391 iterator &begin(const Instruction *PP) {
399 const_iterator &begin(const Instruction *PP) const {
406 iterator &end(const Instruction *) { return EndIterator; }
409 const_iterator &end(const Instruction *) const { return EndIterator; }
413 llvm::iterator_range<iterator> range(const Instruction *PP) {
418 llvm::iterator_range<const_iterator> range(const Instruction *PP) const {
429 const Instruction *
431 const Instruction *PP);
441 DenseMap<const Instruction *, MustBeExecutedIterator *>
include/llvm/Analysis/ObjCARCAnalysisUtils.h 145 inline bool IsNoopInstruction(const Instruction *I) {
include/llvm/Analysis/OrderedBasicBlock.h 36 SmallDenseMap<const Instruction *, unsigned, 32> NumberedInsts;
51 bool comesBefore(const Instruction *A, const Instruction *B);
51 bool comesBefore(const Instruction *A, const Instruction *B);
61 bool dominates(const Instruction *A, const Instruction *B);
61 bool dominates(const Instruction *A, const Instruction *B);
64 void eraseInstruction(const Instruction *I);
69 void replaceInstruction(const Instruction *Old, const Instruction *New);
69 void replaceInstruction(const Instruction *Old, const Instruction *New);
include/llvm/Analysis/OrderedInstructions.h 40 bool localDominates(const Instruction *, const Instruction *) const;
40 bool localDominates(const Instruction *, const Instruction *) const;
47 bool dominates(const Instruction *, const Instruction *) const;
47 bool dominates(const Instruction *, const Instruction *) const;
53 bool dfsBefore(const Instruction *, const Instruction *) const;
53 bool dfsBefore(const Instruction *, const Instruction *) const;
include/llvm/Analysis/PHITransAddr.h 49 SmallVector<Instruction*, 4> InstInputs;
55 if (Instruction *I = dyn_cast<Instruction>(Addr))
55 if (Instruction *I = dyn_cast<Instruction>(Addr))
93 SmallVectorImpl<Instruction *> &NewInsts);
113 SmallVectorImpl<Instruction *> &NewInsts);
118 if (Instruction *VI = dyn_cast<Instruction>(V))
118 if (Instruction *VI = dyn_cast<Instruction>(V))
include/llvm/Analysis/ProfileSummaryInfo.h 103 Optional<uint64_t> getProfileCount(const Instruction *CallInst,
include/llvm/Analysis/PtrUseVisitor.h 83 Instruction *getAbortingInst() const { return AbortedInfo.getPointer(); }
88 Instruction *getEscapingInst() const { return EscapedInfo.getPointer(); }
92 void setAborted(Instruction *I = nullptr) {
99 void setEscaped(Instruction *I = nullptr) {
108 void setEscapedAndAborted(Instruction *I = nullptr) {
114 PointerIntPair<Instruction *, 1, bool> AbortedInfo, EscapedInfo;
169 void enqueueUsers(Instruction &I);
220 PtrInfo visitPtr(Instruction &I) {
241 Instruction *I = cast<Instruction>(U->getUser());
241 Instruction *I = cast<Instruction>(U->getUser());
include/llvm/Analysis/RegionInfo.h 96 using InstT = Instruction;
include/llvm/Analysis/ScalarEvolution.h 976 const SCEV *getElementSize(Instruction *Inst);
1478 const SCEV *createNodeForSelectOrPHI(Instruction *I, Value *Cond,
1491 void forgetSymbolicName(Instruction *I, const SCEV *SymName);
1806 bool isSCEVExprNeverPoison(const Instruction *I);
1812 bool isAddRecNeverPoison(const Instruction *I, const Loop *L);
include/llvm/Analysis/ScalarEvolutionExpander.h 36 bool isSafeToExpandAt(const SCEV *S, const Instruction *InsertionPoint,
53 DenseMap<std::pair<const SCEV *, Instruction *>, TrackingVH<Value>>
75 Instruction *IVIncInsertPos;
181 const Instruction *At = nullptr) {
193 Instruction *getIVIncOperand(Instruction *IncV, Instruction *InsertPos,
193 Instruction *getIVIncOperand(Instruction *IncV, Instruction *InsertPos,
193 Instruction *getIVIncOperand(Instruction *IncV, Instruction *InsertPos,
197 bool hoistIVInc(Instruction *IncV, Instruction *InsertPos);
197 bool hoistIVInc(Instruction *IncV, Instruction *InsertPos);
207 Value *expandCodeFor(const SCEV *SH, Type *Ty, Instruction *I);
219 Value *expandCodeForPredicate(const SCEVPredicate *Pred, Instruction *Loc);
224 Instruction *Loc);
227 Value *generateOverflowCheck(const SCEVAddRecExpr *AR, Instruction *Loc,
232 Value *expandWrapPredicate(const SCEVWrapPredicate *P, Instruction *Loc);
237 Instruction *Loc);
240 void setIVIncInsertPos(const Loop *L, Instruction *Pos) {
275 void setInsertPoint(Instruction *IP) {
296 bool isInsertedInstruction(Instruction *I) const {
303 Value *getExactExistingExpansion(const SCEV *S, const Instruction *At,
319 getRelatedExistingExpansion(const SCEV *S, const Instruction *At, Loop *L);
326 const Instruction *At,
332 Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS, Value *RHS,
339 Instruction::CastOps Op,
355 FindValueInExprValueMap(const SCEV *S, const Instruction *InsertPt);
394 bool isNormalAddRecExprPHI(PHINode *PN, Instruction *IncV, const Loop *L);
396 bool isExpandedAddRecExprPHI(PHINode *PN, Instruction *IncV, const Loop *L);
408 void hoistBeforePos(DominatorTree *DT, Instruction *InstToHoist,
409 Instruction *Pos, PHINode *LoopPhi);
411 void fixupInsertPoints(Instruction *I);
include/llvm/Analysis/SparsePropagation.h 89 ComputeInstructionState(Instruction &I,
191 void getFeasibleSuccessors(Instruction &TI, SmallVectorImpl<bool> &Succs,
194 void visitInst(Instruction &I);
196 void visitTerminator(Instruction &TI);
288 Instruction &TI, SmallVectorImpl<bool> &Succs, bool AggressiveUndef) {
372 Instruction *TI = From->getTerminator();
384 Instruction &TI) {
449 void SparseSolver<LatticeKey, LatticeVal, KeyInfo>::visitInst(Instruction &I) {
481 if (Instruction *Inst = dyn_cast<Instruction>(U))
481 if (Instruction *Inst = dyn_cast<Instruction>(U))
495 for (Instruction &I : *BB)
include/llvm/Analysis/SyncDependenceAnalysis.h 59 const ConstBlockSet &join_blocks(const Instruction &Term);
79 std::map<const Instruction *, std::unique_ptr<ConstBlockSet>>
include/llvm/Analysis/TargetFolder.h 107 Constant *CreateBinOp(Instruction::BinaryOps Opc,
127 Constant *CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const {
170 Constant *CreateCast(Instruction::CastOps Op, Constant *C,
193 return CreateCast(Instruction::BitCast, C, DestTy);
196 return CreateCast(Instruction::IntToPtr, C, DestTy);
199 return CreateCast(Instruction::PtrToInt, C, DestTy);
include/llvm/Analysis/TargetTransformInfo.h 164 int getInstructionCost(const Instruction *I, enum TargetCostKind kind) const {
231 int getExtCost(const Instruction *I, const Value *Src) const;
294 int getMemcpyCost(const Instruction *I) const;
552 Instruction *I = nullptr) const;
609 bool hasVolatileVariant(Instruction *I, unsigned AddrSpace) const;
637 bool isProfitableToHoist(Instruction *I) const;
832 const Instruction &I, bool &AllowPromotionWithoutCommonHeader) const;
911 const Instruction *I = nullptr) const;
926 Type *CondTy = nullptr, const Instruction *I = nullptr) const;
935 const Instruction *I = nullptr) const;
1142 int getInstructionLatency(const Instruction *I) const;
1146 int getInstructionThroughput(const Instruction *I) const;
1166 virtual int getExtCost(const Instruction *I, const Value *Src) = 0;
1178 virtual int getMemcpyCost(const Instruction *I) = 0;
1204 Instruction *I) = 0;
1222 virtual bool hasVolatileVariant(Instruction *I, unsigned AddrSpace) = 0;
1229 virtual bool isProfitableToHoist(Instruction *I) = 0;
1270 const Instruction &I, bool &AllowPromotionWithoutCommonHeader) = 0;
1301 const Instruction *I) = 0;
1306 Type *CondTy, const Instruction *I) = 0;
1310 unsigned AddressSpace, const Instruction *I) = 0;
1376 virtual int getInstructionLatency(const Instruction *I) = 0;
1398 int getExtCost(const Instruction *I, const Value *Src) override {
1426 int getMemcpyCost(const Instruction *I) override {
1477 Instruction *I) override {
1527 bool hasVolatileVariant(Instruction *I, unsigned AddrSpace) override {
1545 bool isProfitableToHoist(Instruction *I) override {
1643 const Instruction &I, bool &AllowPromotionWithoutCommonHeader) override {
1698 const Instruction *I) override {
1709 const Instruction *I) override {
1716 unsigned AddressSpace, const Instruction *I) override {
1850 int getInstructionLatency(const Instruction *I) override {
include/llvm/Analysis/TargetTransformInfoImpl.h 53 case Instruction::GetElementPtr:
56 case Instruction::BitCast:
65 case Instruction::FDiv:
66 case Instruction::FRem:
67 case Instruction::SDiv:
68 case Instruction::SRem:
69 case Instruction::UDiv:
70 case Instruction::URem:
73 case Instruction::IntToPtr: {
84 case Instruction::PtrToInt: {
95 case Instruction::Trunc:
122 int getExtCost(const Instruction *I, const Value *Src) {
145 unsigned getMemcpyCost(const Instruction *I) {
221 unsigned AddrSpace, Instruction *I = nullptr) {
274 bool hasVolatileVariant(Instruction *I, unsigned AddrSpace) { return false; }
291 bool isProfitableToHoist(Instruction *I) { return true; }
381 shouldConsiderAddressTypePromotion(const Instruction &I,
432 const Instruction *I) { return 1; }
442 const Instruction *I) {
451 unsigned AddressSpace, const Instruction *I) {
799 return static_cast<T *>(this)->getMemcpyCost(dyn_cast<Instruction>(U));
879 return static_cast<T *>(this)->getExtCost(cast<Instruction>(U),
887 int getInstructionLatency(const Instruction *I) {
include/llvm/Analysis/TypeMetadataUtils.h 50 SmallVectorImpl<Instruction *> &LoadedPtrs,
51 SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses,
include/llvm/Analysis/ValueTracking.h 57 const Instruction *CxtI = nullptr,
65 const Instruction *CxtI = nullptr,
80 const Instruction *CxtI = nullptr,
92 const Instruction *CxtI = nullptr,
96 bool isOnlyUsedInZeroEqualityComparison(const Instruction *CxtI);
106 const Instruction *CxtI = nullptr,
120 const Instruction *CxtI = nullptr,
128 const Instruction *CxtI = nullptr,
136 const Instruction *CxtI = nullptr,
144 const Instruction *CxtI = nullptr,
160 const Instruction *CxtI = nullptr,
173 const Instruction *CxtI = nullptr,
237 Instruction *InsertBefore = nullptr);
418 const Instruction *CtxI = nullptr,
429 bool mayBeMemoryDependent(const Instruction &I);
433 bool isAssumeLikeIntrinsic(const Instruction *I);
438 bool isValidAssumeForContext(const Instruction *I, const Instruction *CxtI,
438 bool isValidAssumeForContext(const Instruction *I, const Instruction *CxtI,
456 const Instruction *CxtI,
462 const Instruction *CxtI,
469 const Instruction *CxtI,
475 const Instruction *CxtI = nullptr,
481 const Instruction *CxtI = nullptr,
486 const Instruction *CxtI,
491 const Instruction *CxtI,
518 bool isGuaranteedToTransferExecutionToSuccessor(const Instruction *I);
531 bool isGuaranteedToExecuteForEveryIteration(const Instruction *I,
543 bool propagatesFullPoison(const Instruction *I);
548 const Value *getGuaranteedNonFullPoisonOp(const Instruction *I);
553 bool mustTriggerUB(const Instruction *I,
562 bool programUndefinedIfFullPoison(const Instruction *PoisonI);
621 Instruction::CastOps *CastOp = nullptr,
638 Instruction::CastOps *CastOp = nullptr, unsigned Depth = 0);
670 const Instruction *ContextI,
include/llvm/Analysis/VectorUtils.h 231 MapVector<Instruction*, uint64_t>
248 MDNode *intersectAccessGroups(const Instruction *Inst1,
249 const Instruction *Inst2);
259 Instruction *propagateMetadata(Instruction *I, ArrayRef<Value *> VL);
259 Instruction *propagateMetadata(Instruction *I, ArrayRef<Value *> VL);
273 const InterleaveGroup<Instruction> &Group);
388 InterleaveGroup(InstTy *Instr, int32_t Stride, Align Alignment)
407 bool insertMember(InstTy *Instr, int32_t Index, Align NewAlign) {
447 InstTy *getMember(uint32_t Index) const {
458 uint32_t getIndex(const InstTy *Instr) const {
467 InstTy *getInsertPos() const { return InsertPos; }
468 void setInsertPos(InstTy *Inst) { InsertPos = Inst; }
476 void addMetadata(InstTy *NewInst) const;
499 DenseMap<int32_t, InstTy *> Members;
514 InstTy *InsertPos;
545 SmallPtrSet<InterleaveGroup<Instruction> *, 4> DelSet;
557 bool isInterleaved(Instruction *Instr) const {
564 InterleaveGroup<Instruction> *
565 getInterleaveGroup(const Instruction *Instr) const {
571 iterator_range<SmallPtrSetIterator<llvm::InterleaveGroup<Instruction> *>>
603 DenseMap<Instruction *, InterleaveGroup<Instruction> *> InterleaveGroupMap;
603 DenseMap<Instruction *, InterleaveGroup<Instruction> *> InterleaveGroupMap;
605 SmallPtrSet<InterleaveGroup<Instruction> *, 4> InterleaveGroups;
609 DenseMap<Instruction *, SmallPtrSet<Instruction *, 2>> Dependences;
609 DenseMap<Instruction *, SmallPtrSet<Instruction *, 2>> Dependences;
632 using StrideEntry = std::pair<Instruction *, StrideDescriptor>;
638 InterleaveGroup<Instruction> *
639 createInterleaveGroup(Instruction *Instr, int Stride, Align Alignment) {
643 new InterleaveGroup<Instruction>(Instr, Stride, Alignment);
649 void releaseGroup(InterleaveGroup<Instruction> *Group) {
651 if (Instruction *Member = Group->getMember(i))
660 MapVector<Instruction *, StrideDescriptor> &AccessStrideInfo,
698 auto *Src = A->first;
702 auto *Sink = B->first;
include/llvm/CodeGen/Analysis.h 133 bool attributesPermitTailCall(const Function *F, const Instruction *I,
141 bool returnTypeIsEligibleForTailCall(const Function *F, const Instruction *I,
include/llvm/CodeGen/BasicTTIImpl.h 90 Instruction::ExtractElement, Ty, 0);
94 Instruction::InsertElement, Ty, i);
113 ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
115 ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
135 Instruction::ExtractElement, Ty, i + Index);
137 Instruction::InsertElement, SubTy, i);
157 Instruction::ExtractElement, SubTy, i);
159 Instruction::InsertElement, Ty, i + Index);
239 unsigned AddrSpace, Instruction *I = nullptr) {
278 bool isProfitableToHoist(Instruction *I) {
294 int getExtCost(const Instruction *I, const Value *Src) {
416 case Instruction::Trunc:
420 case Instruction::ZExt:
425 case Instruction::AddrSpaceCast:
511 int getInstructionLatency(const Instruction *I) {
567 ->getVectorInstrCost(Instruction::InsertElement, Ty, i);
570 ->getVectorInstrCost(Instruction::ExtractElement, Ty, i);
688 const Instruction *I = nullptr) {
700 if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc)
700 if (Opcode == Instruction::BitCast || Opcode == Instruction::Trunc)
704 if (Opcode == Instruction::Trunc &&
708 if (Opcode == Instruction::ZExt &&
712 if (Opcode == Instruction::AddrSpaceCast &&
719 if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt) &&
719 if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt) &&
724 ((Opcode == Instruction::ZExt) ? ISD::ZEXTLOAD : ISD::SEXTLOAD);
737 if (Opcode == Instruction::BitCast)
756 if (Opcode == Instruction::ZExt)
760 if (Opcode == Instruction::SExt)
802 if (Opcode == Instruction::BitCast)
815 Instruction::ExtractElement, VecTy, Index) +
826 const Instruction *I) {
874 const Instruction *I = nullptr) {
888 if (Opcode == Instruction::Store)
896 Cost += getScalarizationOverhead(Src, Opcode != Instruction::Store,
897 Opcode == Instruction::Store);
952 if (Opcode == Instruction::Load && VecTySize > VecTyLTSize) {
973 if (Opcode == Instruction::Load) {
992 Instruction::ExtractElement, VT, Index + i * Factor);
998 Instruction::InsertElement, SubVT, i);
1014 Instruction::ExtractElement, SubVT, i);
1019 ->getVectorInstrCost(Instruction::InsertElement, VT, i);
1041 Instruction::ExtractElement, SubVT, i);
1045 Instruction::InsertElement, MaskVT, i);
1100 Instruction::Store, Args[0]->getType(), Args[1], VarMask, Alignment);
1107 return ConcreteTTI->getGatherScatterOpCost(Instruction::Load, RetTy,
1284 return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Store, Tys[0], 0,
1287 return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Load, RetTy, 0, 0);
1289 return ConcreteTTI->getArithmeticReductionCost(Instruction::Add, Tys[0],
1292 return ConcreteTTI->getArithmeticReductionCost(Instruction::Mul, Tys[0],
1295 return ConcreteTTI->getArithmeticReductionCost(Instruction::And, Tys[0],
1298 return ConcreteTTI->getArithmeticReductionCost(Instruction::Or, Tys[0],
1301 return ConcreteTTI->getArithmeticReductionCost(Instruction::Xor, Tys[0],
1305 Instruction::FAdd, Tys[0],
1310 Instruction::FMul, Tys[0],
1367 IID == Intrinsic::smul_fix ? Instruction::SExt : Instruction::ZExt;
1367 IID == Intrinsic::smul_fix ? Instruction::SExt : Instruction::ZExt;
1371 Cost += ConcreteTTI->getArithmeticInstrCost(Instruction::Mul, ExtTy);
1373 2 * ConcreteTTI->getCastInstrCost(Instruction::Trunc, RetTy, ExtTy);
1374 Cost += ConcreteTTI->getArithmeticInstrCost(Instruction::LShr, RetTy,
1377 Cost += ConcreteTTI->getArithmeticInstrCost(Instruction::Shl, RetTy,
1380 Cost += ConcreteTTI->getArithmeticInstrCost(Instruction::Or, RetTy);
1431 IID == Intrinsic::smul_fix ? Instruction::SExt : Instruction::ZExt;
1431 IID == Intrinsic::smul_fix ? Instruction::SExt : Instruction::ZExt;
1435 Cost += ConcreteTTI->getArithmeticInstrCost(Instruction::Mul, ExtTy);
1437 2 * ConcreteTTI->getCastInstrCost(Instruction::Trunc, MulTy, ExtTy);
1438 Cost += ConcreteTTI->getArithmeticInstrCost(Instruction::LShr, MulTy,
1444 Instruction::AShr, MulTy, TTI::OK_AnyValue,
1640 ConcreteTTI->getVectorInstrCost(Instruction::ExtractElement, Ty, 0);
1654 CmpOpcode = Instruction::FCmp;
1658 CmpOpcode = Instruction::ICmp;
1679 ConcreteTTI->getCmpSelInstrCost(Instruction::Select, SubTy, CondTy,
1704 ConcreteTTI->getCmpSelInstrCost(Instruction::Select, Ty, CondTy,
1709 ConcreteTTI->getVectorInstrCost(Instruction::ExtractElement, Ty, 0);
include/llvm/CodeGen/CommandFlags.inc 398 for (auto &I : B)
include/llvm/CodeGen/FastISel.h 264 bool selectInstruction(const Instruction *I);
296 bool tryToFoldLoad(const LoadInst *LI, const Instruction *FoldInst);
338 virtual bool fastSelectInstruction(const Instruction *I) = 0;
505 MachineMemOperand *createMachineMemOperandFor(const Instruction *I) const;
include/llvm/CodeGen/FunctionLoweringInfo.h 123 DenseMap<const Instruction *, StatepointSpillMap> StatepointSpillMaps;
include/llvm/CodeGen/GlobalISel/IRTranslator.h 196 bool translate(const Instruction &Inst);
582 unsigned getMemOpAlignment(const Instruction &I);
include/llvm/CodeGen/MachineInstr.h 1637 static uint16_t copyFlagsFromInstruction(const Instruction &I);
1640 void copyIRFlags(const Instruction &I);
include/llvm/CodeGen/SelectionDAGISel.h 61 SmallPtrSet<const Instruction *, 4> ElidedArgCopyInstrs;
include/llvm/CodeGen/SelectionDAGNodes.h 1136 SDLoc(const Instruction *I, int Order) : IROrder(Order) {
include/llvm/CodeGen/StackProtector.h 98 bool HasAddressTaken(const Instruction *AI);
include/llvm/CodeGen/SwiftErrorValueTracking.h 56 llvm::DenseMap<PointerIntPair<const Instruction *, 1, bool>, Register>
88 Register getOrCreateVRegDefAt(const Instruction *, const MachineBasicBlock *,
93 Register getOrCreateVRegUseAt(const Instruction *, const MachineBasicBlock *,
include/llvm/CodeGen/TargetLowering.h 497 virtual bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const {
1728 virtual bool shouldInsertFencesForAtomic(const Instruction *I) const {
1801 virtual Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst,
1801 virtual Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst,
1809 virtual Instruction *emitTrailingFence(IRBuilder<> &Builder,
1810 Instruction *Inst,
2210 Instruction *I = nullptr) const;
2338 virtual bool isProfitableToHoist(Instruction *I) const { return true; }
2349 bool isExtFree(const Instruction *I) const {
2351 case Instruction::FPExt:
2356 case Instruction::ZExt:
2360 case Instruction::SExt:
2374 bool isExtLoad(const LoadInst *Load, const Instruction *Ext,
2426 virtual bool shouldSinkOperands(Instruction *I,
2838 virtual bool isExtFreeImpl(const Instruction *I) const { return false; }
3755 virtual MachineMemOperand::Flags getMMOFlags(const Instruction &I) const {
include/llvm/CodeGen/WinEHFuncInfo.h 91 DenseMap<const Instruction *, int> EHPadStateMap;
include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h 488 Constant *Init = ConstantExpr::getCast(Instruction::IntToPtr,
include/llvm/FuzzMutate/IRMutator.h 51 virtual void mutate(Instruction &I, RandomIRBuilder &IB) {
102 void mutate(Instruction &Inst, RandomIRBuilder &IB) override;
include/llvm/FuzzMutate/OpDescriptor.h 92 std::function<Value *(ArrayRef<Value *>, Instruction *)> BuilderFunc;
include/llvm/FuzzMutate/Operations.h 37 OpDescriptor binOpDescriptor(unsigned Weight, Instruction::BinaryOps Op);
38 OpDescriptor cmpOpDescriptor(unsigned Weight, Instruction::OtherOps CmpOp,
include/llvm/FuzzMutate/RandomIRBuilder.h 37 Value *findOrCreateSource(BasicBlock &BB, ArrayRef<Instruction *> Insts);
43 Value *findOrCreateSource(BasicBlock &BB, ArrayRef<Instruction *> Insts,
46 Value *newSource(BasicBlock &BB, ArrayRef<Instruction *> Insts,
50 void connectToSink(BasicBlock &BB, ArrayRef<Instruction *> Insts, Value *V);
52 void newSink(BasicBlock &BB, ArrayRef<Instruction *> Insts, Value *V);
53 Value *findPointer(BasicBlock &BB, ArrayRef<Instruction *> Insts,
include/llvm/IR/AssemblyAnnotationWriter.h 51 virtual void emitInstructionAnnot(const Instruction *,
include/llvm/IR/AutoUpgrade.h 70 Instruction *UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy,
71 Instruction *&Temp);
include/llvm/IR/BasicBlock.h 60 using InstListType = SymbolTableList<Instruction>;
121 const Instruction *getTerminator() const LLVM_READONLY;
122 Instruction *getTerminator() {
151 const Instruction* getFirstNonPHI() const;
152 Instruction* getFirstNonPHI() {
159 const Instruction* getFirstNonPHIOrDbg() const;
160 Instruction* getFirstNonPHIOrDbg() {
167 const Instruction* getFirstNonPHIOrDbgOrLifetime() const;
168 Instruction* getFirstNonPHIOrDbgOrLifetime() {
186 std::function<bool(const Instruction &)>>>
192 std::function<bool(Instruction &)>>>
197 std::function<bool(const Instruction &)>>::difference_type
285 inline const Instruction &front() const { return InstList.front(); }
286 inline Instruction &front() { return InstList.front(); }
287 inline const Instruction &back() const { return InstList.back(); }
288 inline Instruction &back() { return InstList.back(); }
390 BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "") {
include/llvm/IR/CFG.h 52 if (auto *Inst = dyn_cast<Instruction>(*It))
52 if (auto *Inst = dyn_cast<Instruction>(*It))
75 return cast<Instruction>(*It)->getParent();
137 : public iterator_facade_base<SuccIterator<InstructionT, BlockT>,
146 InstructionT *Inst;
148 using Self = SuccIterator<InstructionT, BlockT>;
180 explicit inline SuccIterator(InstructionT *Inst) : Inst(Inst), Idx(0) {}
182 inline SuccIterator(InstructionT *Inst, bool) : Inst(Inst) {
240 using succ_iterator = SuccIterator<Instruction, BasicBlock>;
241 using succ_const_iterator = SuccIterator<const Instruction, const BasicBlock>;
245 inline succ_iterator succ_begin(Instruction *I) { return succ_iterator(I); }
246 inline succ_const_iterator succ_begin(const Instruction *I) {
249 inline succ_iterator succ_end(Instruction *I) { return succ_iterator(I, true); }
250 inline succ_const_iterator succ_end(const Instruction *I) {
253 inline bool succ_empty(const Instruction *I) {
256 inline unsigned succ_size(const Instruction *I) {
259 inline succ_range successors(Instruction *I) {
262 inline succ_const_range successors(const Instruction *I) {
include/llvm/IR/CallSite.h 60 PointerIntPair<InstrTy *, 2, int> I;
74 if (InstrTy *II = dyn_cast<InstrTy>(V)) {
74 if (InstrTy *II = dyn_cast<InstrTy>(V)) {
75 if (II->getOpcode() == Instruction::Call)
77 if (II->getOpcode() == Instruction::Invoke)
79 if (II->getOpcode() == Instruction::CallBr)
96 InstrTy *getInstruction() const { return I.getPointer(); }
97 InstrTy *operator->() const { return I.getPointer(); }
673 Instruction, CallInst, InvokeInst,
681 explicit CallSite(Instruction *II) : CallSiteBase(II) {}
772 Instruction *getInstruction() const { return CS.getInstruction(); }
912 explicit ImmutableCallSite(const Instruction *II) : CallSiteBase(II) {}
include/llvm/IR/ConstantFolder.h 115 Constant *CreateBinOp(Instruction::BinaryOps Opc,
137 Constant *CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const {
184 Constant *CreateCast(Instruction::CastOps Op, Constant *C,
208 return CreateCast(Instruction::BitCast, C, DestTy);
212 return CreateCast(Instruction::IntToPtr, C, DestTy);
216 return CreateCast(Instruction::PtrToInt, C, DestTy);
include/llvm/IR/ConstantRange.h 143 static ConstantRange makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
149 static ConstantRange makeExactNoWrapRegion(Instruction::BinaryOps BinOp,
294 ConstantRange castOp(Instruction::CastOps CastOp,
326 ConstantRange binaryOp(Instruction::BinaryOps BinOp,
333 ConstantRange overflowingBinaryOp(Instruction::BinaryOps BinOp,
include/llvm/IR/Constants.h 1253 Instruction *getAsInstruction();
include/llvm/IR/DIBuilder.h 81 Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
83 BasicBlock *InsertBB, Instruction *InsertBefore);
86 Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
87 BasicBlock *InsertBB, Instruction *InsertBefore);
90 Instruction *
93 BasicBlock *InsertBB, Instruction *InsertBefore);
800 Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
810 Instruction *insertDeclare(llvm::Value *Storage, DILocalVariable *VarInfo,
812 Instruction *InsertBefore);
818 Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
819 Instruction *InsertBefore);
825 Instruction *insertLabel(DILabel *LabelInfo, const DILocation *DL,
834 Instruction *insertDbgValueIntrinsic(llvm::Value *Val,
846 Instruction *insertDbgValueIntrinsic(llvm::Value *Val,
850 Instruction *InsertBefore);
include/llvm/IR/DebugInfo.h 69 void processInstruction(const Module &M, const Instruction &I);
include/llvm/IR/DiagnosticInfo.h 135 const Instruction *Instr = nullptr;
159 DiagnosticInfoInlineAsm(const Instruction &I, const Twine &MsgStr,
164 const Instruction *getInstruction() const { return Instr; }
686 const Instruction *Inst);
732 const Instruction *Inst);
784 const Instruction *Inst);
1010 DiagnosticInfoMisExpect(const Instruction *Inst, Twine &Msg);
include/llvm/IR/Dominators.h 165 bool dominates(const Instruction *Def, const Use &U) const;
166 bool dominates(const Instruction *Def, const Instruction *User) const;
166 bool dominates(const Instruction *Def, const Instruction *User) const;
167 bool dominates(const Instruction *Def, const BasicBlock *BB) const;
include/llvm/IR/IRBuilder.h 63 void InsertHelper(Instruction *I, const Twine &Name,
73 std::function<void(Instruction *)> Callback;
76 IRBuilderCallbackInserter(std::function<void(Instruction *)> Callback)
80 void InsertHelper(Instruction *I, const Twine &Name,
139 void SetInsertPoint(Instruction *I) {
163 void SetInstDebugLocation(Instruction *I) const {
717 CallInst *CreateGCResult(Instruction *Statepoint,
723 CallInst *CreateGCRelocate(Instruction *Statepoint,
732 Instruction *FMFSource = nullptr,
738 Instruction *FMFSource = nullptr,
746 Instruction *FMFSource = nullptr,
820 explicit IRBuilder(Instruction *IP, MDNode *FPMathTag = nullptr,
845 InstTy *Insert(InstTy *I, const Twine &Name = "") const {
845 InstTy *Insert(InstTy *I, const Twine &Name = "") const {
915 Instruction *MDSrc) {
1083 Instruction *setFPAttrs(Instruction *I, MDNode *FPMD,
1083 Instruction *setFPAttrs(Instruction *I, MDNode *FPMD,
1093 Value *foldConstant(Instruction::BinaryOps Opc, Value *L,
1138 return CreateInsertNUWNSWBinOp(Instruction::Add, LHS, RHS, Name,
1155 return CreateInsertNUWNSWBinOp(Instruction::Sub, LHS, RHS, Name,
1172 return CreateInsertNUWNSWBinOp(Instruction::Mul, LHS, RHS, Name,
1213 if (Value *V = foldConstant(Instruction::URem, LHS, RHS, Name)) return V;
1218 if (Value *V = foldConstant(Instruction::SRem, LHS, RHS, Name)) return V;
1227 return CreateInsertNUWNSWBinOp(Instruction::Shl, LHS, RHS, Name,
1336 if (Value *V = foldConstant(Instruction::Xor, LHS, RHS, Name)) return V;
1354 if (Value *V = foldConstant(Instruction::FAdd, L, R, Name)) return V;
1355 Instruction *I = setFPAttrs(BinaryOperator::CreateFAdd(L, R), FPMD, FMF);
1361 Value *CreateFAddFMF(Value *L, Value *R, Instruction *FMFSource,
1367 if (Value *V = foldConstant(Instruction::FAdd, L, R, Name)) return V;
1368 Instruction *I = setFPAttrs(BinaryOperator::CreateFAdd(L, R), nullptr,
1379 if (Value *V = foldConstant(Instruction::FSub, L, R, Name)) return V;
1380 Instruction *I = setFPAttrs(BinaryOperator::CreateFSub(L, R), FPMD, FMF);
1386 Value *CreateFSubFMF(Value *L, Value *R, Instruction *FMFSource,
1392 if (Value *V = foldConstant(Instruction::FSub, L, R, Name)) return V;
1393 Instruction *I = setFPAttrs(BinaryOperator::CreateFSub(L, R), nullptr,
1404 if (Value *V = foldConstant(Instruction::FMul, L, R, Name)) return V;
1405 Instruction *I = setFPAttrs(BinaryOperator::CreateFMul(L, R), FPMD, FMF);
1411 Value *CreateFMulFMF(Value *L, Value *R, Instruction *FMFSource,
1417 if (Value *V = foldConstant(Instruction::FMul, L, R, Name)) return V;
1418 Instruction *I = setFPAttrs(BinaryOperator::CreateFMul(L, R), nullptr,
1429 if (Value *V = foldConstant(Instruction::FDiv, L, R, Name)) return V;
1430 Instruction *I = setFPAttrs(BinaryOperator::CreateFDiv(L, R), FPMD, FMF);
1436 Value *CreateFDivFMF(Value *L, Value *R, Instruction *FMFSource,
1442 if (Value *V = foldConstant(Instruction::FDiv, L, R, Name)) return V;
1443 Instruction *I = setFPAttrs(BinaryOperator::CreateFDiv(L, R), nullptr,
1454 if (Value *V = foldConstant(Instruction::FRem, L, R, Name)) return V;
1455 Instruction *I = setFPAttrs(BinaryOperator::CreateFRem(L, R), FPMD, FMF);
1461 Value *CreateFRemFMF(Value *L, Value *R, Instruction *FMFSource,
1467 if (Value *V = foldConstant(Instruction::FRem, L, R, Name)) return V;
1468 Instruction *I = setFPAttrs(BinaryOperator::CreateFRem(L, R), nullptr,
1473 Value *CreateBinOp(Instruction::BinaryOps Opc,
1477 Instruction *BinOp = BinaryOperator::Create(Opc, LHS, RHS);
1484 Intrinsic::ID ID, Value *L, Value *R, Instruction *FMFSource = nullptr,
1530 Value *CreateFNegFMF(Value *V, Instruction *FMFSource,
1545 Value *CreateUnOp(Instruction::UnaryOps Opc,
1550 Instruction *UnOp = UnaryOperator::Create(Opc, V);
1561 if (Instruction::isBinaryOp(Opc)) {
1566 if (Instruction::isUnaryOp(Opc)) {
1890 return CreateCast(Instruction::Trunc, V, DestTy, Name);
1894 return CreateCast(Instruction::ZExt, V, DestTy, Name);
1898 return CreateCast(Instruction::SExt, V, DestTy, Name);
1935 return CreateCast(Instruction::FPToUI, V, DestTy, Name);
1942 return CreateCast(Instruction::FPToSI, V, DestTy, Name);
1946 return CreateCast(Instruction::UIToFP, V, DestTy, Name);
1950 return CreateCast(Instruction::SIToFP, V, DestTy, Name);
1959 return CreateCast(Instruction::FPTrunc, V, DestTy, Name);
1966 return CreateCast(Instruction::FPExt, V, DestTy, Name);
1971 return CreateCast(Instruction::PtrToInt, V, DestTy, Name);
1976 return CreateCast(Instruction::IntToPtr, V, DestTy, Name);
1981 return CreateCast(Instruction::BitCast, V, DestTy, Name);
1986 return CreateCast(Instruction::AddrSpaceCast, V, DestTy, Name);
2016 Value *CreateCast(Instruction::CastOps Op, Value *V, Type *DestTy,
2079 Instruction *FMFSource = nullptr, const Twine &Name = "",
2310 const Twine &Name = "", Instruction *MDFrom = nullptr) {
include/llvm/IR/InstIterator.h 36 using IIty = II_t;
53 InstIterator(const InstIterator<A,B,C,D> &II)
57 InstIterator(InstIterator<A,B,C,D> &II)
123 BasicBlock::iterator, Instruction>;
127 const Instruction>;
include/llvm/IR/InstVisitor.h 113 RetTy visit(Instruction *I) { return visit(*I); }
117 RetTy visit(Instruction &I) {
261 RetTy visitTerminator(Instruction &I) { DELEGATE(Instruction);}
288 Instruction &I = *CS.getInstruction();
298 void visitInstruction(Instruction &I) {} // Ignore unhandled instructions
323 RetTy delegateCallInst(Instruction &I) {
include/llvm/IR/InstrTypes.h 57 class UnaryInstruction : public Instruction {
60 Instruction *IB = nullptr)
79 static bool classof(const Instruction *I) {
81 I->getOpcode() == Instruction::Alloca ||
82 I->getOpcode() == Instruction::Load ||
83 I->getOpcode() == Instruction::VAArg ||
84 I->getOpcode() == Instruction::ExtractValue ||
88 return isa<Instruction>(V) && classof(cast<Instruction>(V));
88 return isa<Instruction>(V) && classof(cast<Instruction>(V));
108 const Twine &Name, Instruction *InsertBefore);
126 Instruction *InsertBefore = nullptr);
159 Instruction *CopyO,
166 static UnaryOperator *CreateFNegFMF(Value *Op, Instruction *FMFSource,
168 return CreateWithCopiedFlags(Instruction::FNeg, Op, FMFSource, Name);
176 static bool classof(const Instruction *I) {
180 return isa<Instruction>(V) && classof(cast<Instruction>(V));
180 return isa<Instruction>(V) && classof(cast<Instruction>(V));
188 class BinaryOperator : public Instruction {
193 const Twine &Name, Instruction *InsertBefore);
218 Instruction *InsertBefore = nullptr);
251 Instruction *CopyO,
259 Instruction *FMFSource,
261 return CreateWithCopiedFlags(Instruction::FAdd, V1, V2, FMFSource, Name);
264 Instruction *FMFSource,
266 return CreateWithCopiedFlags(Instruction::FSub, V1, V2, FMFSource, Name);
269 Instruction *FMFSource,
271 return CreateWithCopiedFlags(Instruction::FMul, V1, V2, FMFSource, Name);
274 Instruction *FMFSource,
276 return CreateWithCopiedFlags(Instruction::FDiv, V1, V2, FMFSource, Name);
279 Instruction *FMFSource,
281 return CreateWithCopiedFlags(Instruction::FRem, V1, V2, FMFSource, Name);
283 static BinaryOperator *CreateFNegFMF(Value *Op, Instruction *FMFSource,
286 return CreateWithCopiedFlags(Instruction::FSub, Zero, Op, FMFSource, Name);
302 const Twine &Name, Instruction *I) {
321 const Twine &Name, Instruction *I) {
340 const Twine &Name, Instruction *I) {
382 Instruction *InsertBefore = nullptr);
386 Instruction *InsertBefore = nullptr);
390 Instruction *InsertBefore = nullptr);
394 Instruction *InsertBefore = nullptr);
398 Instruction *InsertBefore = nullptr);
414 static bool classof(const Instruction *I) {
418 return isa<Instruction>(V) && classof(cast<Instruction>(V));
418 return isa<Instruction>(V) && classof(cast<Instruction>(V));
443 const Twine &NameStr = "", Instruction *InsertBefore = nullptr)
462 Instruction::CastOps, ///< The opcode of the cast instruction
466 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
475 Instruction::CastOps, ///< The opcode for the cast instruction
487 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
503 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
527 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
543 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
556 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
565 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
582 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
598 Instruction *InsertBefore = nullptr ///< Place to insert the instruction
634 static Instruction::CastOps getCastOpcode(
663 Instruction::CastOps Opcode, ///< Opcode of cast
681 Instruction::CastOps firstOpcode, ///< Opcode of first cast
682 Instruction::CastOps secondOpcode, ///< Opcode of second cast
692 Instruction::CastOps getOpcode() const {
705 static bool castIsValid(Instruction::CastOps op, Value *S, Type *DstTy);
708 static bool classof(const Instruction *I) {
712 return isa<Instruction>(V) && classof(cast<Instruction>(V));
712 return isa<Instruction>(V) && classof(cast<Instruction>(V));
722 class CmpInst : public Instruction {
769 CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred,
771 Instruction *InsertBefore = nullptr,
772 Instruction *FlagsSource = nullptr);
774 CmpInst(Type *ty, Instruction::OtherOps op, Predicate pred,
792 Instruction *InsertBefore = nullptr);
966 static bool classof(const Instruction *I) {
967 return I->getOpcode() == Instruction::ICmp ||
968 I->getOpcode() == Instruction::FCmp;
971 return isa<Instruction>(V) && classof(cast<Instruction>(V));
971 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1105 class CallBase : public Instruction {
1117 using Instruction::Instruction;
1123 case Instruction::Call:
1125 case Instruction::Invoke:
1127 case Instruction::CallBr:
1140 static bool classof(const Instruction *I) {
1141 return I->getOpcode() == Instruction::Call ||
1142 I->getOpcode() == Instruction::Invoke ||
1143 I->getOpcode() == Instruction::CallBr;
1146 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1146 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2134 class FuncletPadInst : public Instruction {
2138 explicit FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
2140 const Twine &NameStr, Instruction *InsertBefore);
2141 explicit FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
2189 static bool classof(const Instruction *I) { return I->isFuncletPad(); }
2191 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2191 return isa<Instruction>(V) && classof(cast<Instruction>(V));
include/llvm/IR/Instruction.h 40 static inline void deleteNode(Instruction *V);
44 public ilist_node_with_parent<Instruction, BasicBlock> {
58 Instruction(const Instruction &) = delete;
59 Instruction &operator=(const Instruction &) = delete;
59 Instruction &operator=(const Instruction &) = delete;
63 Instruction *user_back() { return cast<Instruction>(*user_begin());}
63 Instruction *user_back() { return cast<Instruction>(*user_begin());}
64 const Instruction *user_back() const { return cast<Instruction>(*user_begin());}
64 const Instruction *user_back() const { return cast<Instruction>(*user_begin());}
97 SymbolTableList<Instruction>::iterator eraseFromParent();
101 void insertBefore(Instruction *InsertPos);
105 void insertAfter(Instruction *InsertPos);
109 void moveBefore(Instruction *MovePos);
114 void moveBefore(BasicBlock &BB, SymbolTableList<Instruction>::iterator I);
118 void moveAfter(Instruction *MovePos);
197 case Instruction::CatchSwitch:
198 case Instruction::CatchRet:
199 case Instruction::CleanupRet:
200 case Instruction::Invoke:
201 case Instruction::Resume:
211 case Instruction::IndirectBr:
212 case Instruction::CallBr:
286 void copyMetadata(const Instruction &SrcInst,
433 void copyFastMathFlags(const Instruction *I);
567 case Instruction::Fence:
568 case Instruction::CatchPad:
569 case Instruction::CatchRet:
570 case Instruction::Call:
571 case Instruction::Invoke:
595 case Instruction::CatchSwitch:
596 case Instruction::CatchPad:
597 case Instruction::CleanupPad:
598 case Instruction::LandingPad:
611 const Instruction *getNextNonDebugInstruction() const;
612 Instruction *getNextNonDebugInstruction() {
619 const Instruction *getPrevNonDebugInstruction() const;
620 Instruction *getPrevNonDebugInstruction() {
630 Instruction *clone() const;
635 bool isIdenticalTo(const Instruction *I) const;
640 bool isIdenticalToWhenDefined(const Instruction *I) const;
660 bool isSameOperationAs(const Instruction *I, unsigned flags = 0) const;
774 Instruction *InsertBefore = nullptr);
780 Instruction *cloneImpl() const;
783 inline void ilist_alloc_traits<Instruction>::deleteNode(Instruction *V) {
include/llvm/IR/Instructions.h 72 Instruction *InsertBefore = nullptr);
77 const Twine &Name, Instruction *InsertBefore = nullptr);
82 const Twine &Name = "", Instruction *InsertBefore = nullptr);
148 static bool classof(const Instruction *I) {
149 return (I->getOpcode() == Instruction::Alloca);
152 return isa<Instruction>(V) && classof(cast<Instruction>(V));
152 return isa<Instruction>(V) && classof(cast<Instruction>(V));
180 Instruction *InsertBefore = nullptr);
183 Instruction *InsertBefore = nullptr);
187 MaybeAlign Align, Instruction *InsertBefore = nullptr);
193 Instruction *InsertBefore = nullptr);
200 Instruction *InsertBefore = nullptr)
207 Instruction *InsertBefore = nullptr)
215 Instruction *InsertBefore = nullptr)
224 Instruction *InsertBefore = nullptr)
300 static bool classof(const Instruction *I) {
301 return I->getOpcode() == Instruction::Load;
304 return isa<Instruction>(V) && classof(cast<Instruction>(V));
304 return isa<Instruction>(V) && classof(cast<Instruction>(V));
325 class StoreInst : public Instruction {
335 StoreInst(Value *Val, Value *Ptr, Instruction *InsertBefore);
338 Instruction *InsertBefore = nullptr);
341 Instruction *InsertBefore = nullptr);
346 Instruction *InsertBefore = nullptr);
429 static bool classof(const Instruction *I) {
430 return I->getOpcode() == Instruction::Store;
433 return isa<Instruction>(V) && classof(cast<Instruction>(V));
433 return isa<Instruction>(V) && classof(cast<Instruction>(V));
460 class FenceInst : public Instruction {
474 Instruction *InsertBefore = nullptr);
506 static bool classof(const Instruction *I) {
507 return I->getOpcode() == Instruction::Fence;
510 return isa<Instruction>(V) && classof(cast<Instruction>(V));
510 return isa<Instruction>(V) && classof(cast<Instruction>(V));
536 class AtomicCmpXchgInst : public Instruction {
551 SyncScope::ID SSID, Instruction *InsertBefore = nullptr);
664 static bool classof(const Instruction *I) {
665 return I->getOpcode() == Instruction::AtomicCmpXchg;
668 return isa<Instruction>(V) && classof(cast<Instruction>(V));
668 return isa<Instruction>(V) && classof(cast<Instruction>(V));
699 class AtomicRMWInst : public Instruction {
748 Instruction *InsertBefore = nullptr);
836 static bool classof(const Instruction *I) {
837 return I->getOpcode() == Instruction::AtomicRMW;
840 return isa<Instruction>(V) && classof(cast<Instruction>(V));
840 return isa<Instruction>(V) && classof(cast<Instruction>(V));
881 class GetElementPtrInst : public Instruction {
893 const Twine &NameStr, Instruction *InsertBefore);
910 Instruction *InsertBefore = nullptr) {
944 Instruction *InsertBefore = nullptr){
951 Instruction *InsertBefore = nullptr) {
1101 static bool classof(const Instruction *I) {
1102 return (I->getOpcode() == Instruction::GetElementPtr);
1105 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1105 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1117 Instruction *InsertBefore)
1174 Instruction *InsertBefore, ///< Where to insert
1180 Instruction::ICmp, pred, LHS, RHS, NameStr,
1195 Instruction::ICmp, pred, LHS, RHS, NameStr,
1209 Instruction::ICmp, pred, LHS, RHS, NameStr) {
1278 static bool classof(const Instruction *I) {
1279 return I->getOpcode() == Instruction::ICmp;
1282 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1282 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1314 Instruction *InsertBefore, ///< Where to insert
1320 Instruction::FCmp, pred, LHS, RHS, NameStr,
1333 Instruction::FCmp, pred, LHS, RHS, NameStr,
1344 Instruction *FlagsSource = nullptr
1345 ) : CmpInst(makeCmpResultType(LHS->getType()), Instruction::FCmp, Pred, LHS,
1386 static bool classof(const Instruction *I) {
1387 return I->getOpcode() == Instruction::FCmp;
1390 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1390 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1407 Instruction *InsertBefore);
1410 const Twine &NameStr, Instruction *InsertBefore)
1420 Instruction *InsertBefore);
1444 Instruction *InsertBefore = nullptr) {
1450 Instruction *InsertBefore = nullptr) {
1458 Instruction *InsertBefore = nullptr) {
1490 Instruction *InsertBefore = nullptr) {
1498 Instruction *InsertBefore = nullptr) {
1505 Instruction *InsertBefore = nullptr) {
1531 Instruction *InsertBefore = nullptr) {
1540 Instruction *InsertBefore = nullptr) {
1550 Instruction *InsertBefore = nullptr) {
1588 Instruction *InsertPt = nullptr);
1596 static Instruction *CreateMalloc(Instruction *InsertBefore, Type *IntPtrTy,
1596 static Instruction *CreateMalloc(Instruction *InsertBefore, Type *IntPtrTy,
1601 static Instruction *CreateMalloc(BasicBlock *InsertAtEnd, Type *IntPtrTy,
1606 static Instruction *CreateMalloc(Instruction *InsertBefore, Type *IntPtrTy,
1606 static Instruction *CreateMalloc(Instruction *InsertBefore, Type *IntPtrTy,
1612 static Instruction *CreateMalloc(BasicBlock *InsertAtEnd, Type *IntPtrTy,
1619 static Instruction *CreateFree(Value *Source, Instruction *InsertBefore);
1619 static Instruction *CreateFree(Value *Source, Instruction *InsertBefore);
1620 static Instruction *CreateFree(Value *Source, BasicBlock *InsertAtEnd);
1621 static Instruction *CreateFree(Value *Source,
1623 Instruction *InsertBefore);
1624 static Instruction *CreateFree(Value *Source,
1669 static bool classof(const Instruction *I) {
1670 return I->getOpcode() == Instruction::Call;
1673 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1673 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1690 : CallBase(Ty->getReturnType(), Instruction::Call,
1700 Instruction *InsertBefore)
1701 : CallBase(Ty->getReturnType(), Instruction::Call,
1715 class SelectInst : public Instruction {
1717 Instruction *InsertBefore)
1718 : Instruction(S1->getType(), Instruction::Select,
1726 : Instruction(S1->getType(), Instruction::Select,
1748 Instruction *InsertBefore = nullptr,
1749 Instruction *MDFrom = nullptr) {
1789 static bool classof(const Instruction *I) {
1790 return I->getOpcode() == Instruction::Select;
1793 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1793 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1819 Instruction *InsertBefore = nullptr)
1835 static bool classof(const Instruction *I) {
1839 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1839 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1850 class ExtractElementInst : public Instruction {
1852 Instruction *InsertBefore = nullptr);
1865 Instruction *InsertBefore = nullptr) {
1892 static bool classof(const Instruction *I) {
1893 return I->getOpcode() == Instruction::ExtractElement;
1896 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1896 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1914 class InsertElementInst : public Instruction {
1917 Instruction *InsertBefore = nullptr);
1930 Instruction *InsertBefore = nullptr) {
1955 static bool classof(const Instruction *I) {
1956 return I->getOpcode() == Instruction::InsertElement;
1959 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1959 return isa<Instruction>(V) && classof(cast<Instruction>(V));
1977 class ShuffleVectorInst : public Instruction {
1987 Instruction *InsertBefor = nullptr);
2270 static bool classof(const Instruction *I) {
2271 return I->getOpcode() == Instruction::ShuffleVector;
2274 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2274 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2304 Instruction *InsertBefore);
2321 Instruction *InsertBefore = nullptr) {
2370 static bool classof(const Instruction *I) {
2371 return I->getOpcode() == Instruction::ExtractValue;
2374 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2374 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2381 Instruction *InsertBefore)
2403 class InsertValueInst : public Instruction {
2415 Instruction *InsertBefore);
2424 Instruction *InsertBefore = nullptr);
2446 Instruction *InsertBefore = nullptr) {
2501 static bool classof(const Instruction *I) {
2502 return I->getOpcode() == Instruction::InsertValue;
2505 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2505 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2518 Instruction *InsertBefore)
2546 class PHINode : public Instruction {
2555 Instruction *InsertBefore = nullptr)
2556 : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertBefore),
2564 : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertAtEnd),
2588 Instruction *InsertBefore = nullptr) {
2762 static bool classof(const Instruction *I) {
2763 return I->getOpcode() == Instruction::PHI;
2766 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2766 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2791 class LandingPadInst : public Instruction {
2803 const Twine &NameStr, Instruction *InsertBefore);
2826 Instruction *InsertBefore = nullptr);
2871 static bool classof(const Instruction *I) {
2872 return I->getOpcode() == Instruction::LandingPad;
2875 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2875 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2893 class ReturnInst : public Instruction {
2909 Instruction *InsertBefore = nullptr);
2921 Instruction *InsertBefore = nullptr) {
2945 static bool classof(const Instruction *I) {
2946 return (I->getOpcode() == Instruction::Ret);
2949 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2949 return isa<Instruction>(V) && classof(cast<Instruction>(V));
2975 class BranchInst : public Instruction {
2988 explicit BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore = nullptr);
2990 Instruction *InsertBefore = nullptr);
3032 Instruction *InsertBefore = nullptr) {
3037 Value *Cond, Instruction *InsertBefore = nullptr) {
3098 static bool classof(const Instruction *I) {
3099 return (I->getOpcode() == Instruction::Br);
3102 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3102 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3119 class SwitchInst : public Instruction {
3133 Instruction *InsertBefore);
3311 Instruction *InsertBefore = nullptr) {
3455 static bool classof(const Instruction *I) {
3456 return I->getOpcode() == Instruction::Switch;
3459 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3459 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3500 SymbolTableList<Instruction>::iterator eraseFromParent();
3521 class IndirectBrInst : public Instruction {
3532 IndirectBrInst(Value *Address, unsigned NumDests, Instruction *InsertBefore);
3583 Instruction *InsertBefore = nullptr) {
3635 static bool classof(const Instruction *I) {
3636 return I->getOpcode() == Instruction::IndirectBr;
3639 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3639 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3675 const Twine &NameStr, Instruction *InsertBefore);
3703 Instruction *InsertBefore = nullptr) {
3714 Instruction *InsertBefore = nullptr) {
3749 Instruction *InsertBefore = nullptr) {
3758 Instruction *InsertBefore = nullptr) {
3782 Instruction *InsertBefore = nullptr) {
3794 Instruction *InsertBefore = nullptr) {
3828 Instruction *InsertPt = nullptr);
3873 static bool classof(const Instruction *I) {
3874 return (I->getOpcode() == Instruction::Invoke);
3877 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3877 return isa<Instruction>(V) && classof(cast<Instruction>(V));
3892 const Twine &NameStr, Instruction *InsertBefore)
3893 : CallBase(Ty->getReturnType(), Instruction::Invoke,
3903 : CallBase(Ty->getReturnType(), Instruction::Invoke,
3930 const Twine &NameStr, Instruction *InsertBefore);
3964 Instruction *InsertBefore = nullptr) {
3977 Instruction *InsertBefore = nullptr) {
4016 Instruction *InsertBefore = nullptr) {
4026 Instruction *InsertBefore = nullptr) {
4057 Instruction *InsertPt = nullptr);
4113 static bool classof(const Instruction *I) {
4114 return (I->getOpcode() == Instruction::CallBr);
4117 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4117 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4133 const Twine &NameStr, Instruction *InsertBefore)
4134 : CallBase(Ty->getReturnType(), Instruction::CallBr,
4149 Instruction::CallBr,
4162 class ResumeInst : public Instruction {
4165 explicit ResumeInst(Value *Exn, Instruction *InsertBefore=nullptr);
4175 static ResumeInst *Create(Value *Exn, Instruction *InsertBefore = nullptr) {
4192 static bool classof(const Instruction *I) {
4193 return I->getOpcode() == Instruction::Resume;
4196 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4196 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4219 class CatchSwitchInst : public Instruction {
4235 Instruction *InsertBefore);
4261 Instruction *InsertBefore = nullptr) {
4377 static bool classof(const Instruction *I) {
4378 return I->getOpcode() == Instruction::CatchSwitch;
4381 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4381 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4397 Instruction *InsertBefore)
4398 : FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4403 : FuncletPadInst(Instruction::CleanupPad, ParentPad, Args, Values,
4409 Instruction *InsertBefore = nullptr) {
4423 static bool classof(const Instruction *I) {
4424 return I->getOpcode() == Instruction::CleanupPad;
4427 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4427 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4438 Instruction *InsertBefore)
4439 : FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4444 : FuncletPadInst(Instruction::CatchPad, CatchSwitch, Args, Values,
4450 Instruction *InsertBefore = nullptr) {
4473 static bool classof(const Instruction *I) {
4474 return I->getOpcode() == Instruction::CatchPad;
4477 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4477 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4485 class CatchReturnInst : public Instruction {
4487 CatchReturnInst(Value *CatchPad, BasicBlock *BB, Instruction *InsertBefore);
4500 Instruction *InsertBefore = nullptr) {
4537 static bool classof(const Instruction *I) {
4538 return (I->getOpcode() == Instruction::CatchRet);
4541 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4541 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4566 class CleanupReturnInst : public Instruction {
4570 Instruction *InsertBefore = nullptr);
4585 Instruction *InsertBefore = nullptr) {
4631 static bool classof(const Instruction *I) {
4632 return (I->getOpcode() == Instruction::CleanupRet);
4635 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4635 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4671 class UnreachableInst : public Instruction {
4679 explicit UnreachableInst(LLVMContext &C, Instruction *InsertBefore = nullptr);
4690 static bool classof(const Instruction *I) {
4691 return I->getOpcode() == Instruction::Unreachable;
4694 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4694 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4726 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
4738 static bool classof(const Instruction *I) {
4742 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4742 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4765 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
4777 static bool classof(const Instruction *I) {
4781 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4781 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4804 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
4816 static bool classof(const Instruction *I) {
4820 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4820 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4843 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
4855 static bool classof(const Instruction *I) {
4859 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4859 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4882 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
4894 static bool classof(const Instruction *I) {
4898 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4898 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4921 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
4933 static bool classof(const Instruction *I) {
4937 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4937 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4960 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
4972 static bool classof(const Instruction *I) {
4976 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4976 return isa<Instruction>(V) && classof(cast<Instruction>(V));
4999 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
5011 static bool classof(const Instruction *I) {
5015 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5015 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5038 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
5050 static bool classof(const Instruction *I) {
5054 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5054 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5073 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
5093 static bool classof(const Instruction *I) {
5097 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5097 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5120 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
5144 static bool classof(const Instruction *I) {
5148 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5148 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5171 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
5183 static bool classof(const Instruction *I) {
5187 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5187 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5211 Instruction *InsertBefore = nullptr ///< Where to insert the new instruction
5223 static bool classof(const Instruction *I) {
5227 return isa<Instruction>(V) && classof(cast<Instruction>(V));
5227 return isa<Instruction>(V) && classof(cast<Instruction>(V));
include/llvm/IR/IntrinsicInst.h 326 Instruction::BinaryOps getBinaryOp() const;
include/llvm/IR/LLVMContext.h 288 void emitError(const Instruction *I, const Twine &ErrorStr);
include/llvm/IR/NoFolder.h 41 Instruction *CreateAdd(Constant *LHS, Constant *RHS,
49 Instruction *CreateNSWAdd(Constant *LHS, Constant *RHS) const {
53 Instruction *CreateNUWAdd(Constant *LHS, Constant *RHS) const {
57 Instruction *CreateFAdd(Constant *LHS, Constant *RHS) const {
61 Instruction *CreateSub(Constant *LHS, Constant *RHS,
69 Instruction *CreateNSWSub(Constant *LHS, Constant *RHS) const {
73 Instruction *CreateNUWSub(Constant *LHS, Constant *RHS) const {
77 Instruction *CreateFSub(Constant *LHS, Constant *RHS) const {
81 Instruction *CreateMul(Constant *LHS, Constant *RHS,
89 Instruction *CreateNSWMul(Constant *LHS, Constant *RHS) const {
93 Instruction *CreateNUWMul(Constant *LHS, Constant *RHS) const {
97 Instruction *CreateFMul(Constant *LHS, Constant *RHS) const {
101 Instruction *CreateUDiv(Constant *LHS, Constant *RHS,
108 Instruction *CreateExactUDiv(Constant *LHS, Constant *RHS) const {
112 Instruction *CreateSDiv(Constant *LHS, Constant *RHS,
119 Instruction *CreateExactSDiv(Constant *LHS, Constant *RHS) const {
123 Instruction *CreateFDiv(Constant *LHS, Constant *RHS) const {
127 Instruction *CreateURem(Constant *LHS, Constant *RHS) const {
131 Instruction *CreateSRem(Constant *LHS, Constant *RHS) const {
135 Instruction *CreateFRem(Constant *LHS, Constant *RHS) const {
139 Instruction *CreateShl(Constant *LHS, Constant *RHS, bool HasNUW = false,
147 Instruction *CreateLShr(Constant *LHS, Constant *RHS,
154 Instruction *CreateAShr(Constant *LHS, Constant *RHS,
161 Instruction *CreateAnd(Constant *LHS, Constant *RHS) const {
165 Instruction *CreateOr(Constant *LHS, Constant *RHS) const {
169 Instruction *CreateXor(Constant *LHS, Constant *RHS) const {
173 Instruction *CreateBinOp(Instruction::BinaryOps Opc,
173 Instruction *CreateBinOp(Instruction::BinaryOps Opc,
182 Instruction *CreateNeg(Constant *C,
190 Instruction *CreateNSWNeg(Constant *C) const {
194 Instruction *CreateNUWNeg(Constant *C) const {
198 Instruction *CreateFNeg(Constant *C) const {
202 Instruction *CreateNot(Constant *C) const {
206 Instruction *CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const {
206 Instruction *CreateUnOp(Instruction::UnaryOps Opc, Constant *C) const {
226 Instruction *CreateGetElementPtr(Type *Ty, Constant *C,
244 Instruction *CreateInBoundsGetElementPtr(Type *Ty, Constant *C,
253 Instruction *CreateCast(Instruction::CastOps Op, Constant *C,
253 Instruction *CreateCast(Instruction::CastOps Op, Constant *C,
258 Instruction *CreatePointerCast(Constant *C, Type *DestTy) const {
262 Instruction *CreateIntCast(Constant *C, Type *DestTy,
267 Instruction *CreateFPCast(Constant *C, Type *DestTy) const {
271 Instruction *CreateBitCast(Constant *C, Type *DestTy) const {
272 return CreateCast(Instruction::BitCast, C, DestTy);
275 Instruction *CreateIntToPtr(Constant *C, Type *DestTy) const {
276 return CreateCast(Instruction::IntToPtr, C, DestTy);
279 Instruction *CreatePtrToInt(Constant *C, Type *DestTy) const {
280 return CreateCast(Instruction::PtrToInt, C, DestTy);
283 Instruction *CreateZExtOrBitCast(Constant *C, Type *DestTy) const {
287 Instruction *CreateSExtOrBitCast(Constant *C, Type *DestTy) const {
291 Instruction *CreateTruncOrBitCast(Constant *C, Type *DestTy) const {
299 Instruction *CreateICmp(CmpInst::Predicate P,
304 Instruction *CreateFCmp(CmpInst::Predicate P,
313 Instruction *CreateSelect(Constant *C,
318 Instruction *CreateExtractElement(Constant *Vec, Constant *Idx) const {
322 Instruction *CreateInsertElement(Constant *Vec, Constant *NewElt,
327 Instruction *CreateShuffleVector(Constant *V1, Constant *V2,
332 Instruction *CreateExtractValue(Constant *Agg,
337 Instruction *CreateInsertValue(Constant *Agg, Constant *Val,
include/llvm/IR/Operator.h 41 if (const Instruction *I = dyn_cast<Instruction>(this))
41 if (const Instruction *I = dyn_cast<Instruction>(this))
49 if (const Instruction *I = dyn_cast<Instruction>(V))
49 if (const Instruction *I = dyn_cast<Instruction>(V))
53 return Instruction::UserOp1;
56 static bool classof(const Instruction *) { return true; }
59 return isa<Instruction>(V) || isa<ConstantExpr>(V);
99 static bool classof(const Instruction *I) {
100 return I->getOpcode() == Instruction::Add ||
101 I->getOpcode() == Instruction::Sub ||
102 I->getOpcode() == Instruction::Mul ||
103 I->getOpcode() == Instruction::Shl;
106 return CE->getOpcode() == Instruction::Add ||
107 CE->getOpcode() == Instruction::Sub ||
108 CE->getOpcode() == Instruction::Mul ||
109 CE->getOpcode() == Instruction::Shl;
112 return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
112 return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
140 return OpC == Instruction::SDiv ||
141 OpC == Instruction::UDiv ||
142 OpC == Instruction::AShr ||
143 OpC == Instruction::LShr;
149 static bool classof(const Instruction *I) {
153 return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
153 return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
374 if (auto *I = dyn_cast<Instruction>(V))
382 case Instruction::FNeg:
383 case Instruction::FAdd:
384 case Instruction::FSub:
385 case Instruction::FMul:
386 case Instruction::FDiv:
387 case Instruction::FRem:
393 case Instruction::FCmp:
395 case Instruction::PHI:
396 case Instruction::Select:
397 case Instruction::Call:
409 static bool classof(const Instruction *I) {
416 return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
416 return (isa<Instruction>(V) && classof(cast<Instruction>(V))) ||
422 : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {
425 : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {
428 : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {
431 : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {
435 : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {
438 : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {
441 : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {
444 : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {
447 class ZExtOperator : public ConcreteOperator<Operator, Instruction::ZExt> {};
450 : public ConcreteOperator<Operator, Instruction::GetElementPtr> {
555 : public ConcreteOperator<Operator, Instruction::PtrToInt> {
583 : public ConcreteOperator<Operator, Instruction::BitCast> {
include/llvm/IR/PatternMatch.h 47 template <typename Val, typename Pattern> bool match(Val *V, const Pattern &P) {
117 template <typename ITy> bool match(ITy *V) {
132 template <typename ITy> bool match(ITy *V) {
540 Class *&VR;
542 bind_ty(Class *&V) : VR(V) {}
544 template <typename ITy> bool match(ITy *V) {
545 if (auto *CV = dyn_cast<Class>(V)) {
545 if (auto *CV = dyn_cast<Class>(V)) {
558 inline bind_ty<Instruction> m_Instruction(Instruction *&I) { return I; }
558 inline bind_ty<Instruction> m_Instruction(Instruction *&I) { return I; }
714 template <typename OpTy> bool match(OpTy *V) {
742 template <typename OpTy> bool match(OpTy *V) {
759 inline BinaryOp_match<LHS, RHS, Instruction::Add> m_Add(const LHS &L,
761 return BinaryOp_match<LHS, RHS, Instruction::Add>(L, R);
765 inline BinaryOp_match<LHS, RHS, Instruction::FAdd> m_FAdd(const LHS &L,
767 return BinaryOp_match<LHS, RHS, Instruction::FAdd>(L, R);
771 inline BinaryOp_match<LHS, RHS, Instruction::Sub> m_Sub(const LHS &L,
773 return BinaryOp_match<LHS, RHS, Instruction::Sub>(L, R);
777 inline BinaryOp_match<LHS, RHS, Instruction::FSub> m_FSub(const LHS &L,
779 return BinaryOp_match<LHS, RHS, Instruction::FSub>(L, R);
786 template <typename OpTy> bool match(OpTy *V) {
790 if (FPMO->getOpcode() == Instruction::FNeg)
793 if (FPMO->getOpcode() == Instruction::FSub) {
820 inline BinaryOp_match<cstfp_pred_ty<is_any_zero_fp>, RHS, Instruction::FSub>
826 inline BinaryOp_match<LHS, RHS, Instruction::Mul> m_Mul(const LHS &L,
828 return BinaryOp_match<LHS, RHS, Instruction::Mul>(L, R);
832 inline BinaryOp_match<LHS, RHS, Instruction::FMul> m_FMul(const LHS &L,
834 return BinaryOp_match<LHS, RHS, Instruction::FMul>(L, R);
838 inline BinaryOp_match<LHS, RHS, Instruction::UDiv> m_UDiv(const LHS &L,
840 return BinaryOp_match<LHS, RHS, Instruction::UDiv>(L, R);
844 inline BinaryOp_match<LHS, RHS, Instruction::SDiv> m_SDiv(const LHS &L,
846 return BinaryOp_match<LHS, RHS, Instruction::SDiv>(L, R);
850 inline BinaryOp_match<LHS, RHS, Instruction::FDiv> m_FDiv(const LHS &L,
852 return BinaryOp_match<LHS, RHS, Instruction::FDiv>(L, R);
856 inline BinaryOp_match<LHS, RHS, Instruction::URem> m_URem(const LHS &L,
858 return BinaryOp_match<LHS, RHS, Instruction::URem>(L, R);
862 inline BinaryOp_match<LHS, RHS, Instruction::SRem> m_SRem(const LHS &L,
864 return BinaryOp_match<LHS, RHS, Instruction::SRem>(L, R);
868 inline BinaryOp_match<LHS, RHS, Instruction::FRem> m_FRem(const LHS &L,
870 return BinaryOp_match<LHS, RHS, Instruction::FRem>(L, R);
874 inline BinaryOp_match<LHS, RHS, Instruction::And> m_And(const LHS &L,
876 return BinaryOp_match<LHS, RHS, Instruction::And>(L, R);
880 inline BinaryOp_match<LHS, RHS, Instruction::Or> m_Or(const LHS &L,
882 return BinaryOp_match<LHS, RHS, Instruction::Or>(L, R);
886 inline BinaryOp_match<LHS, RHS, Instruction::Xor> m_Xor(const LHS &L,
888 return BinaryOp_match<LHS, RHS, Instruction::Xor>(L, R);
892 inline BinaryOp_match<LHS, RHS, Instruction::Shl> m_Shl(const LHS &L,
894 return BinaryOp_match<LHS, RHS, Instruction::Shl>(L, R);
898 inline BinaryOp_match<LHS, RHS, Instruction::LShr> m_LShr(const LHS &L,
900 return BinaryOp_match<LHS, RHS, Instruction::LShr>(L, R);
904 inline BinaryOp_match<LHS, RHS, Instruction::AShr> m_AShr(const LHS &L,
906 return BinaryOp_match<LHS, RHS, Instruction::AShr>(L, R);
918 template <typename OpTy> bool match(OpTy *V) {
935 inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Add,
938 return OverflowingBinaryOp_match<LHS, RHS, Instruction::Add,
943 inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Sub,
946 return OverflowingBinaryOp_match<LHS, RHS, Instruction::Sub,
951 inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Mul,
954 return OverflowingBinaryOp_match<LHS, RHS, Instruction::Mul,
959 inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Shl,
962 return OverflowingBinaryOp_match<LHS, RHS, Instruction::Shl,
968 inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Add,
971 return OverflowingBinaryOp_match<LHS, RHS, Instruction::Add,
976 inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Sub,
979 return OverflowingBinaryOp_match<LHS, RHS, Instruction::Sub,
984 inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Mul,
987 return OverflowingBinaryOp_match<LHS, RHS, Instruction::Mul,
992 inline OverflowingBinaryOp_match<LHS, RHS, Instruction::Shl,
995 return OverflowingBinaryOp_match<LHS, RHS, Instruction::Shl,
1010 template <typename OpTy> bool match(OpTy *V) {
1011 if (auto *I = dyn_cast<Instruction>(V))
1011 if (auto *I = dyn_cast<Instruction>(V))
1022 bool isOpType(unsigned Opcode) { return Instruction::isShift(Opcode); }
1027 return Opcode == Instruction::LShr || Opcode == Instruction::AShr;
1027 return Opcode == Instruction::LShr || Opcode == Instruction::AShr;
1033 return Opcode == Instruction::LShr || Opcode == Instruction::Shl;
1033 return Opcode == Instruction::LShr || Opcode == Instruction::Shl;
1039 return Instruction::isBitwiseLogicOp(Opcode);
1045 return Opcode == Instruction::SDiv || Opcode == Instruction::UDiv;
1045 return Opcode == Instruction::SDiv || Opcode == Instruction::UDiv;
1051 return Opcode == Instruction::SRem || Opcode == Instruction::URem;
1051 return Opcode == Instruction::SRem || Opcode == Instruction::URem;
1132 template <typename OpTy> bool match(OpTy *V) {
1172 template <typename OpTy> bool match(OpTy *V) {
1174 auto *I = cast<Instruction>(V);
1174 auto *I = cast<Instruction>(V);
1190 auto *I = cast<Instruction>(V);
1190 auto *I = cast<Instruction>(V);
1207 template <typename OpTy> bool match(OpTy *V) {
1209 auto *I = cast<Instruction>(V);
1209 auto *I = cast<Instruction>(V);
1219 inline ThreeOps_match<Cond, LHS, RHS, Instruction::Select>
1221 return ThreeOps_match<Cond, LHS, RHS, Instruction::Select>(C, L, R);
1228 Instruction::Select>
1235 inline ThreeOps_match<Val_t, Elt_t, Idx_t, Instruction::InsertElement>
1237 return ThreeOps_match<Val_t, Elt_t, Idx_t, Instruction::InsertElement>(
1243 inline TwoOps_match<Val_t, Idx_t, Instruction::ExtractElement>
1245 return TwoOps_match<Val_t, Idx_t, Instruction::ExtractElement>(Val, Idx);
1250 inline ThreeOps_match<V1_t, V2_t, Mask_t, Instruction::ShuffleVector>
1252 return ThreeOps_match<V1_t, V2_t, Mask_t, Instruction::ShuffleVector>(v1, v2,
1258 inline OneOps_match<OpTy, Instruction::Load> m_Load(const OpTy &Op) {
1259 return OneOps_match<OpTy, Instruction::Load>(Op);
1264 inline TwoOps_match<ValueOpTy, PointerOpTy, Instruction::Store>
1266 return TwoOps_match<ValueOpTy, PointerOpTy, Instruction::Store>(ValueOp,
1279 template <typename OpTy> bool match(OpTy *V) {
1288 inline CastClass_match<OpTy, Instruction::BitCast> m_BitCast(const OpTy &Op) {
1289 return CastClass_match<OpTy, Instruction::BitCast>(Op);
1294 inline CastClass_match<OpTy, Instruction::PtrToInt> m_PtrToInt(const OpTy &Op) {
1295 return CastClass_match<OpTy, Instruction::PtrToInt>(Op);
1300 inline CastClass_match<OpTy, Instruction::Trunc> m_Trunc(const OpTy &Op) {
1301 return CastClass_match<OpTy, Instruction::Trunc>(Op);
1305 inline match_combine_or<CastClass_match<OpTy, Instruction::Trunc>, OpTy>
1312 inline CastClass_match<OpTy, Instruction::SExt> m_SExt(const OpTy &Op) {
1313 return CastClass_match<OpTy, Instruction::SExt>(Op);
1318 inline CastClass_match<OpTy, Instruction::ZExt> m_ZExt(const OpTy &Op) {
1319 return CastClass_match<OpTy, Instruction::ZExt>(Op);
1323 inline match_combine_or<CastClass_match<OpTy, Instruction::ZExt>, OpTy>
1329 inline match_combine_or<CastClass_match<OpTy, Instruction::SExt>, OpTy>
1335 inline match_combine_or<CastClass_match<OpTy, Instruction::ZExt>,
1336 CastClass_match<OpTy, Instruction::SExt>>
1343 match_combine_or<CastClass_match<OpTy, Instruction::ZExt>,
1344 CastClass_match<OpTy, Instruction::SExt>>,
1352 inline CastClass_match<OpTy, Instruction::UIToFP> m_UIToFP(const OpTy &Op) {
1353 return CastClass_match<OpTy, Instruction::UIToFP>(Op);
1358 inline CastClass_match<OpTy, Instruction::SIToFP> m_SIToFP(const OpTy &Op) {
1359 return CastClass_match<OpTy, Instruction::SIToFP>(Op);
1364 inline CastClass_match<OpTy, Instruction::FPTrunc> m_FPTrunc(const OpTy &Op) {
1365 return CastClass_match<OpTy, Instruction::FPTrunc>(Op);
1370 inline CastClass_match<OpTy, Instruction::FPExt> m_FPExt(const OpTy &Op) {
1371 return CastClass_match<OpTy, Instruction::FPExt>(Op);
1383 template <typename OpTy> bool match(OpTy *V) {
1404 template <typename OpTy> bool match(OpTy *V) {
1439 template <typename OpTy> bool match(OpTy *V) {
1673 template <typename OpTy> bool match(OpTy *V) {
1693 template <typename OpTy> bool match(OpTy *V) {
1814 inline BinaryOp_match<LHS, RHS, Instruction::Add, true> m_c_Add(const LHS &L,
1816 return BinaryOp_match<LHS, RHS, Instruction::Add, true>(L, R);
1821 inline BinaryOp_match<LHS, RHS, Instruction::Mul, true> m_c_Mul(const LHS &L,
1823 return BinaryOp_match<LHS, RHS, Instruction::Mul, true>(L, R);
1828 inline BinaryOp_match<LHS, RHS, Instruction::And, true> m_c_And(const LHS &L,
1830 return BinaryOp_match<LHS, RHS, Instruction::And, true>(L, R);
1835 inline BinaryOp_match<LHS, RHS, Instruction::Or, true> m_c_Or(const LHS &L,
1837 return BinaryOp_match<LHS, RHS, Instruction::Or, true>(L, R);
1842 inline BinaryOp_match<LHS, RHS, Instruction::Xor, true> m_c_Xor(const LHS &L,
1844 return BinaryOp_match<LHS, RHS, Instruction::Xor, true>(L, R);
1849 inline BinaryOp_match<cst_pred_ty<is_zero_int>, ValTy, Instruction::Sub>
1856 inline BinaryOp_match<ValTy, cst_pred_ty<is_all_ones>, Instruction::Xor, true>
1888 inline BinaryOp_match<LHS, RHS, Instruction::FAdd, true>
1890 return BinaryOp_match<LHS, RHS, Instruction::FAdd, true>(L, R);
1895 inline BinaryOp_match<LHS, RHS, Instruction::FMul, true>
1897 return BinaryOp_match<LHS, RHS, Instruction::FMul, true>(L, R);
include/llvm/IR/Statepoint.h 78 explicit StatepointBase(InstructionTy *I) {
138 InstructionTy *getInstruction() const { return getCall(); }
293 : public StatepointBase<const Function, const Instruction, const Value,
295 using Base = StatepointBase<const Function, const Instruction, const Value,
299 explicit ImmutableStatepoint(const Instruction *I) : Base(I) {}
306 : public StatepointBase<Function, Instruction, Value, CallBase> {
307 using Base = StatepointBase<Function, Instruction, Value, CallBase>;
310 explicit Statepoint(Instruction *I) : Base(I) {}
348 cast<Instruction>(Token)->getParent()->getUniquePredecessor();
include/llvm/IR/SymbolTableListTraits.h 66 class SymbolTableListTraits : public ilist_alloc_traits<ValueSubClass> {
67 using ListTy = SymbolTableList<ValueSubClass>;
68 using iterator = typename simple_ilist<ValueSubClass>::iterator;
70 typename SymbolTableListParentType<ValueSubClass>::type;
95 void addNodeToList(ValueSubClass *V);
96 void removeNodeFromList(ValueSubClass *V);
113 : public iplist_impl<simple_ilist<T>, SymbolTableListTraits<T>> {};
113 : public iplist_impl<simple_ilist<T>, SymbolTableListTraits<T>> {};
include/llvm/IR/User.h 307 return isa<Instruction>(V) || isa<Constant>(V);
include/llvm/IR/ValueHandle.h 256 ValueTy *getValPtr() const { return static_cast<ValueTy *>(getRawValPtr()); }
257 void setValPtr(ValueTy *P) { setRawValPtr(GetAsValue(P)); }
262 AssertingVH(ValueTy *P) : ValueHandleBase(Assert, GetAsValue(P)) {}
269 operator ValueTy*() const {
273 ValueTy *operator=(ValueTy *RHS) {
273 ValueTy *operator=(ValueTy *RHS) {
277 ValueTy *operator=(const AssertingVH<ValueTy> &RHS) {
277 ValueTy *operator=(const AssertingVH<ValueTy> &RHS) {
282 ValueTy *operator->() const { return getValPtr(); }
283 ValueTy &operator*() const { return *getValPtr(); }
289 static inline AssertingVH<T> getEmptyKey() {
290 AssertingVH<T> Res;
295 static inline AssertingVH<T> getTombstoneKey() {
296 AssertingVH<T> Res;
301 static unsigned getHashValue(const AssertingVH<T> &Val) {
305 static bool isEqual(const AssertingVH<T> &LHS, const AssertingVH<T> &RHS) {
305 static bool isEqual(const AssertingVH<T> &LHS, const AssertingVH<T> &RHS) {
331 ValueTy *getValPtr() const {
341 return cast<ValueTy>(InnerHandle);
344 void setValPtr(ValueTy *P) {
357 TrackingVH(ValueTy *P) { setValPtr(P); }
359 operator ValueTy*() const {
363 ValueTy *operator=(ValueTy *RHS) {
363 ValueTy *operator=(ValueTy *RHS) {
368 ValueTy *operator->() const { return getValPtr(); }
369 ValueTy &operator*() const { return *getValPtr(); }
include/llvm/IR/Verifier.h 62 MDNode *getFieldNodeFromTBAABaseNode(Instruction &I, const MDNode *BaseNode,
64 TBAAVerifier::TBAABaseNodeSummary verifyTBAABaseNode(Instruction &I,
67 TBAABaseNodeSummary verifyTBAABaseNodeImpl(Instruction &I,
79 bool visitTBAAMetadata(Instruction &I, const MDNode *MD);
include/llvm/ProfileData/InstrProf.h 240 void annotateValueSite(Module &M, Instruction &Inst,
246 void annotateValueSite(Module &M, Instruction &Inst,
253 bool getValueProfDataFromInst(const Instruction &Inst,
include/llvm/Support/Casting.h 34 using SimpleType = From; // The real type this represents...
37 static SimpleType &getSimplifiedValue(From &Val) { return Val; }
41 using NonConstSimpleType = typename simplify_type<From>::SimpleType;
47 static RetType getSimplifiedValue(const From& Val) {
57 static inline bool doit(const From &Val) {
58 return To::classof(&Val);
66 static inline bool doit(const From &) { return true; }
76 static inline bool doit(const From &Val) {
77 return isa_impl<To, From>::doit(Val);
77 return isa_impl<To, From>::doit(Val);
90 static inline bool doit(const From *Val) {
92 return isa_impl<To, From>::doit(*Val);
92 return isa_impl<To, From>::doit(*Val);
104 static inline bool doit(const From *Val) {
106 return isa_impl<To, From>::doit(*Val);
106 return isa_impl<To, From>::doit(*Val);
122 return isa_impl_wrap<To, SimpleFrom,
132 return isa_impl_cl<To,FromTy>::doit(Val);
141 template <class X, class Y> LLVM_NODISCARD inline bool isa(const Y &Val) {
142 return isa_impl_wrap<X, const Y,
142 return isa_impl_wrap<X, const Y,
143 typename simplify_type<const Y>::SimpleType>::doit(Val);
165 using ret_type = To &; // Normal case, return Ty&
168 using ret_type = const To &; // Normal case, return Ty&
172 using ret_type = To *; // Pointer arg case, return Ty*
176 using ret_type = const To *; // Constant pointer arg case, return const Ty*
198 using ret_type = typename cast_retty<To, SimpleFrom>::ret_type;
204 using ret_type = typename cast_retty_impl<To,FromTy>::ret_type;
204 using ret_type = typename cast_retty_impl<To,FromTy>::ret_type;
210 To, From, typename simplify_type<From>::SimpleType>::ret_type;
210 To, From, typename simplify_type<From>::SimpleType>::ret_type;
210 To, From, typename simplify_type<From>::SimpleType>::ret_type;
218 static typename cast_retty<To, From>::ret_type doit(From &Val) {
219 return cast_convert_val<To, SimpleFrom,
227 static typename cast_retty<To, FromTy>::ret_type doit(const FromTy &Val) {
227 static typename cast_retty<To, FromTy>::ret_type doit(const FromTy &Val) {
227 static typename cast_retty<To, FromTy>::ret_type doit(const FromTy &Val) {
228 typename cast_retty<To, FromTy>::ret_type Res2
228 typename cast_retty<To, FromTy>::ret_type Res2
236 std::is_same<X, typename simplify_type<X>::SimpleType>::value;
236 std::is_same<X, typename simplify_type<X>::SimpleType>::value;
248 typename cast_retty<X, const Y>::ret_type>::type
252 X, const Y, typename simplify_type<const Y>::SimpleType>::doit(Val);
256 inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
256 inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
256 inline typename cast_retty<X, Y>::ret_type cast(Y &Val) {
258 return cast_convert_val<X, Y,
258 return cast_convert_val<X, Y,
259 typename simplify_type<Y>::SimpleType>::doit(Val);
263 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
263 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
263 inline typename cast_retty<X, Y *>::ret_type cast(Y *Val) {
265 return cast_convert_val<X, Y*,
265 return cast_convert_val<X, Y*,
266 typename simplify_type<Y*>::SimpleType>::doit(Val);
285 typename cast_retty<X, const Y>::ret_type>::type
290 return cast<X>(Val);
296 typename cast_retty<X, Y>::ret_type>::type
305 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type
309 return cast<X>(Val);
331 typename cast_retty<X, const Y>::ret_type>::type
333 return isa<X>(Val) ? cast<X>(Val) : nullptr;
333 return isa<X>(Val) ? cast<X>(Val) : nullptr;
337 LLVM_NODISCARD inline typename cast_retty<X, Y>::ret_type dyn_cast(Y &Val) {
338 return isa<X>(Val) ? cast<X>(Val) : nullptr;
338 return isa<X>(Val) ? cast<X>(Val) : nullptr;
342 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
342 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
342 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type dyn_cast(Y *Val) {
343 return isa<X>(Val) ? cast<X>(Val) : nullptr;
343 return isa<X>(Val) ? cast<X>(Val) : nullptr;
352 typename cast_retty<X, const Y>::ret_type>::type
354 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
354 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
360 typename cast_retty<X, Y>::ret_type>::type
362 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
362 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
366 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type
366 LLVM_NODISCARD inline typename cast_retty<X, Y *>::ret_type
367 dyn_cast_or_null(Y *Val) {
368 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
368 return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr;
include/llvm/Support/PointerLikeTypeTraits.h 56 static inline void *getAsVoidPointer(T *P) { return P; }
57 static inline T *getFromVoidPointer(void *P) { return static_cast<T *>(P); }
59 enum { NumLowBitsAvailable = detail::ConstantLog2<alignof(T)>::value };
91 typedef PointerLikeTypeTraits<T *> NonConst;
93 static inline const void *getAsVoidPointer(const T *P) {
96 static inline const T *getFromVoidPointer(const void *P) {
include/llvm/Support/type_traits.h 55 struct add_const_past_pointer { using type = const T; };
include/llvm/Transforms/IPO/Attributor.h 280 if (isa<Instruction>(V))
281 return cast<Instruction>(V).getFunction();
330 if (isa<Instruction>(V))
331 return cast<Instruction>(V).getFunction();
342 Instruction *getCtxI() {
344 if (auto *I = dyn_cast<Instruction>(&V))
344 if (auto *I = dyn_cast<Instruction>(&V))
354 const Instruction *getCtxI() const {
615 using OpcodeInstMapTy = DenseMap<unsigned, SmallVector<Instruction *, 32>>;
624 using InstructionVectorTy = std::vector<Instruction *>;
830 void deleteAfterManifest(Instruction &I) { ToBeDeletedInsts.insert(&I); }
874 bool checkForAllInstructions(const function_ref<bool(Instruction &)> &Pred,
882 checkForAllCallLikeInstructions(const function_ref<bool(Instruction &)> &Pred,
885 {(unsigned)Instruction::Invoke,
886 (unsigned)Instruction::CallBr,
887 (unsigned)Instruction::Call});
896 const llvm::function_ref<bool(Instruction &)> &Pred,
1014 SmallPtrSet<Instruction *, 8> ToBeDeletedInsts;
1732 virtual bool isAssumedDead(const Instruction *I) const = 0;
1735 virtual bool isKnownDead(const Instruction *I) const = 0;
include/llvm/Transforms/InstCombine/InstCombineWorklist.h 27 SmallVector<Instruction*, 256> Worklist;
28 DenseMap<Instruction*, unsigned> WorklistMap;
40 void Add(Instruction *I) {
48 if (Instruction *I = dyn_cast<Instruction>(V))
48 if (Instruction *I = dyn_cast<Instruction>(V))
55 void AddInitialGroup(ArrayRef<Instruction *> List) {
62 for (Instruction *I : reverse(List)) {
69 void Remove(Instruction *I) {
70 DenseMap<Instruction*, unsigned>::iterator It = WorklistMap.find(I);
79 Instruction *RemoveOne() {
80 Instruction *I = Worklist.pop_back_val();
89 void AddUsersToWorkList(Instruction &I) {
91 Add(cast<Instruction>(U));
include/llvm/Transforms/Instrumentation.h 122 Instruction *promoteIndirectCall(Instruction *Inst, Function *F, uint64_t Count,
122 Instruction *promoteIndirectCall(Instruction *Inst, Function *F, uint64_t Count,
include/llvm/Transforms/Instrumentation/InstrProfiling.h 30 using LoadStorePair = std::pair<Instruction *, Instruction *>;
30 using LoadStorePair = std::pair<Instruction *, Instruction *>;
include/llvm/Transforms/Instrumentation/PGOInstrumentation.h 93 void setProfMetadata(Module *M, Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
96 void setIrrLoopHeaderMetadata(Module *M, Instruction *TI, uint64_t Count);
include/llvm/Transforms/Scalar/ConstantHoisting.h 71 Instruction *Inst;
74 ConstantUser(Instruction *Inst, unsigned Idx) : Inst(Inst), OpndIdx(Idx) {}
93 void addUser(Instruction *Inst, unsigned Idx, unsigned Cost) {
170 MapVector<Instruction *, Instruction *> ClonedCastMap;
170 MapVector<Instruction *, Instruction *> ClonedCastMap;
172 Instruction *findMatInsertPt(Instruction *Inst, unsigned Idx = ~0U) const;
172 Instruction *findMatInsertPt(Instruction *Inst, unsigned Idx = ~0U) const;
173 SetVector<Instruction *>
176 Instruction *Inst, unsigned Idx,
179 Instruction *Inst, unsigned Idx,
182 Instruction *Inst, unsigned Idx);
184 Instruction *Inst);
195 void emitBaseConstants(Instruction *Base, Constant *Offset, Type *Ty,
include/llvm/Transforms/Scalar/Float2Int.h 34 SmallPtrSet<Instruction *, 8> &Roots);
35 void seen(Instruction *I, ConstantRange R);
39 void walkBackwards(const SmallPtrSetImpl<Instruction *> &Roots);
42 Value *convert(Instruction *I, Type *ToTy);
45 MapVector<Instruction *, ConstantRange> SeenInsts;
46 SmallPtrSet<Instruction *, 8> Roots;
47 EquivalenceClasses<Instruction *> ECs;
48 MapVector<Instruction *, Value *> ConvertedInsts;
include/llvm/Transforms/Scalar/GVN.h 77 void markInstructionForDeletion(Instruction *I) {
116 Expression createExpr(Instruction *I);
182 SmallVector<Instruction *, 8> InstrsToErase;
220 void removeFromLeaderTable(uint32_t N, Instruction *I, BasicBlock *BB) {
248 SmallVector<std::pair<Instruction *, unsigned>, 4> toSplit;
272 bool processInstruction(Instruction *I);
277 bool performScalarPRE(Instruction *I);
278 bool performScalarPREInsertion(Instruction *Instr, BasicBlock *Pred,
283 void verifyRemoved(const Instruction *I) const;
286 bool replaceOperandsForInBlockEquality(Instruction *I) const;
include/llvm/Transforms/Scalar/GVNExpression.h 624 Instruction *Inst;
627 UnknownExpression(Instruction *I) : Expression(ET_Unknown), Inst(I) {}
636 Instruction *getInstruction() const { return Inst; }
637 void setInstruction(Instruction *I) { Inst = I; }
include/llvm/Transforms/Scalar/JumpThreading.h 121 Instruction *CxtI = nullptr);
126 Instruction *CxtI = nullptr) {
134 Instruction *CxtI = nullptr);
include/llvm/Transforms/Scalar/MemCpyOptimizer.h 64 bool performCallSlotOptzn(Instruction *cpy, Value *cpyDst, Value *cpySrc,
70 Instruction *tryMergingIntoMemset(Instruction *I, Value *StartPtr,
70 Instruction *tryMergingIntoMemset(Instruction *I, Value *StartPtr,
include/llvm/Transforms/Scalar/NaryReassociate.h 117 Instruction *tryReassociate(Instruction *I);
117 Instruction *tryReassociate(Instruction *I);
120 Instruction *tryReassociateGEP(GetElementPtrInst *GEP);
139 Instruction *tryReassociateBinaryOp(BinaryOperator *I);
143 Instruction *tryReassociateBinaryOp(Value *LHS, Value *RHS,
146 Instruction *tryReassociatedBinaryOp(const SCEV *LHS, Value *RHS,
158 Instruction *findClosestMatchingDominator(const SCEV *CandidateExpr,
159 Instruction *Dominatee);
include/llvm/Transforms/Scalar/Reassociate.h 74 SetVector<AssertingVH<Instruction>, std::deque<AssertingVH<Instruction>>>;
74 SetVector<AssertingVH<Instruction>, std::deque<AssertingVH<Instruction>>>;
84 Instruction::BinaryOpsEnd - Instruction::BinaryOpsBegin;
84 Instruction::BinaryOpsEnd - Instruction::BinaryOpsBegin;
102 void canonicalizeOperands(Instruction *I);
108 Value *OptimizeAdd(Instruction *I,
110 Value *OptimizeXor(Instruction *I,
112 bool CombineXorOpnd(Instruction *I, reassociate::XorOpnd *Opnd1,
114 bool CombineXorOpnd(Instruction *I, reassociate::XorOpnd *Opnd1,
122 void EraseInst(Instruction *I);
123 void RecursivelyEraseDeadInsts(Instruction *I, OrderedSet &Insts);
124 void OptimizeInst(Instruction *I);
125 Instruction *canonicalizeNegFPConstantsForOp(Instruction *I, Instruction *Op,
125 Instruction *canonicalizeNegFPConstantsForOp(Instruction *I, Instruction *Op,
125 Instruction *canonicalizeNegFPConstantsForOp(Instruction *I, Instruction *Op,
127 Instruction *canonicalizeNegFPConstants(Instruction *I);
127 Instruction *canonicalizeNegFPConstants(Instruction *I);
include/llvm/Transforms/Scalar/SROA.h 81 SetVector<Instruction *, SmallVector<Instruction *, 8>> DeadInsts;
81 SetVector<Instruction *, SmallVector<Instruction *, 8>> DeadInsts;
include/llvm/Transforms/Utils/BasicBlockUtils.h 107 BasicBlock::iterator &BI, Instruction *I);
111 void ReplaceInstWithInst(Instruction *From, Instruction *To);
111 void ReplaceInstWithInst(Instruction *From, Instruction *To);
170 BasicBlock *SplitCriticalEdge(Instruction *TI, unsigned SuccNum,
190 Instruction *TI = (*PI)->getTerminator();
204 Instruction *TI = Src->getTerminator();
229 BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt,
301 Instruction *SplitBlockAndInsertIfThen(Value *Cond, Instruction *SplitBefore,
301 Instruction *SplitBlockAndInsertIfThen(Value *Cond, Instruction *SplitBefore,
322 void SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
323 Instruction **ThenTerm,
324 Instruction **ElseTerm,
include/llvm/Transforms/Utils/CallPromotionUtils.h 38 Instruction *promoteCall(CallSite CS, Function *Callee,
48 Instruction *promoteCallWithIfThenElse(CallSite CS, Function *Callee,
include/llvm/Transforms/Utils/Cloning.h 147 const Instruction *StartingInst,
169 Instruction *TheCall = nullptr);
264 Instruction *StopAt,
include/llvm/Transforms/Utils/CodeExtractor.h 173 Instruction *AllocaAddr) const;
201 Instruction *LifeStart = nullptr;
202 Instruction *LifeEnd = nullptr;
207 Instruction *Addr, BasicBlock *ExitBlock) const;
include/llvm/Transforms/Utils/FunctionComparator.h 277 int cmpOperations(const Instruction *L, const Instruction *R,
277 int cmpOperations(const Instruction *L, const Instruction *R,
335 int cmpOperandBundlesSchema(const Instruction *L, const Instruction *R) const;
335 int cmpOperandBundlesSchema(const Instruction *L, const Instruction *R) const;
include/llvm/Transforms/Utils/Local.h 131 bool isInstructionTriviallyDead(Instruction *I,
137 bool wouldInstructionBeTriviallyDead(Instruction *I,
156 SmallVectorImpl<Instruction *> &DeadInsts,
179 bool replaceDbgUsesWithUndef(Instruction *I);
242 AllocaInst *DemoteRegToStack(Instruction &X,
244 Instruction *AllocaPoint = nullptr);
249 AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = nullptr);
262 const Instruction *CxtI = nullptr,
268 const Instruction *CxtI = nullptr,
327 Instruction *InsertBefore, DIBuilder &Builder,
355 bool salvageDebugInfo(Instruction &I);
359 bool salvageDebugInfoForDbgValues(Instruction &I,
366 DIExpression *salvageDebugInfoImpl(Instruction &I, DIExpression *DIExpr,
383 bool replaceAllDbgUsesWith(Instruction &From, Value &To, Instruction &DomPoint,
383 bool replaceAllDbgUsesWith(Instruction &From, Value &To, Instruction &DomPoint,
392 unsigned changeToUnreachable(Instruction *I, bool UseLLVMTrap,
423 void combineMetadata(Instruction *K, const Instruction *J,
423 void combineMetadata(Instruction *K, const Instruction *J,
432 void combineMetadataForCSE(Instruction *K, const Instruction *J,
432 void combineMetadataForCSE(Instruction *K, const Instruction *J,
442 void patchReplacementInstruction(Instruction *I, Value *Repl);
446 unsigned replaceNonLocalUsesWith(Instruction *From, Value *To);
481 void dropDebugUsers(Instruction &I);
488 void hoistAllInstructionsInto(BasicBlock *DomBlock, Instruction *InsertPt,
507 Instruction *I, bool MatchBSwaps, bool MatchBitReversals,
508 SmallVectorImpl<Instruction *> &InsertedInsts);
527 bool canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx);
include/llvm/Transforms/Utils/LoopUtils.h 75 bool formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
162 SmallVectorImpl<Instruction *> &, SmallVectorImpl<MemoryAccess *> &,
173 SmallVector<Instruction *, 8> findDefsUsedOutsideOfLoop(Loop *L);
289 bool canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
include/llvm/Transforms/Utils/LoopVersioning.h 62 void versionLoop(const SmallVectorImpl<Instruction *> &DefsUsedOutside);
96 void annotateInstWithNoAlias(Instruction *VersionedInst,
97 const Instruction *OrigInst);
105 void addPHINodes(const SmallVectorImpl<Instruction *> &DefsUsedOutside);
109 void annotateInstWithNoAlias(Instruction *I) {
include/llvm/Transforms/Utils/LowerMemIntrinsics.h 29 void createMemCpyLoopUnknownSize(Instruction *InsertBefore, Value *SrcAddr,
37 void createMemCpyLoopKnownSize(Instruction *InsertBefore, Value *SrcAddr,
include/llvm/Transforms/Utils/MisExpect.h 30 void verifyMisExpect(llvm::Instruction *I,
40 void checkFrontendInstrumentation(Instruction &I);
include/llvm/Transforms/Utils/SSAUpdater.h 141 LoadAndStorePromoter(ArrayRef<const Instruction *> Insts,
150 void run(const SmallVectorImpl<Instruction *> &Insts);
156 virtual bool isInstInList(Instruction *I,
157 const SmallVectorImpl<Instruction *> &Insts) const;
168 virtual void instructionDeleted(Instruction *I) const {}
171 virtual void updateDebugInfo(Instruction *I) const {}
include/llvm/Transforms/Utils/SimplifyLibCalls.h 109 function_ref<void(Instruction *, Value *)> Replacer;
110 function_ref<void(Instruction *)> Eraser;
116 static void replaceAllUsesWithDefault(Instruction *I, Value *With) {
121 static void eraseFromParentDefault(Instruction *I) { I->eraseFromParent(); }
124 void replaceAllUsesWith(Instruction *I, Value *With);
127 void eraseFromParent(Instruction *I);
130 void substituteInParent(Instruction *I, Value *With) {
142 function_ref<void(Instruction *, Value *)> Replacer =
144 function_ref<void(Instruction *)> Eraser = &eraseFromParentDefault);
include/llvm/Transforms/Utils/UnrollLoop.h 122 void remapInstruction(Instruction *I, ValueToValueMapTy &VMap);
include/llvm/Transforms/Utils/VNCoercion.h 77 Instruction *InsertPt, const DataLayout &DL);
88 Instruction *InsertPt, const DataLayout &DL);
99 Type *LoadTy, Instruction *InsertPt,
include/llvm/Transforms/Utils/ValueMapper.h 174 void remapInstruction(Instruction &I);
251 inline void RemapInstruction(Instruction *I, ValueToValueMapTy &VM,
include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h 166 void addUnsafeAlgebraInst(Instruction *I) {
178 Instruction *UnsafeAlgebraInst = nullptr;
247 DenseMap<Instruction *, Instruction *> &getSinkAfter() { return SinkAfter; }
247 DenseMap<Instruction *, Instruction *> &getSinkAfter() { return SinkAfter; }
307 bool isMaskRequired(const Instruction *I) { return (MaskedOp.count(I) != 0); }
435 SmallPtrSet<Instruction *, 4> InductionCastsToIgnore;
442 DenseMap<Instruction *, Instruction *> SinkAfter;
442 DenseMap<Instruction *, Instruction *> SinkAfter;
470 SmallPtrSet<const Instruction *, 8> MaskedOp;
include/llvm/Transforms/Vectorize/LoopVectorize.h 164 OptimizationRemarkEmitter *ORE, Loop *TheLoop, Instruction *I = nullptr);
include/llvm/Transforms/Vectorize/SLPVectorizer.h 105 bool tryToVectorize(Instruction *I, slpvectorizer::BoUpSLP &R);
133 bool vectorizeSimpleInstructions(SmallVectorImpl<Instruction *> &Instructions,
lib/Analysis/AliasAnalysis.cpp 149 ModRefInfo AAResults::getModRefInfo(Instruction *I, const CallBase *Call2) {
154 ModRefInfo AAResults::getModRefInfo(Instruction *I, const CallBase *Call2,
639 ModRefInfo AAResults::callCapturesBefore(const Instruction *I,
710 bool AAResults::canInstructionRangeModRef(const Instruction &I1,
711 const Instruction &I2,
lib/Analysis/AliasAnalysisEvaluator.cpp 59 static inline void PrintModRefResults(const char *Msg, bool P, Instruction *I,
114 Instruction &Inst = *I;
127 for (Instruction::op_iterator OI = Inst.op_begin(), OE = Inst.op_end();
lib/Analysis/AliasSetTracker.cpp 173 void AliasSet::addUnknownInst(Instruction *I, AliasAnalysis &AA) {
227 if (auto *Inst = getUnknownInst(i))
236 bool AliasSet::aliasesUnknownInst(const Instruction *Inst,
246 if (auto *UnknownInst = getUnknownInst(i)) {
263 Instruction* AliasSet::getUniqueInstruction() {
281 return cast<Instruction>(*(Addr->user_begin()));
285 return cast<Instruction>(UnknownInsts[0]);
335 AliasSet *AliasSetTracker::findAliasSetForUnknownInst(Instruction *Inst) {
433 void AliasSetTracker::addUnknown(Instruction *Inst) {
460 void AliasSetTracker::add(Instruction *I) {
516 for (auto &I : BB)
533 if (auto *Inst = AS.getUnknownInst(i))
687 if (auto *I = getUnknownInst(i)) {
lib/Analysis/AssumptionCache.cpp 64 } else if (auto *I = dyn_cast<Instruction>(V)) {
64 } else if (auto *I = dyn_cast<Instruction>(V)) {
72 if (isa<Instruction>(Op) || isa<Argument>(Op))
159 if (!isa<Instruction>(NV) && !isa<Argument>(NV))
177 for (Instruction &II : B)
286 for (const Instruction &II : B)
lib/Analysis/BasicAliasAnalysis.cpp 315 case Instruction::Or:
325 case Instruction::Add:
330 case Instruction::Sub:
335 case Instruction::Mul:
341 case Instruction::Shl:
486 if (Op->getOpcode() == Instruction::BitCast ||
487 Op->getOpcode() == Instruction::AddrSpaceCast) {
512 if (const Instruction *I = dyn_cast<Instruction>(V))
512 if (const Instruction *I = dyn_cast<Instruction>(V))
818 if (const Instruction *inst = dyn_cast<Instruction>(V)) {
818 if (const Instruction *inst = dyn_cast<Instruction>(V)) {
1917 const Instruction *Inst = dyn_cast<Instruction>(V);
1917 const Instruction *Inst = dyn_cast<Instruction>(V);
lib/Analysis/BranchProbabilityInfo.cpp 144 const Instruction *TI = BB->getTerminator();
176 const Instruction *TI = BB->getTerminator();
211 const Instruction *TI = BB->getTerminator();
255 const Instruction *TI = BB->getTerminator();
357 const Instruction *TI = BB->getTerminator();
498 if (!CI || !isa<Instruction>(CI->getOperand(0)) ||
505 Instruction *CmpLHS = dyn_cast<Instruction>(CI->getOperand(0));
505 Instruction *CmpLHS = dyn_cast<Instruction>(CI->getOperand(0));
516 CmpLHS = dyn_cast<Instruction>(CmpLHS->getOperand(0));
551 for (Instruction *I : llvm::reverse(InstChain)) {
683 if (Instruction *LHS = dyn_cast<Instruction>(CI->getOperand(0)))
683 if (Instruction *LHS = dyn_cast<Instruction>(CI->getOperand(0)))
684 if (LHS->getOpcode() == Instruction::And)
lib/Analysis/CFG.cpp 74 const Instruction *Term = BB->getTerminator();
88 bool llvm::isCriticalEdge(const Instruction *TI, unsigned SuccNum,
94 bool llvm::isCriticalEdge(const Instruction *TI, const BasicBlock *Dest,
219 const Instruction *A, const Instruction *B,
219 const Instruction *A, const Instruction *B,
lib/Analysis/CFLGraph.h 185 return CE->getOpcode() != Instruction::ICmp &&
186 CE->getOpcode() != Instruction::FCmp;
259 void visitInstruction(Instruction &) {
511 case Instruction::GetElementPtr: {
517 case Instruction::PtrToInt: {
522 case Instruction::IntToPtr: {
527 case Instruction::BitCast:
528 case Instruction::AddrSpaceCast:
529 case Instruction::Trunc:
530 case Instruction::ZExt:
531 case Instruction::SExt:
532 case Instruction::FPExt:
533 case Instruction::FPTrunc:
534 case Instruction::UIToFP:
535 case Instruction::SIToFP:
536 case Instruction::FPToUI:
537 case Instruction::FPToSI: {
542 case Instruction::Select: {
548 case Instruction::InsertElement:
549 case Instruction::InsertValue: {
555 case Instruction::ExtractElement:
556 case Instruction::ExtractValue: {
561 case Instruction::Add:
562 case Instruction::FAdd:
563 case Instruction::Sub:
564 case Instruction::FSub:
565 case Instruction::Mul:
566 case Instruction::FMul:
567 case Instruction::UDiv:
568 case Instruction::SDiv:
569 case Instruction::FDiv:
570 case Instruction::URem:
571 case Instruction::SRem:
572 case Instruction::FRem:
573 case Instruction::And:
574 case Instruction::Or:
575 case Instruction::Xor:
576 case Instruction::Shl:
577 case Instruction::LShr:
578 case Instruction::AShr:
579 case Instruction::ICmp:
580 case Instruction::FCmp:
581 case Instruction::ShuffleVector: {
587 case Instruction::FNeg: {
602 static bool hasUsefulEdges(Instruction *Inst) {
625 void addInstructionToGraph(GetEdgesVisitor &Visitor, Instruction &Inst) {
638 for (auto &Inst : Bb.getInstList())
lib/Analysis/CGSCCPassManager.cpp 450 for (Instruction &I : instructions(F))
472 for (Instruction &I : instructions(F))
lib/Analysis/CallGraph.cpp 74 for (Instruction &I : BB) {
lib/Analysis/CallGraphSCCPass.cpp 287 for (Instruction &I : BB) {
lib/Analysis/CaptureTracking.cpp 78 CapturesBefore(bool ReturnCaptures, const Instruction *I, const DominatorTree *DT,
85 bool isSafeToPrune(Instruction *I) {
134 Instruction *I = cast<Instruction>(U->getUser());
134 Instruction *I = cast<Instruction>(U->getUser());
157 const Instruction *BeforeHere;
202 bool StoreCaptures, const Instruction *I,
251 Instruction *I = cast<Instruction>(U->getUser());
251 Instruction *I = cast<Instruction>(U->getUser());
255 case Instruction::Call:
256 case Instruction::Invoke: {
300 case Instruction::Load:
306 case Instruction::VAArg:
309 case Instruction::Store:
316 case Instruction::AtomicRMW: {
328 case Instruction::AtomicCmpXchg: {
341 case Instruction::BitCast:
342 case Instruction::GetElementPtr:
343 case Instruction::PHI:
344 case Instruction::Select:
345 case Instruction::AddrSpaceCast:
349 case Instruction::ICmp: {
lib/Analysis/CodeMetrics.cpp 79 Instruction *I = cast<Instruction>(AssumeVH);
79 Instruction *I = cast<Instruction>(AssumeVH);
103 Instruction *I = cast<Instruction>(AssumeVH);
103 Instruction *I = cast<Instruction>(AssumeVH);
121 for (const Instruction &I : *BB) {
lib/Analysis/ConstantFolding.cpp 302 if (CE->getOpcode() == Instruction::PtrToInt ||
303 CE->getOpcode() == Instruction::BitCast)
334 Instruction::CastOps Cast = Instruction::BitCast;
334 Instruction::CastOps Cast = Instruction::BitCast;
338 Cast = Instruction::IntToPtr;
340 Cast = Instruction::PtrToInt;
489 if (CE->getOpcode() == Instruction::IntToPtr &&
540 Res = ConstantExpr::getCast(Instruction::IntToPtr, Res, LoadTy);
637 if (CE->getOpcode() == Instruction::GetElementPtr) {
647 if (CE->getOpcode() == Instruction::BitCast)
723 if (Opc == Instruction::And) {
743 if (Opc == Instruction::Sub) {
853 if (CE && CE->getOpcode() == Instruction::Sub &&
901 if (CE->getOpcode() == Instruction::IntToPtr) {
1021 if (Instruction::isUnaryOp(Opcode))
1024 if (Instruction::isBinaryOp(Opcode))
1027 if (Instruction::isCast(Opcode))
1044 case Instruction::ICmp:
1045 case Instruction::FCmp: llvm_unreachable("Invalid for compares");
1046 case Instruction::Call:
1053 case Instruction::Select:
1055 case Instruction::ExtractElement:
1057 case Instruction::ExtractValue:
1060 case Instruction::InsertElement:
1062 case Instruction::ShuffleVector:
1118 Constant *llvm::ConstantFoldInstruction(Instruction *I, const DataLayout &DL,
1195 Constant *llvm::ConstantFoldInstOperands(Instruction *I,
1218 if (CE0->getOpcode() == Instruction::IntToPtr) {
1230 if (CE0->getOpcode() == Instruction::PtrToInt) {
1242 if (CE0->getOpcode() == Instruction::IntToPtr) {
1256 if (CE0->getOpcode() == Instruction::PtrToInt) {
1270 CE0->getOpcode() == Instruction::Or && Ops1->isNullValue()) {
1276 Predicate == ICmpInst::ICMP_EQ ? Instruction::And : Instruction::Or;
1276 Predicate == ICmpInst::ICMP_EQ ? Instruction::And : Instruction::Or;
1313 case Instruction::PtrToInt:
1317 if (CE->getOpcode() == Instruction::IntToPtr) {
1332 case Instruction::IntToPtr:
1338 if (CE->getOpcode() == Instruction::PtrToInt) {
1352 case Instruction::Trunc:
1353 case Instruction::ZExt:
1354 case Instruction::SExt:
1355 case Instruction::FPTrunc:
1356 case Instruction::FPExt:
1357 case Instruction::UIToFP:
1358 case Instruction::SIToFP:
1359 case Instruction::FPToUI:
1360 case Instruction::FPToSI:
1361 case Instruction::AddrSpaceCast:
1363 case Instruction::BitCast:
lib/Analysis/CostModel.cpp 56 unsigned getInstructionCost(const Instruction *I) const {
101 for (Instruction &Inst : B) {
lib/Analysis/DDG.cpp 28 llvm::function_ref<bool(Instruction *)> const &Pred,
32 for (auto *I : cast<const SimpleDDGNode>(this)->getInstructions())
64 for (auto *I : cast<const SimpleDDGNode>(N).getInstructions())
79 SimpleDDGNode::SimpleDDGNode(Instruction &I)
lib/Analysis/Delinearization.cpp 74 Instruction *Inst = &(*I);
lib/Analysis/DemandedBits.cpp 80 static bool isAlwaysLive(Instruction *I) {
86 const Instruction *UserI, const Value *Val, unsigned OperandNo,
115 case Instruction::Call:
116 case Instruction::Invoke:
174 case Instruction::Add:
175 case Instruction::Sub:
176 case Instruction::Mul:
182 case Instruction::Shl:
199 case Instruction::LShr:
213 case Instruction::AShr:
233 case Instruction::And:
246 case Instruction::Or:
259 case Instruction::Xor:
260 case Instruction::PHI:
263 case Instruction::Trunc:
266 case Instruction::ZExt:
269 case Instruction::SExt:
279 case Instruction::Select:
283 case Instruction::ExtractElement:
287 case Instruction::InsertElement:
288 case Instruction::ShuffleVector:
316 SmallSetVector<Instruction*, 16> Worklist;
319 for (Instruction &I : instructions(F)) {
338 if (Instruction *J = dyn_cast<Instruction>(OI)) {
338 if (Instruction *J = dyn_cast<Instruction>(OI)) {
355 Instruction *UserI = Worklist.pop_back_val();
379 Instruction *I = dyn_cast<Instruction>(OI);
379 Instruction *I = dyn_cast<Instruction>(OI);
419 APInt DemandedBits::getDemandedBits(Instruction *I) {
431 bool DemandedBits::isInstructionDead(Instruction *I) {
444 Instruction *UserI = cast<Instruction>(U->getUser());
444 Instruction *UserI = cast<Instruction>(U->getUser());
lib/Analysis/DependenceAnalysis.cpp 250 FullDependence::FullDependence(Instruction *Source, Instruction *Destination,
250 FullDependence::FullDependence(Instruction *Source, Instruction *Destination,
677 bool isLoadOrStore(const Instruction *I) {
736 void DependenceInfo::establishNestingLevels(const Instruction *Src,
737 const Instruction *Dst) {
3264 bool DependenceInfo::tryDelinearize(Instruction *Src, Instruction *Dst,
3264 bool DependenceInfo::tryDelinearize(Instruction *Src, Instruction *Dst,
3405 DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3405 DependenceInfo::depends(Instruction *Src, Instruction *Dst,
3836 Instruction *Src = Dep.getSrc();
3837 Instruction *Dst = Dep.getDst();
lib/Analysis/DependenceGraphBuilder.cpp 31 using InstructionListType = SmallVector<Instruction *, 2>;
42 for (Instruction &I : *BB) {
87 for (Instruction *II : SrcIList) {
89 Instruction *UI = dyn_cast<Instruction>(U);
89 Instruction *UI = dyn_cast<Instruction>(U);
147 for (Instruction *ISrc : SrcIList) {
148 for (Instruction *IDst : DstIList) {
lib/Analysis/DivergenceAnalysis.cpp 110 bool DivergenceAnalysis::updateTerminator(const Instruction &Term) const {
127 bool DivergenceAnalysis::updateNormalInstruction(const Instruction &I) const {
138 const auto *Inst = dyn_cast<const Instruction>(&Val);
138 const auto *Inst = dyn_cast<const Instruction>(&Val);
179 bool DivergenceAnalysis::inRegion(const Instruction &I) const {
225 for (auto &I : *UserBlock) {
232 auto *OpInst = dyn_cast<Instruction>(&Op);
232 auto *OpInst = dyn_cast<Instruction>(&Op);
263 const auto *UserInst = dyn_cast<const Instruction>(User);
263 const auto *UserInst = dyn_cast<const Instruction>(User);
299 void DivergenceAnalysis::propagateBranchDivergence(const Instruction &Term) {
370 const Instruction &I = *Worklist.back();
417 Instruction &I = *cast<Instruction>(U.getUser());
417 Instruction &I = *cast<Instruction>(U.getUser());
438 for (auto &I : instructions(F)) {
lib/Analysis/DomTreeUpdater.cpp 220 Instruction &I = DelBB->back();
lib/Analysis/EHPersonalities.cpp 104 Instruction *VisitingHead = Visiting->getFirstNonPHI();
122 Instruction *Terminator = Visiting->getTerminator();
128 SuccColor = cast<Instruction>(ParentPad)->getParent();
lib/Analysis/GlobalsModRef.cpp 362 } else if (Operator::getOpcode(I) == Instruction::GetElementPtr) {
365 } else if (Operator::getOpcode(I) == Instruction::BitCast) {
573 for (Instruction &I : instructions(Node->getFunction())) {
lib/Analysis/GuardUtils.cpp 29 for (auto &Insn : *DeoptBB) {
lib/Analysis/IVDescriptors.cpp 43 bool RecurrenceDescriptor::areAllUsesIn(Instruction *I,
44 SmallPtrSetImpl<Instruction *> &Set) {
46 if (!Set.count(dyn_cast<Instruction>(*Use)))
87 static Instruction *lookThroughAnd(PHINode *Phi, Type *&RT,
88 SmallPtrSetImpl<Instruction *> &Visited,
89 SmallPtrSetImpl<Instruction *> &CI) {
94 Instruction *I, *J = cast<Instruction>(Phi->use_begin()->getUser());
94 Instruction *I, *J = cast<Instruction>(Phi->use_begin()->getUser());
112 static std::pair<Type *, bool> computeRecurrenceType(Instruction *Exit,
161 static void collectCastsToIgnore(Loop *TheLoop, Instruction *Exit,
163 SmallPtrSetImpl<Instruction *> &Casts) {
165 SmallVector<Instruction *, 8> Worklist;
166 SmallPtrSet<Instruction *, 8> Visited;
170 Instruction *Val = Worklist.pop_back_val();
184 if (auto *I = dyn_cast<Instruction>(O))
184 if (auto *I = dyn_cast<Instruction>(O))
211 Instruction *ExitInstruction = nullptr;
229 SmallPtrSet<Instruction *, 4> CastInsts;
230 Instruction *Start = Phi;
233 SmallPtrSet<Instruction *, 8> VisitedInsts;
234 SmallVector<Instruction *, 8> Worklist;
274 Instruction *Cur = Worklist.back();
293 !VisitedInsts.count(dyn_cast<Instruction>(Cur->getOperand(0))))
337 SmallVector<Instruction *, 8> NonPHIs;
338 SmallVector<Instruction *, 8> PHIs;
340 Instruction *UI = cast<Instruction>(U);
340 Instruction *UI = cast<Instruction>(U);
461 RecurrenceDescriptor::isMinMaxSelectCmpPattern(Instruction *I, InstDesc &Prev) {
465 Instruction *Cmp = nullptr;
520 RecurrenceKind Kind, Instruction *I) {
538 Instruction *I1 =
539 isa<PHINode>(*TrueVal) ? dyn_cast<Instruction>(FalseVal)
540 : dyn_cast<Instruction>(TrueVal);
557 RecurrenceDescriptor::isRecurrenceInstr(Instruction *I, RecurrenceKind Kind,
559 Instruction *UAI = Prev.getUnsafeAlgebraInst();
566 case Instruction::PHI:
568 case Instruction::Sub:
569 case Instruction::Add:
571 case Instruction::Mul:
573 case Instruction::And:
575 case Instruction::Or:
577 case Instruction::Xor:
579 case Instruction::FMul:
581 case Instruction::FSub:
582 case Instruction::FAdd:
584 case Instruction::Select:
588 case Instruction::FCmp:
589 case Instruction::ICmp:
598 Instruction *I, SmallPtrSetImpl<Instruction *> &Insts,
598 Instruction *I, SmallPtrSetImpl<Instruction *> &Insts,
603 if (Insts.count(dyn_cast<Instruction>(*Use)))
673 DenseMap<Instruction *, Instruction *> &SinkAfter, DominatorTree *DT) {
673 DenseMap<Instruction *, Instruction *> &SinkAfter, DominatorTree *DT) {
694 auto *Previous = dyn_cast<Instruction>(Phi->getIncomingValueForBlock(Latch));
694 auto *Previous = dyn_cast<Instruction>(Phi->getIncomingValueForBlock(Latch));
705 auto *I = Phi->user_back();
715 if (auto *I = dyn_cast<Instruction>(U)) {
715 if (auto *I = dyn_cast<Instruction>(U)) {
754 return Instruction::Add;
756 return Instruction::Mul;
758 return Instruction::Or;
760 return Instruction::And;
762 return Instruction::Xor;
764 return Instruction::FMul;
766 return Instruction::FAdd;
768 return Instruction::ICmp;
770 return Instruction::FCmp;
778 SmallVectorImpl<Instruction *> *Casts)
857 if (BOp->getOpcode() == Instruction::FAdd) {
862 } else if (BOp->getOpcode() == Instruction::FSub)
870 if (auto *I = dyn_cast<Instruction>(Addend))
870 if (auto *I = dyn_cast<Instruction>(Addend))
915 SmallVectorImpl<Instruction *> &CastInsts) {
958 auto *Inst = dyn_cast<Instruction>(Val);
958 auto *Inst = dyn_cast<Instruction>(Val);
979 Inst = dyn_cast<Instruction>(Val);
1021 SmallVector<Instruction *, 2> Casts;
1032 SmallVectorImpl<Instruction *> *CastsToIgnore) {
lib/Analysis/IVUsers.cpp 59 static bool isInteresting(const SCEV *S, const Instruction *I, const Loop *L,
128 static bool IVUseShouldUsePostIncValue(Instruction *User, Value *Operand,
167 bool IVUsers::AddUsersImpl(Instruction *I,
205 SmallPtrSet<Instruction *, 4> UniqueUsers;
207 Instruction *User = cast<Instruction>(U.getUser());
207 Instruction *User = cast<Instruction>(U.getUser());
290 bool IVUsers::AddUsersIfInteresting(Instruction *I) {
299 IVStrideUse &IVUsers::AddUser(Instruction *User, Value *Operand) {
lib/Analysis/IndirectCallPromotionAnalysis.cpp 70 const Instruction *Inst, uint32_t NumVals, uint64_t TotalCount) {
95 const Instruction *I, uint32_t &NumVals, uint64_t &TotalCount,
lib/Analysis/InlineCost.cpp 212 bool simplifyInstruction(Instruction &I, Callable Evaluate);
262 bool visitInstruction(Instruction &I);
614 bool CallAnalyzer::simplifyInstruction(Instruction &I, Callable Evaluate) {
728 case Instruction::FPTrunc:
729 case Instruction::FPExt:
730 case Instruction::UIToFP:
731 case Instruction::SIToFP:
732 case Instruction::FPToUI:
733 case Instruction::FPToSI:
990 if (I.getOpcode() == Instruction::FCmp)
1539 bool CallAnalyzer::visitInstruction(Instruction &I) {
1667 } else if (Operator::getOpcode(V) == Instruction::BitCast) {
1858 Instruction *TI = BB->getTerminator();
2105 for (auto &II : *BI) {
lib/Analysis/InstCount.cpp 46 void visitInstruction(Instruction &I) {
lib/Analysis/InstructionPrecedenceTracking.cpp 34 const Instruction *InstructionPrecedenceTracking::getFirstSpecialInstruction(
58 const Instruction *Insn) {
59 const Instruction *MaybeFirstSpecial =
83 for (const Instruction &Insn : *BB)
102 void InstructionPrecedenceTracking::insertInstructionTo(const Instruction *Inst,
109 void InstructionPrecedenceTracking::removeInstruction(const Instruction *Inst) {
126 const Instruction *Insn) const {
155 const Instruction *Insn) const {
lib/Analysis/InstructionSimplify.cpp 142 Instruction *I = dyn_cast<Instruction>(V);
142 Instruction *I = dyn_cast<Instruction>(V);
171 static Value *ExpandBinOp(Instruction::BinaryOps Opcode, Value *LHS, Value *RHS,
172 Instruction::BinaryOps OpcodeToExpand,
188 if ((L == A && R == B) || (Instruction::isCommutative(OpcodeToExpand)
211 if ((L == B && R == C) || (Instruction::isCommutative(OpcodeToExpand)
229 static Value *SimplifyAssociativeBinOp(Instruction::BinaryOps Opcode,
281 if (!Instruction::isCommutative(Opcode))
329 static Value *ThreadBinOpOverSelect(Instruction::BinaryOps Opcode, Value *LHS,
377 Instruction *Simplified = dyn_cast<Instruction>(FV ? FV : TV);
377 Instruction *Simplified = dyn_cast<Instruction>(FV ? FV : TV);
483 static Value *ThreadBinOpOverPHI(Instruction::BinaryOps Opcode, Value *LHS,
560 static Constant *foldOrCommuteConstant(Instruction::BinaryOps Opcode,
568 if (Instruction::isCommutative(Opcode))
578 if (Constant *C = foldOrCommuteConstant(Instruction::Add, Op0, Op1, Q))
624 if (Value *V = SimplifyAssociativeBinOp(Instruction::Add, Op0, Op1, Q,
698 if (Constant *C = foldOrCommuteConstant(Instruction::Sub, Op0, Op1, Q))
737 if (Value *V = SimplifyBinOp(Instruction::Sub, Y, Z, Q, MaxRecurse-1))
739 if (Value *W = SimplifyBinOp(Instruction::Add, X, V, Q, MaxRecurse-1)) {
745 if (Value *V = SimplifyBinOp(Instruction::Sub, X, Z, Q, MaxRecurse-1))
747 if (Value *W = SimplifyBinOp(Instruction::Add, Y, V, Q, MaxRecurse-1)) {
759 if (Value *V = SimplifyBinOp(Instruction::Sub, X, Y, Q, MaxRecurse-1))
761 if (Value *W = SimplifyBinOp(Instruction::Sub, V, Z, Q, MaxRecurse-1)) {
767 if (Value *V = SimplifyBinOp(Instruction::Sub, X, Z, Q, MaxRecurse-1))
769 if (Value *W = SimplifyBinOp(Instruction::Sub, V, Y, Q, MaxRecurse-1)) {
781 if (Value *V = SimplifyBinOp(Instruction::Sub, Z, X, Q, MaxRecurse-1))
783 if (Value *W = SimplifyBinOp(Instruction::Add, V, Y, Q, MaxRecurse-1)) {
794 if (Value *V = SimplifyBinOp(Instruction::Sub, X, Y, Q, MaxRecurse-1))
796 if (Value *W = SimplifyCastInst(Instruction::Trunc, V, Op0->getType(),
833 if (Constant *C = foldOrCommuteConstant(Instruction::Mul, Op0, Op1, Q))
859 if (Value *V = SimplifyAssociativeBinOp(Instruction::Mul, Op0, Op1, Q,
864 if (Value *V = ExpandBinOp(Instruction::Mul, Op0, Op1, Instruction::Add,
864 if (Value *V = ExpandBinOp(Instruction::Mul, Op0, Op1, Instruction::Add,
871 if (Value *V = ThreadBinOpOverSelect(Instruction::Mul, Op0, Op1, Q,
878 if (Value *V = ThreadBinOpOverPHI(Instruction::Mul, Op0, Op1, Q,
1008 static Value *simplifyDiv(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
1016 bool IsSigned = Opcode == Instruction::SDiv;
1066 static Value *simplifyRem(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
1075 if ((Opcode == Instruction::SRem &&
1077 (Opcode == Instruction::URem &&
1083 ((Opcode == Instruction::SRem &&
1085 (Opcode == Instruction::URem &&
1102 if (isDivZero(Op0, Op1, Q, MaxRecurse, Opcode == Instruction::SRem))
1116 return simplifyDiv(Instruction::SDiv, Op0, Op1, Q, MaxRecurse);
1127 return simplifyDiv(Instruction::UDiv, Op0, Op1, Q, MaxRecurse);
1148 return simplifyRem(Instruction::SRem, Op0, Op1, Q, MaxRecurse);
1159 return simplifyRem(Instruction::URem, Op0, Op1, Q, MaxRecurse);
1195 static Value *SimplifyShift(Instruction::BinaryOps Opcode, Value *Op0,
1245 static Value *SimplifyRightShift(Instruction::BinaryOps Opcode, Value *Op0,
1274 if (Value *V = SimplifyShift(Instruction::Shl, Op0, Op1, Q, MaxRecurse))
1306 if (Value *V = SimplifyRightShift(Instruction::LShr, Op0, Op1, isExact, Q,
1344 if (Value *V = SimplifyRightShift(Instruction::AShr, Op0, Op1, isExact, Q,
1905 if (Constant *C = foldOrCommuteConstant(Instruction::And, Op0, Op1, Q))
1988 if (Value *V = SimplifyAssociativeBinOp(Instruction::And, Op0, Op1, Q,
1993 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1993 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Or,
1998 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Xor,
1998 if (Value *V = ExpandBinOp(Instruction::And, Op0, Op1, Instruction::Xor,
2005 if (Value *V = ThreadBinOpOverSelect(Instruction::And, Op0, Op1, Q,
2012 if (Value *V = ThreadBinOpOverPHI(Instruction::And, Op0, Op1, Q,
2061 if (Constant *C = foldOrCommuteConstant(Instruction::Or, Op0, Op1, Q))
2146 if (Value *V = SimplifyAssociativeBinOp(Instruction::Or, Op0, Op1, Q,
2151 if (Value *V = ExpandBinOp(Instruction::Or, Op0, Op1, Instruction::And, Q,
2151 if (Value *V = ExpandBinOp(Instruction::Or, Op0, Op1, Instruction::And, Q,
2158 if (Value *V = ThreadBinOpOverSelect(Instruction::Or, Op0, Op1, Q,
2191 if (Value *V = ThreadBinOpOverPHI(Instruction::Or, Op0, Op1, Q, MaxRecurse))
2205 if (Constant *C = foldOrCommuteConstant(Instruction::Xor, Op0, Op1, Q))
2226 if (Value *V = SimplifyAssociativeBinOp(Instruction::Xor, Op0, Op1, Q,
2302 AssumptionCache *AC, const Instruction *CxtI,
2676 if (LBO && LBO->getOpcode() == Instruction::Add) {
2686 if (RBO && RBO->getOpcode() == Instruction::Add) {
2935 case Instruction::UDiv:
2936 case Instruction::LShr:
2944 case Instruction::SDiv:
2952 case Instruction::AShr:
2959 case Instruction::Shl: {
3221 if (isa<Instruction>(RHS) && isa<Instruction>(LHS)) {
3221 if (isa<Instruction>(RHS) && isa<Instruction>(LHS)) {
3222 auto RHS_Instr = cast<Instruction>(RHS);
3223 auto LHS_Instr = cast<Instruction>(LHS);
3245 Instruction *LI = cast<CastInst>(LHS);
3675 auto *I = dyn_cast<Instruction>(V);
3675 auto *I = dyn_cast<Instruction>(V);
4297 DstIntPtrTy) == Instruction::BitCast)
4303 if (CastOpc == Instruction::BitCast)
4448 static Constant *foldConstant(Instruction::UnaryOps Opcode,
4459 if (Constant *C = foldConstant(Instruction::FNeg, Op, Q))
4503 if (Constant *C = foldOrCommuteConstant(Instruction::FAdd, Op0, Op1, Q))
4550 if (Constant *C = foldOrCommuteConstant(Instruction::FSub, Op0, Op1, Q))
4629 if (Constant *C = foldOrCommuteConstant(Instruction::FMul, Op0, Op1, Q))
4659 if (Constant *C = foldOrCommuteConstant(Instruction::FDiv, Op0, Op1, Q))
4704 if (Constant *C = foldOrCommuteConstant(Instruction::FRem, Op0, Op1, Q))
4737 case Instruction::FNeg:
4751 case Instruction::FNeg:
4772 case Instruction::Add:
4774 case Instruction::Sub:
4776 case Instruction::Mul:
4778 case Instruction::SDiv:
4780 case Instruction::UDiv:
4782 case Instruction::SRem:
4784 case Instruction::URem:
4786 case Instruction::Shl:
4788 case Instruction::LShr:
4790 case Instruction::AShr:
4792 case Instruction::And:
4794 case Instruction::Or:
4796 case Instruction::Xor:
4798 case Instruction::FAdd:
4800 case Instruction::FSub:
4802 case Instruction::FMul:
4804 case Instruction::FDiv:
4806 case Instruction::FRem:
4820 case Instruction::FAdd:
4822 case Instruction::FSub:
4824 case Instruction::FMul:
4826 case Instruction::FDiv:
4904 if (LoadedCE->getOpcode() == Instruction::Trunc) {
4910 if (LoadedCE->getOpcode() != Instruction::Sub)
4914 if (!LoadedLHS || LoadedLHS->getOpcode() != Instruction::PtrToInt)
5238 Value *llvm::SimplifyInstruction(Instruction *I, const SimplifyQuery &SQ,
5247 case Instruction::FNeg:
5250 case Instruction::FAdd:
5254 case Instruction::Add:
5260 case Instruction::FSub:
5264 case Instruction::Sub:
5270 case Instruction::FMul:
5274 case Instruction::Mul:
5277 case Instruction::SDiv:
5280 case Instruction::UDiv:
5283 case Instruction::FDiv:
5287 case Instruction::SRem:
5290 case Instruction::URem:
5293 case Instruction::FRem:
5297 case Instruction::Shl:
5303 case Instruction::LShr:
5307 case Instruction::AShr:
5311 case Instruction::And:
5314 case Instruction::Or:
5317 case Instruction::Xor:
5320 case Instruction::ICmp:
5324 case Instruction::FCmp:
5329 case Instruction::Select:
5333 case Instruction::GetElementPtr: {
5339 case Instruction::InsertValue: {
5346 case Instruction::InsertElement: {
5352 case Instruction::ExtractValue: {
5358 case Instruction::ExtractElement: {
5364 case Instruction::ShuffleVector: {
5370 case Instruction::PHI:
5373 case Instruction::Call: {
5383 case Instruction::Alloca:
5417 Instruction *I, Value *SimpleV, const TargetLibraryInfo *TLI,
5419 SmallSetVector<Instruction *, 8> *UnsimplifiedUsers = nullptr) {
5421 SmallSetVector<Instruction *, 8> Worklist;
5429 Worklist.insert(cast<Instruction>(U));
5461 Worklist.insert(cast<Instruction>(U));
5475 bool llvm::recursivelySimplifyInstruction(Instruction *I,
5483 Instruction *I, Value *SimpleV, const TargetLibraryInfo *TLI,
5485 SmallSetVector<Instruction *, 8> *UnsimplifiedUsers) {
lib/Analysis/LazyCallGraph.cpp 101 for (Instruction &I : BB) {
lib/Analysis/LazyValueInfo.cpp 368 virtual void emitInstructionAnnot(const Instruction *I,
408 ValueLatticeElement &Result, Instruction *CxtI = nullptr);
423 Optional<ConstantRange> getRangeForOperand(unsigned Op, Instruction *I,
426 ValueLatticeElement &BBLV, Instruction *I, BasicBlock *BB,
443 Instruction *BBI);
451 Instruction *CxtI = nullptr);
456 ValueLatticeElement getValueAt(Value *V, Instruction *CxtI);
462 Instruction *CxtI = nullptr);
577 static ValueLatticeElement getFromRangeMetadata(Instruction *BBI) {
580 case Instruction::Load:
581 case Instruction::Call:
582 case Instruction::Invoke:
623 Instruction *BBI = dyn_cast<Instruction>(Val);
623 Instruction *BBI = dyn_cast<Instruction>(Val);
667 static bool InstructionDereferencesPointer(Instruction *I, Value *Ptr) {
710 for (Instruction &I : *BB)
823 Value *Val, ValueLatticeElement &BBLV, Instruction *BBI) {
824 BBI = BBI ? BBI : dyn_cast<Instruction>(Val);
846 for (Instruction &I : make_range(std::next(BBI->getIterator().getReverse()),
997 Instruction *I,
1029 case Instruction::Trunc:
1030 case Instruction::SExt:
1031 case Instruction::ZExt:
1032 case Instruction::BitCast:
1062 ValueLatticeElement &BBLV, Instruction *I, BasicBlock *BB,
1087 if (BO->getOpcode() == Instruction::Xor) {
1234 else if (Instruction *I = dyn_cast<Instruction>(RHS))
1234 else if (Instruction *I = dyn_cast<Instruction>(RHS))
1506 Instruction *CxtI) {
1552 Instruction *CxtI) {
1568 ValueLatticeElement LazyValueInfoImpl::getValueAt(Value *V, Instruction *CxtI) {
1576 if (auto *I = dyn_cast<Instruction>(V))
1576 if (auto *I = dyn_cast<Instruction>(V))
1586 Instruction *CxtI) {
1695 Instruction *CxtI) {
1715 Instruction *CxtI) {
1736 Instruction *CxtI) {
1754 Instruction *CxtI) {
1841 Instruction *CxtI) {
1851 Instruction *CxtI) {
1928 if (!isa<Instruction>(V) ||
1929 cast<Instruction>(V)->getParent() != BB) {
2001 const Instruction *I, formatted_raw_ostream &OS) {
2029 if (auto *UseI = dyn_cast<Instruction>(U))
lib/Analysis/LegacyDivergenceAnalysis.cpp 106 void exploreSyncDependency(Instruction *TI);
114 Instruction &I, const DenseSet<BasicBlock *> &InfluenceRegion);
130 for (auto &I : instructions(F)) {
144 void DivergencePropagator::exploreSyncDependency(Instruction *TI) {
204 for (auto &I : *InfluencedBB) {
216 Instruction &I, const DenseSet<BasicBlock *> &InfluenceRegion) {
218 Instruction *UserInst = cast<Instruction>(Use.getUser());
218 Instruction *UserInst = cast<Instruction>(Use.getUser());
270 if (Instruction *I = dyn_cast<Instruction>(V)) {
270 if (Instruction *I = dyn_cast<Instruction>(V)) {
377 } else if (const Instruction *I =
378 dyn_cast<Instruction>(FirstDivergentValue)) {
lib/Analysis/Lint.cpp 96 void visitMemoryReference(Instruction &I, Value *Ptr,
158 if (isa<Instruction>(V)) {
225 Instruction &I = *CS.getInstruction();
414 void Lint::visitMemoryReference(Instruction &I,
557 KnownBits Known = computeKnownBits(V, DL, 0, AC, dyn_cast<Instruction>(V), DT);
703 if (Instruction::isCast(CE->getOpcode())) {
708 } else if (CE->getOpcode() == Instruction::ExtractValue) {
717 if (Instruction *Inst = dyn_cast<Instruction>(V)) {
717 if (Instruction *Inst = dyn_cast<Instruction>(V)) {
lib/Analysis/Loads.cpp 54 const Instruction *CtxI, const DominatorTree *DT,
126 const Instruction *CtxI,
141 const Instruction *CtxI,
161 const Instruction *CtxI,
189 if (const Instruction *BI = dyn_cast<Instruction>(B))
189 if (const Instruction *BI = dyn_cast<Instruction>(B))
190 if (cast<Instruction>(A)->isIdenticalToWhenDefined(BI))
208 Instruction *HeaderFirstNonPHI = L->getHeader()->getFirstNonPHI();
264 Instruction *ScanFrom,
271 const Instruction* CtxI = DT ? ScanFrom : nullptr;
343 Instruction *ScanFrom,
395 Instruction *Inst = &*--ScanFrom;
lib/Analysis/LoopAccessAnalysis.cpp 1711 SmallVector<Instruction *, 4>
1716 SmallVector<Instruction *, 4> Insts;
1729 const SmallVectorImpl<Instruction *> &Instrs) const {
1816 for (Instruction &I : *BB) {
2088 Instruction *I) {
2120 static Instruction *getFirstInst(Instruction *FirstInst, Value *V,
2120 static Instruction *getFirstInst(Instruction *FirstInst, Value *V,
2121 Instruction *Loc) {
2124 if (Instruction *I = dyn_cast<Instruction>(V))
2124 if (Instruction *I = dyn_cast<Instruction>(V))
2146 Instruction *Loc, SCEVExpander &Exp, ScalarEvolution *SE,
2162 Instruction *Inst = dyn_cast<Instruction>(Ptr);
2162 Instruction *Inst = dyn_cast<Instruction>(Ptr);
2203 std::pair<Instruction *, Instruction *> LoopAccessInfo::addRuntimeChecks(
2203 std::pair<Instruction *, Instruction *> LoopAccessInfo::addRuntimeChecks(
2204 Instruction *Loc,
2214 Instruction *FirstInst = nullptr;
2266 Instruction *Check = BinaryOperator::CreateAnd(MemoryRuntimeCheck,
2273 std::pair<Instruction *, Instruction *>
2273 std::pair<Instruction *, Instruction *>
2274 LoopAccessInfo::addRuntimeChecks(Instruction *Loc) const {
lib/Analysis/LoopCacheAnalysis.cpp 128 IndexedReference::IndexedReference(Instruction &StoreOrLoadInst,
519 for (Instruction &I : *BB) {
lib/Analysis/LoopInfo.cpp 62 if (const Instruction *I = dyn_cast<Instruction>(V))
62 if (const Instruction *I = dyn_cast<Instruction>(V))
67 bool Loop::hasLoopInvariantOperands(const Instruction *I) const {
71 bool Loop::makeLoopInvariant(Value *V, bool &Changed, Instruction *InsertPt,
73 if (Instruction *I = dyn_cast<Instruction>(V))
73 if (Instruction *I = dyn_cast<Instruction>(V))
78 bool Loop::makeLoopInvariant(Instruction *I, bool &Changed,
79 Instruction *InsertPt,
159 if (Instruction *Inc =
160 dyn_cast<Instruction>(PN->getIncomingValueForBlock(Backedge)))
161 if (Inc->getOpcode() == Instruction::Add && Inc->getOperand(0) == PN)
181 const Instruction &StepInst) {
205 Instruction *StepInst = IndDesc.getInductionBinOp();
300 Instruction *LatchCmpOp0 = dyn_cast<Instruction>(CmpInst->getOperand(0));
300 Instruction *LatchCmpOp0 = dyn_cast<Instruction>(CmpInst->getOperand(0));
301 Instruction *LatchCmpOp1 = dyn_cast<Instruction>(CmpInst->getOperand(1));
301 Instruction *LatchCmpOp1 = dyn_cast<Instruction>(CmpInst->getOperand(1));
308 Instruction *StepInst = IndDesc.getInductionBinOp();
345 if (const Instruction *I = dyn_cast<Instruction>(U))
345 if (const Instruction *I = dyn_cast<Instruction>(U))
354 if (IndDesc.getInductionOpcode() != Instruction::Add &&
355 IndDesc.getInductionOpcode() != Instruction::Sub)
410 if (IndDesc.getInductionOpcode() != Instruction::Add)
423 for (const Instruction &I : BB) {
431 const Instruction *UI = cast<Instruction>(U.getUser());
431 const Instruction *UI = cast<Instruction>(U.getUser());
481 for (Instruction &I : *BB)
496 Instruction *TI = BB->getTerminator();
561 for (Instruction &I : *BB) {
lib/Analysis/LoopPass.cpp 108 for (Instruction &I : *BB) {
lib/Analysis/LoopUnrollAnalyzer.cpp 27 bool UnrolledInstAnalyzer::simplifyInstWithSCEV(Instruction *I) {
lib/Analysis/MemDepPrinter.cpp 34 typedef PointerIntPair<const Instruction *, 2, DepType> InstTypePair;
37 typedef DenseMap<const Instruction *, DepSet> DepSetMap;
97 for (auto &I : instructions(F)) {
98 Instruction *Inst = &I;
134 for (const auto &I : instructions(*F)) {
135 const Instruction *Inst = &I;
144 const Instruction *DepInst = I.first.getPointer();
lib/Analysis/MemDerefPrinter.cpp 53 for (auto &I: instructions(F)) {
lib/Analysis/MemoryBuiltins.cpp 583 if (Instruction *I = dyn_cast<Instruction>(V)) {
583 if (Instruction *I = dyn_cast<Instruction>(V)) {
604 if (CE->getOpcode() == Instruction::IntToPtr)
606 if (CE->getOpcode() == Instruction::GetElementPtr)
817 SizeOffsetType ObjectSizeOffsetVisitor::visitInstruction(Instruction &I) {
854 for (Instruction *I : InsertedInstructions) {
882 if (Instruction *I = dyn_cast<Instruction>(V))
882 if (Instruction *I = dyn_cast<Instruction>(V))
895 } else if (Instruction *I = dyn_cast<Instruction>(V)) {
895 } else if (Instruction *I = dyn_cast<Instruction>(V)) {
899 cast<ConstantExpr>(V)->getOpcode() == Instruction::IntToPtr) ||
1047 SizeOffsetEvalType ObjectSizeOffsetEvaluator::visitInstruction(Instruction &I) {
lib/Analysis/MemoryDependenceAnalysis.cpp 99 RemoveFromReverseMap(DenseMap<Instruction *, SmallPtrSet<KeyTy, 4>> &ReverseMap,
100 Instruction *Inst, KeyTy Val) {
101 typename DenseMap<Instruction *, SmallPtrSet<KeyTy, 4>>::iterator InstIt =
116 static ModRefInfo GetLocation(const Instruction *Inst, MemoryLocation &Loc,
190 Instruction *Inst = &*--ScanIt;
317 static bool isVolatile(Instruction *Inst) {
329 BasicBlock *BB, Instruction *QueryInst, unsigned *Limit,
377 Instruction *ClosestDependency = nullptr;
395 auto *U = dyn_cast<Instruction>(Us.getUser());
395 auto *U = dyn_cast<Instruction>(Us.getUser());
442 BasicBlock *BB, Instruction *QueryInst, unsigned *Limit,
517 Instruction *Inst = &*--ScanIt;
714 MemDepResult MemoryDependenceResults::getDependency(Instruction *QueryInst,
716 Instruction *ScanPos = QueryInst;
728 if (Instruction *Inst = LocalCache.getInst()) {
766 if (Instruction *I = LocalCache.getInst())
867 if (Instruction *Inst = ExistingResult->getResult().getInst()) {
870 RemoveFromReverseMap<Instruction *>(ReverseNonLocalDeps, Inst,
900 if (Instruction *Inst = Dep.getInst())
915 Instruction *QueryInst, SmallVectorImpl<NonLocalDepResult> &Result) {
978 Instruction *QueryInst, const MemoryLocation &Loc, bool isLoad,
1035 Instruction *Inst = Dep.getInst();
1093 Instruction *QueryInst, const PHITransAddr &Pointer,
1137 if (Instruction *Inst = Entry.getResult().getInst())
1157 if (Instruction *Inst = Entry.getResult().getInst())
1493 if (auto *I = dyn_cast<Instruction>(P.getPointer())) {
1512 Instruction *Target = PInfo[i].getResult().getInst();
1541 void MemoryDependenceResults::removeInstruction(Instruction *RemInst) {
1548 if (Instruction *Inst = Entry.getResult().getInst())
1557 if (Instruction *Inst = LocalDepEntry->second.getInst())
1576 SmallVector<std::pair<Instruction *, Instruction *>, 8> ReverseDepsToAdd;
1576 SmallVector<std::pair<Instruction *, Instruction *>, 8> ReverseDepsToAdd;
1594 for (Instruction *InstDependingOnRemInst : ReverseDepIt->second) {
1621 for (Instruction *I : ReverseDepIt->second) {
1635 if (Instruction *NextI = NewDirtyVal.getInst())
1655 SmallVector<std::pair<Instruction *, ValueIsLoadPair>, 8>
1675 if (Instruction *NewDirtyInst = NewDirtyVal.getInst())
1704 void MemoryDependenceResults::verifyRemoved(Instruction *D) const {
1727 for (Instruction *Inst : DepKV.second)
1733 for (Instruction *Inst : DepKV.second)
lib/Analysis/MemorySSA.cpp 112 void emitInstructionAnnot(const Instruction *I,
137 MemoryLocOrCall(Instruction *Inst) {
263 const Instruction *UseInst, AliasAnalysisType &AA) {
264 Instruction *DefInst = MD->getMemoryInst();
342 const Instruction *Inst = nullptr;
350 UpwardsMemoryQuery(const Instruction *Inst, const MemoryAccess *Access)
361 Instruction *Inst = MD->getMemoryInst();
375 const Instruction *I) {
1525 for (Instruction &I : B) {
1700 MemoryUseOrDef *MemorySSA::createDefinedAccess(Instruction *I,
1717 static inline bool isOrdered(const Instruction *I) {
1730 MemoryUseOrDef *MemorySSA::createNewAccess(Instruction *I,
1978 for (Instruction &I : B) {
2035 for (Instruction &I : B) {
2344 Instruction *I = StartingUseOrDef->getMemoryInst();
2393 const Instruction *I = StartingAccess->getMemoryInst();
lib/Analysis/MemorySSAUpdater.cpp 553 Instruction *DefMUDI = DefMUD->getMemoryInst();
555 if (Instruction *NewDefMUDI =
556 cast_or_null<Instruction>(VMap.lookup(DefMUDI))) {
591 Instruction *Insn = MUD->getMemoryInst();
599 if (Instruction *NewInsn =
600 dyn_cast_or_null<Instruction>(VMap.lookup(Insn))) {
683 Instruction *IncI = IncMUD->getMemoryInst();
685 if (Instruction *NewIncI =
686 cast_or_null<Instruction>(VMap.lookup(IncI))) {
1167 Instruction *Start) {
1175 for (Instruction &I : make_range(Start->getIterator(), To->end()))
1203 Instruction *Start) {
1213 Instruction *Start) {
1343 Instruction *TI = BB->getTerminator();
1377 void MemorySSAUpdater::changeToUnreachable(const Instruction *I) {
1415 Instruction *I, MemoryAccess *Definition, const BasicBlock *BB,
1423 Instruction *I, MemoryAccess *Definition, MemoryUseOrDef *InsertPt) {
1433 Instruction *I, MemoryAccess *Definition, MemoryAccess *InsertPt) {
lib/Analysis/ModuleSummaryAnalysis.cpp 207 SmallVector<Instruction *, 4> LoadedPtrs;
208 SmallVector<Instruction *, 4> Preds;
227 static bool isNonVolatileLoad(const Instruction *I) {
234 static bool isNonVolatileStore(const Instruction *I) {
267 std::vector<const Instruction *> NonVolatileLoads;
268 std::vector<const Instruction *> NonVolatileStores;
272 for (const Instruction &I : BB) {
399 for (const auto *I : Instrs) {
lib/Analysis/MustExecute.cpp 90 void ICFLoopSafetyInfo::insertInstructionTo(const Instruction *Inst,
96 void ICFLoopSafetyInfo::removeInstruction(const Instruction *Inst) {
246 bool SimpleLoopSafetyInfo::isGuaranteedToExecute(const Instruction &Inst,
265 bool ICFLoopSafetyInfo::isGuaranteedToExecute(const Instruction &Inst,
292 bool ICFLoopSafetyInfo::doesNotWriteMemoryBefore(const Instruction &I,
358 for (Instruction &I : instructions(F)) {
360 for (const Instruction *CI : Explorer.range(&I))
369 static bool isMustExecuteIn(const Instruction &I, Loop *L, DominatorTree *DT) {
446 const Instruction *
448 MustBeExecutedIterator &It, const Instruction *PP) {
471 const Instruction *NextPP = PP->getNextNode();
498 MustBeExecutedContextExplorer &Explorer, const Instruction *I)
503 void MustBeExecutedIterator::reset(const Instruction *I) {
509 const Instruction *MustBeExecutedIterator::advance() {
511 const Instruction *Next =
lib/Analysis/ObjCARCInstKind.cpp 214 if (const Instruction *I = dyn_cast<Instruction>(V)) {
214 if (const Instruction *I = dyn_cast<Instruction>(V)) {
222 case Instruction::Call: {
239 case Instruction::Invoke:
242 case Instruction::BitCast:
243 case Instruction::GetElementPtr:
244 case Instruction::Select:
245 case Instruction::PHI:
246 case Instruction::Ret:
247 case Instruction::Br:
248 case Instruction::Switch:
249 case Instruction::IndirectBr:
250 case Instruction::Alloca:
251 case Instruction::VAArg:
252 case Instruction::Add:
253 case Instruction::FAdd:
254 case Instruction::Sub:
255 case Instruction::FSub:
256 case Instruction::Mul:
257 case Instruction::FMul:
258 case Instruction::SDiv:
259 case Instruction::UDiv:
260 case Instruction::FDiv:
261 case Instruction::SRem:
262 case Instruction::URem:
263 case Instruction::FRem:
264 case Instruction::Shl:
265 case Instruction::LShr:
266 case Instruction::AShr:
267 case Instruction::And:
268 case Instruction::Or:
269 case Instruction::Xor:
270 case Instruction::SExt:
271 case Instruction::ZExt:
272 case Instruction::Trunc:
273 case Instruction::IntToPtr:
274 case Instruction::FCmp:
275 case Instruction::FPTrunc:
276 case Instruction::FPExt:
277 case Instruction::FPToUI:
278 case Instruction::FPToSI:
279 case Instruction::UIToFP:
280 case Instruction::SIToFP:
281 case Instruction::InsertElement:
282 case Instruction::ExtractElement:
283 case Instruction::ShuffleVector:
284 case Instruction::ExtractValue:
286 case Instruction::ICmp:
lib/Analysis/OrderedBasicBlock.cpp 34 bool OrderedBasicBlock::comesBefore(const Instruction *A,
35 const Instruction *B) {
36 const Instruction *Inst = nullptr;
50 Inst = cast<Instruction>(II);
66 bool OrderedBasicBlock::dominates(const Instruction *A, const Instruction *B) {
66 bool OrderedBasicBlock::dominates(const Instruction *A, const Instruction *B) {
89 void OrderedBasicBlock::eraseInstruction(const Instruction *I) {
101 void OrderedBasicBlock::replaceInstruction(const Instruction *Old,
102 const Instruction *New) {
lib/Analysis/OrderedInstructions.cpp 16 bool OrderedInstructions::localDominates(const Instruction *InstA,
17 const Instruction *InstB) const {
31 bool OrderedInstructions::dominates(const Instruction *InstA,
32 const Instruction *InstB) const {
40 bool OrderedInstructions::dfsBefore(const Instruction *InstA,
41 const Instruction *InstB) const {
lib/Analysis/PHITransAddr.cpp 25 static bool CanPHITrans(Instruction *Inst) {
34 if (Inst->getOpcode() == Instruction::Add &&
58 SmallVectorImpl<Instruction*> &InstInputs) {
60 Instruction *I = dyn_cast<Instruction>(Expr);
60 Instruction *I = dyn_cast<Instruction>(Expr);
65 SmallVectorImpl<Instruction *>::iterator Entry = find(InstInputs, I);
94 SmallVector<Instruction*, 8> Tmp(InstInputs.begin(), InstInputs.end());
117 Instruction *Inst = dyn_cast<Instruction>(Addr);
117 Instruction *Inst = dyn_cast<Instruction>(Addr);
123 SmallVectorImpl<Instruction*> &InstInputs) {
124 Instruction *I = dyn_cast<Instruction>(V);
124 Instruction *I = dyn_cast<Instruction>(V);
128 SmallVectorImpl<Instruction *>::iterator Entry = find(InstInputs, I);
138 if (Instruction *Op = dyn_cast<Instruction>(I->getOperand(i)))
138 if (Instruction *Op = dyn_cast<Instruction>(I->getOperand(i)))
147 Instruction *Inst = dyn_cast<Instruction>(V);
147 Instruction *Inst = dyn_cast<Instruction>(V);
179 if (Instruction *Op = dyn_cast<Instruction>(Inst->getOperand(i)))
179 if (Instruction *Op = dyn_cast<Instruction>(Inst->getOperand(i)))
253 if (Inst->getOpcode() == Instruction::Add &&
265 if (BOp->getOpcode() == Instruction::Add)
293 if (BO->getOpcode() == Instruction::Add &&
326 if (Instruction *Inst = dyn_cast_or_null<Instruction>(Addr))
326 if (Instruction *Inst = dyn_cast_or_null<Instruction>(Addr))
343 SmallVectorImpl<Instruction*> &NewInsts) {
367 SmallVectorImpl<Instruction*> &NewInsts) {
375 auto *Inst = dyn_cast<Instruction>(InVal);
375 auto *Inst = dyn_cast<Instruction>(InVal);
lib/Analysis/PhiValues.cpp 168 if (Instruction *I = dyn_cast<Instruction>(V))
168 if (Instruction *I = dyn_cast<Instruction>(V))
lib/Analysis/ProfileSummaryInfo.cpp 103 ProfileSummaryInfo::getProfileCount(const Instruction *Inst,
154 for (const auto &I : BB)
183 for (const auto &I : BB)
208 for (const auto &I : BB)
lib/Analysis/PtrUseVisitor.cpp 21 void detail::PtrUseVisitorBase::enqueueUsers(Instruction &I) {
lib/Analysis/ScalarEvolution.cpp 489 if (VCE->getOpcode() == Instruction::PtrToInt)
491 if (CE->getOpcode() == Instruction::GetElementPtr &&
506 if (VCE->getOpcode() == Instruction::PtrToInt)
508 if (CE->getOpcode() == Instruction::GetElementPtr &&
531 if (VCE->getOpcode() == Instruction::PtrToInt)
533 if (CE->getOpcode() == Instruction::GetElementPtr &&
616 if (const auto *LInst = dyn_cast<Instruction>(LV)) {
616 if (const auto *LInst = dyn_cast<Instruction>(LV)) {
617 const auto *RInst = cast<Instruction>(RV);
617 const auto *RInst = cast<Instruction>(RV);
2371 return Instruction::Add;
2373 return Instruction::Mul;
3883 if (auto *I = dyn_cast<Instruction>(V)) {
4184 PushDefUseChildren(Instruction *I,
4185 SmallVectorImpl<Instruction *> &Worklist) {
4188 Worklist.push_back(cast<Instruction>(U));
4191 void ScalarEvolution::forgetSymbolicName(Instruction *PN, const SCEV *SymName) {
4192 SmallVector<Instruction *, 16> Worklist;
4195 SmallPtrSet<Instruction *, 8> Visited;
4198 Instruction *I = Worklist.pop_back_val();
4348 Instruction *I = cast<Instruction>(Expr->getValue());
4348 Instruction *I = cast<Instruction>(Expr->getValue());
4350 case Instruction::Select: {
4447 Instruction::Add, IncRange, OBO::NoSignedWrap);
4457 Instruction::Add, IncRange, OBO::NoUnsignedWrap);
4508 case Instruction::Add:
4509 case Instruction::Sub:
4510 case Instruction::Mul:
4511 case Instruction::UDiv:
4512 case Instruction::URem:
4513 case Instruction::And:
4514 case Instruction::Or:
4515 case Instruction::AShr:
4516 case Instruction::Shl:
4519 case Instruction::Xor:
4524 return BinaryOp(Instruction::Add, Op->getOperand(0), Op->getOperand(1));
4527 case Instruction::LShr:
4540 return BinaryOp(Instruction::UDiv, Op->getOperand(0), X);
4545 case Instruction::ExtractValue: {
4554 Instruction::BinaryOps BinOp = WO->getBinaryOp();
4557 if (BinOp == Instruction::Mul || !isOverflowIntrinsicNoWrap(WO, DT))
4970 if (BO->Opcode != Instruction::Add)
4996 if (auto *BEInst = dyn_cast<Instruction>(BEValueV))
4996 if (auto *BEInst = dyn_cast<Instruction>(BEValueV))
5080 if (BO->Opcode == Instruction::Add && BO->LHS == PN) {
5118 if (auto *BEInst = dyn_cast<Instruction>(BEValueV))
5118 if (auto *BEInst = dyn_cast<Instruction>(BEValueV))
5211 if (isa<Instruction>(V) && DT.dominates(cast<Instruction>(V), BB))
5211 if (isa<Instruction>(V) && DT.dominates(cast<Instruction>(V), BB))
5326 const SCEV *ScalarEvolution::createNodeForSelectOrPHI(Instruction *I,
5526 if (Instruction *I = dyn_cast<Instruction>(V))
5526 if (Instruction *I = dyn_cast<Instruction>(V))
5982 bool ScalarEvolution::isSCEVExprNeverPoison(const Instruction *I) {
6038 bool ScalarEvolution::isAddRecNeverPoison(const Instruction *I, const Loop *L) {
6070 SmallPtrSet<const Instruction *, 16> Pushed;
6071 SmallVector<const Instruction *, 8> PoisonStack;
6081 const Instruction *Poison = PoisonStack.pop_back_val();
6084 if (propagatesFullPoison(cast<Instruction>(PoisonUser))) {
6085 if (Pushed.insert(cast<Instruction>(PoisonUser)).second)
6086 PoisonStack.push_back(cast<Instruction>(PoisonUser));
6117 for (auto &I : *BB) {
6138 if (Instruction *I = dyn_cast<Instruction>(V)) {
6138 if (Instruction *I = dyn_cast<Instruction>(V)) {
6157 case Instruction::Add: {
6183 if (BO->Opcode == Instruction::Sub)
6191 if (BO->Opcode == Instruction::Sub)
6197 if (!NewBO || (NewBO->Opcode != Instruction::Add &&
6198 NewBO->Opcode != Instruction::Sub)) {
6208 case Instruction::Mul: {
6227 if (!NewBO || NewBO->Opcode != Instruction::Mul) {
6236 case Instruction::UDiv:
6238 case Instruction::URem:
6240 case Instruction::Sub: {
6246 case Instruction::And:
6298 case Instruction::Or:
6324 case Instruction::Xor:
6336 if (LBO->getOpcode() == Instruction::And &&
6363 case Instruction::Shl:
6391 case Instruction::AShr: {
6413 if (L && L->getOpcode() == Instruction::Shl) {
6447 case Instruction::Trunc:
6450 case Instruction::ZExt:
6453 case Instruction::SExt:
6462 if (BO->Opcode == Instruction::Sub && BO->IsNSW) {
6471 case Instruction::BitCast:
6482 case Instruction::GetElementPtr:
6485 case Instruction::PHI:
6488 case Instruction::Select:
6493 if (isa<Instruction>(U))
6494 return createNodeForSelectOrPHI(cast<Instruction>(U), U->getOperand(0),
6498 case Instruction::Call:
6499 case Instruction::Invoke:
6637 PushLoopPHIs(const Loop *L, SmallVectorImpl<Instruction *> &Worklist) {
6703 SmallVector<Instruction *, 16> Worklist;
6706 SmallPtrSet<Instruction *, 8> Discovered;
6708 Instruction *I = Worklist.pop_back_val();
6748 if (auto *I = dyn_cast<Instruction>(U)) {
6748 if (auto *I = dyn_cast<Instruction>(U)) {
6799 SmallVector<Instruction *, 32> Worklist;
6800 SmallPtrSet<Instruction *, 16> Visited;
6830 Instruction *I = Worklist.pop_back_val();
6860 Instruction *I = dyn_cast<Instruction>(V);
6860 Instruction *I = dyn_cast<Instruction>(V);
6864 SmallVector<Instruction *, 16> Worklist;
6867 SmallPtrSet<Instruction *, 8> Visited;
7140 Instruction *Term = ExitingBlock->getTerminator();
7228 if (BO->getOpcode() == Instruction::And) {
7276 if (BO->getOpcode() == Instruction::Or) {
7589 OutOpCode = Instruction::LShr;
7591 OutOpCode = Instruction::AShr;
7593 OutOpCode = Instruction::Shl;
7610 Optional<Instruction::BinaryOps> PostShiftOpCode;
7613 Instruction::BinaryOps OpC;
7652 Instruction::BinaryOps OpCode;
7670 case Instruction::AShr: {
7686 case Instruction::LShr:
7687 case Instruction::Shl:
7711 static bool CanConstantFold(const Instruction *I) {
7725 static bool canConstantEvolve(Instruction *I, const Loop *L) {
7743 getConstantEvolvingPHIOperands(Instruction *UseInst, const Loop *L,
7744 DenseMap<Instruction *, PHINode *> &PHIMap,
7755 Instruction *OpInst = dyn_cast<Instruction>(Op);
7755 Instruction *OpInst = dyn_cast<Instruction>(Op);
7786 Instruction *I = dyn_cast<Instruction>(V);
7786 Instruction *I = dyn_cast<Instruction>(V);
7793 DenseMap<Instruction *, PHINode *> PHIMap;
7802 DenseMap<Instruction *, Constant *> &Vals,
7807 Instruction *I = dyn_cast<Instruction>(V);
7807 Instruction *I = dyn_cast<Instruction>(V);
7824 Instruction *Operand = dyn_cast<Instruction>(I->getOperand(i));
7824 Instruction *Operand = dyn_cast<Instruction>(I->getOperand(i));
7887 DenseMap<Instruction *, Constant *> CurrentIterVals;
7917 DenseMap<Instruction *, Constant *> NextIterVals;
7967 DenseMap<Instruction *, Constant *> CurrentIterVals;
7999 DenseMap<Instruction *, Constant *> NextIterVals;
8151 if (Instruction *I = dyn_cast<Instruction>(SU->getValue())) {
8151 if (Instruction *I = dyn_cast<Instruction>(SU->getValue())) {
8885 if (const Instruction *AI = dyn_cast<Instruction>(AU->getValue()))
8885 if (const Instruction *AI = dyn_cast<Instruction>(AU->getValue()))
8886 if (const Instruction *BI = dyn_cast<Instruction>(BU->getValue()))
8886 if (const Instruction *BI = dyn_cast<Instruction>(BU->getValue()))
9684 if (BO->getOpcode() == Instruction::And) {
9688 } else if (BO->getOpcode() == Instruction::Or) {
11134 const SCEV *ScalarEvolution::getElementSize(Instruction *Inst) {
11567 for (Instruction &I : instructions(F))
11733 if (auto *I = dyn_cast<Instruction>(cast<SCEVUnknown>(S)->getValue()))
11733 if (auto *I = dyn_cast<Instruction>(cast<SCEVUnknown>(S)->getValue()))
11820 if (Instruction *I =
11821 dyn_cast<Instruction>(cast<SCEVUnknown>(S)->getValue())) {
12489 for (auto &I : *BB) {
lib/Analysis/ScalarEvolutionExpander.cpp 38 Instruction::CastOps Op,
51 Instruction *Ret = nullptr;
86 static BasicBlock::iterator findInsertPointAfter(Instruction *I,
110 Instruction::CastOps Op = CastInst::getCastOpcode(V, false, Ty, false);
119 if (Op == Instruction::BitCast) {
128 if ((Op == Instruction::PtrToInt || Op == Instruction::IntToPtr) &&
128 if ((Op == Instruction::PtrToInt || Op == Instruction::IntToPtr) &&
131 if ((CI->getOpcode() == Instruction::PtrToInt ||
132 CI->getOpcode() == Instruction::IntToPtr) &&
137 if ((CE->getOpcode() == Instruction::PtrToInt ||
138 CE->getOpcode() == Instruction::IntToPtr) &&
161 Instruction *I = cast<Instruction>(V);
161 Instruction *I = cast<Instruction>(V);
169 Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode,
228 Instruction *BO = cast<Instruction>(Builder.CreateBinOp(Opcode, LHS, RHS));
228 Instruction *BO = cast<Instruction>(Builder.CreateBinOp(Opcode, LHS, RHS));
535 if (IP->getOpcode() == Instruction::GetElementPtr &&
628 if (const Instruction *I = dyn_cast<Instruction>(U->getValue()))
628 if (const Instruction *I = dyn_cast<Instruction>(U->getValue()))
723 if (!isa<Instruction>(U->getValue()))
733 NewOps.push_back(isa<Instruction>(Sum) ? SE.getUnknown(Sum) :
742 Sum = InsertBinop(Instruction::Sub, Sum, W, SCEV::FlagAnyWrap,
751 Sum = InsertBinop(Instruction::Add, Sum, W, S->getNoWrapFlags(),
804 P = InsertBinop(Instruction::Mul, P, P, SCEV::FlagAnyWrap,
807 Result = Result ? InsertBinop(Instruction::Mul, Result, P,
825 Prod = InsertBinop(Instruction::Sub, Constant::getNullValue(Ty), Prod,
842 Prod = InsertBinop(Instruction::Shl, Prod,
846 Prod = InsertBinop(Instruction::Mul, Prod, W, S->getNoWrapFlags(),
862 return InsertBinop(Instruction::LShr, LHS,
868 return InsertBinop(Instruction::UDiv, LHS, RHS, SCEV::FlagAnyWrap,
896 bool SCEVExpander::isNormalAddRecExprPHI(PHINode *PN, Instruction *IncV,
907 if (Instruction *OInst = dyn_cast<Instruction>(OI))
907 if (Instruction *OInst = dyn_cast<Instruction>(OI))
912 IncV = dyn_cast<Instruction>(IncV->getOperand(0));
934 Instruction *SCEVExpander::getIVIncOperand(Instruction *IncV,
934 Instruction *SCEVExpander::getIVIncOperand(Instruction *IncV,
935 Instruction *InsertPos,
944 case Instruction::Add:
945 case Instruction::Sub: {
946 Instruction *OInst = dyn_cast<Instruction>(IncV->getOperand(1));
946 Instruction *OInst = dyn_cast<Instruction>(IncV->getOperand(1));
948 return dyn_cast<Instruction>(IncV->getOperand(0));
951 case Instruction::BitCast:
952 return dyn_cast<Instruction>(IncV->getOperand(0));
953 case Instruction::GetElementPtr:
957 if (Instruction *OInst = dyn_cast<Instruction>(*I)) {
957 if (Instruction *OInst = dyn_cast<Instruction>(*I)) {
977 return dyn_cast<Instruction>(IncV->getOperand(0));
988 void SCEVExpander::fixupInsertPoints(Instruction *I) {
1001 bool SCEVExpander::hoistIVInc(Instruction *IncV, Instruction *InsertPos) {
1001 bool SCEVExpander::hoistIVInc(Instruction *IncV, Instruction *InsertPos) {
1015 SmallVector<Instruction*, 4> IVIncs;
1017 Instruction *Oper = getIVIncOperand(IncV, InsertPos, /*allowScale*/true);
1038 bool SCEVExpander::isExpandedAddRecExprPHI(PHINode *PN, Instruction *IncV,
1040 for(Instruction *IVOper = IncV;
1080 void SCEVExpander::hoistBeforePos(DominatorTree *DT, Instruction *InstToHoist,
1081 Instruction *Pos, PHINode *LoopPhi) {
1090 InstToHoist = cast<Instruction>(InstToHoist->getOperand(0));
1171 Instruction *IncV = nullptr;
1197 Instruction *TempIncV =
1198 dyn_cast<Instruction>(PN.getIncomingValueForBlock(LatchBlock));
1313 Instruction *InsertPos = L == IVIncInsertLoop ?
1410 if (isa<Instruction>(Result) &&
1411 !SE.DT.dominates(cast<Instruction>(Result),
1519 findInsertPointAfter(cast<Instruction>(V), Builder.GetInsertBlock());
1583 Instruction *Add = BinaryOperator::CreateAdd(CanonicalIV, One,
1762 Instruction *IP) {
1780 const Instruction *InsertPt) {
1793 Instruction *EntInst = nullptr;
1794 if (V && isa<Instruction>(V) && (EntInst = cast<Instruction>(V)) &&
1794 if (V && isa<Instruction>(V) && (EntInst = cast<Instruction>(V)) &&
1816 Instruction *InsertPt = &*Builder.GetInsertPoint();
2018 Instruction *OrigInc = dyn_cast<Instruction>(
2018 Instruction *OrigInc = dyn_cast<Instruction>(
2020 Instruction *IsomorphicInc =
2021 dyn_cast<Instruction>(Phi->getIncomingValueForBlock(LatchBlock));
2053 Instruction *IP = nullptr;
2085 const Instruction *At, Loop *L) {
2094 SCEVExpander::getRelatedExistingExpansion(const SCEV *S, const Instruction *At,
2104 Instruction *LHS, *RHS;
2132 const SCEV *S, Loop *L, const Instruction *At,
2213 Instruction *IP) {
2229 Instruction *IP) {
2239 Instruction *Loc, bool Signed) {
2336 Instruction *IP) {
2361 Instruction *IP) {
2430 bool isSafeToExpandAt(const SCEV *S, const Instruction *InsertionPoint,
lib/Analysis/StackSafetyAnalysis.cpp 290 auto I = cast<const Instruction>(UI.getUser());
294 case Instruction::Load: {
300 case Instruction::VAArg:
303 case Instruction::Store: {
314 case Instruction::Ret:
321 case Instruction::Call:
322 case Instruction::Invoke: {
358 WorkList.push_back(cast<const Instruction>(I));
lib/Analysis/SyncDependenceAnalysis.cpp 358 SyncDependenceAnalysis::join_blocks(const Instruction &Term) {
lib/Analysis/TargetTransformInfo.cpp 111 Instruction *TI = BB->getTerminator();
183 int TargetTransformInfo::getExtCost(const Instruction *I,
263 Instruction *I) const {
330 bool TargetTransformInfo::hasVolatileVariant(Instruction *I,
358 bool TargetTransformInfo::isProfitableToHoist(Instruction *I) const {
500 const Instruction &I, bool &AllowPromotionWithoutCommonHeader) const {
603 Type *Src, const Instruction *I) const {
626 Type *CondTy, const Instruction *I) const {
644 const Instruction *I) const {
717 int TargetTransformInfo::getMemcpyCost(const Instruction *I) const {
845 int TargetTransformInfo::getInstructionLatency(const Instruction *I) const {
894 static Optional<ReductionData> getReductionData(Instruction *I) {
917 static ReductionKind matchPairwiseReductionAtLevel(Instruction *I,
976 getReductionData(cast<Instruction>(NextLevelOp));
996 return matchPairwiseReductionAtLevel(cast<Instruction>(NextLevelOp), Level,
1013 auto *RdxStart = dyn_cast<Instruction>(ReduxRoot->getOperand(0));
1013 auto *RdxStart = dyn_cast<Instruction>(ReduxRoot->getOperand(0));
1078 auto *RdxStart = dyn_cast<Instruction>(ReduxRoot->getOperand(0));
1078 auto *RdxStart = dyn_cast<Instruction>(ReduxRoot->getOperand(0));
1102 Instruction *RdxOp = RdxStart;
1134 RdxOp = dyn_cast<Instruction>(NextRdxOp);
1144 int TargetTransformInfo::getInstructionThroughput(const Instruction *I) const {
1146 case Instruction::GetElementPtr:
1149 case Instruction::Ret:
1150 case Instruction::PHI:
1151 case Instruction::Br: {
1154 case Instruction::Add:
1155 case Instruction::FAdd:
1156 case Instruction::Sub:
1157 case Instruction::FSub:
1158 case Instruction::Mul:
1159 case Instruction::FMul:
1160 case Instruction::UDiv:
1161 case Instruction::SDiv:
1162 case Instruction::FDiv:
1163 case Instruction::URem:
1164 case Instruction::SRem:
1165 case Instruction::FRem:
1166 case Instruction::Shl:
1167 case Instruction::LShr:
1168 case Instruction::AShr:
1169 case Instruction::And:
1170 case Instruction::Or:
1171 case Instruction::Xor: {
1180 case Instruction::FNeg: {
1190 case Instruction::Select: {
1195 case Instruction::ICmp:
1196 case Instruction::FCmp: {
1200 case Instruction::Store: {
1207 case Instruction::Load: {
1213 case Instruction::ZExt:
1214 case Instruction::SExt:
1215 case Instruction::FPToUI:
1216 case Instruction::FPToSI:
1217 case Instruction::FPExt:
1218 case Instruction::PtrToInt:
1219 case Instruction::IntToPtr:
1220 case Instruction::SIToFP:
1221 case Instruction::UIToFP:
1222 case Instruction::Trunc:
1223 case Instruction::FPTrunc:
1224 case Instruction::BitCast:
1225 case Instruction::AddrSpaceCast: {
1229 case Instruction::ExtractElement: {
1276 case Instruction::InsertElement: {
1285 case Instruction::ExtractValue:
1287 case Instruction::ShuffleVector: {
1320 case Instruction::Call:
lib/Analysis/TypeMetadataUtils.cpp 28 Instruction *User = cast<Instruction>(U.getUser());
28 Instruction *User = cast<Instruction>(U.getUser());
99 SmallVectorImpl<Instruction *> &LoadedPtrs,
100 SmallVectorImpl<Instruction *> &Preds, bool &HasNonCallUses,
lib/Analysis/ValueTracking.cpp 103 const Instruction *CxtI;
125 Query(const DataLayout &DL, AssumptionCache *AC, const Instruction *CxtI,
150 static const Instruction *safeCxtI(const Value *V, const Instruction *CxtI) {
150 static const Instruction *safeCxtI(const Value *V, const Instruction *CxtI) {
157 CxtI = dyn_cast<Instruction>(V);
169 AssumptionCache *AC, const Instruction *CxtI,
181 const Instruction *CxtI,
191 const Instruction *CxtI, const DominatorTree *DT,
213 bool llvm::isOnlyUsedInZeroEqualityComparison(const Instruction *CxtI) {
230 AssumptionCache *AC, const Instruction *CxtI,
239 AssumptionCache *AC, const Instruction *CxtI,
247 const Instruction *CxtI, const DominatorTree *DT,
255 AssumptionCache *AC, const Instruction *CxtI,
267 AssumptionCache *AC, const Instruction *CxtI,
278 const Instruction *CxtI, const DominatorTree *DT,
290 AssumptionCache *AC, const Instruction *CxtI,
301 const Instruction *CxtI,
464 static bool isEphemeralValueOf(const Instruction *I, const Value *E) {
501 bool llvm::isAssumeLikeIntrinsic(const Instruction *I) {
525 bool llvm::isValidAssumeForContext(const Instruction *Inv,
526 const Instruction *CxtI,
873 auto *CxtI = const_cast<Instruction *>(Q.CxtI);
985 case Instruction::Load:
990 case Instruction::And: {
1015 case Instruction::Or:
1024 case Instruction::Xor: {
1035 case Instruction::Mul: {
1041 case Instruction::UDiv: {
1057 case Instruction::Select: {
1105 Q.IIQ.hasNoSignedWrap(cast<Instruction>(RHS)))
1118 case Instruction::FPTrunc:
1119 case Instruction::FPExt:
1120 case Instruction::FPToUI:
1121 case Instruction::FPToSI:
1122 case Instruction::SIToFP:
1123 case Instruction::UIToFP:
1125 case Instruction::PtrToInt:
1126 case Instruction::IntToPtr:
1129 case Instruction::ZExt:
1130 case Instruction::Trunc: {
1147 case Instruction::BitCast: {
1158 case Instruction::SExt: {
1169 case Instruction::Shl: {
1192 case Instruction::LShr: {
1208 case Instruction::AShr: {
1221 case Instruction::Sub: {
1227 case Instruction::Add: {
1233 case Instruction::SRem:
1267 case Instruction::URem: {
1291 case Instruction::Alloca: {
1301 case Instruction::GetElementPtr: {
1347 case Instruction::PHI: {
1363 if (Opcode == Instruction::Add ||
1364 Opcode == Instruction::Sub ||
1365 Opcode == Instruction::And ||
1366 Opcode == Instruction::Or ||
1367 Opcode == Instruction::Mul) {
1399 if (Opcode == Instruction::Add) {
1408 else if (Opcode == Instruction::Sub && LL == I) {
1416 else if (Opcode == Instruction::Mul && Known2.isNonNegative() &&
1457 case Instruction::Call:
1458 case Instruction::Invoke:
1463 Q.IIQ.getMetadata(cast<Instruction>(I), LLVMContext::MD_range))
1574 case Instruction::ExtractElement:
1581 case Instruction::ExtractValue:
1844 if (const Instruction *I = dyn_cast<Instruction>(GEP))
1844 if (const Instruction *I = dyn_cast<Instruction>(GEP))
1903 const Instruction *CtxI,
1950 if (BO->getOpcode() == Instruction::And) {
1966 DT->dominates(cast<Instruction>(Curr), CtxI)) {
2010 if (CE->getOpcode() == Instruction::IntToPtr ||
2011 CE->getOpcode() == Instruction::PtrToInt)
2041 if (auto *I = dyn_cast<Instruction>(V)) {
2123 return isKnownNonZero(cast<Instruction>(V)->getOperand(0), Depth, Q);
2251 if (!BO || BO->getOpcode() != Instruction::Add)
2398 case Instruction::SExt:
2402 case Instruction::SDiv: {
2420 case Instruction::SRem: {
2454 case Instruction::AShr: {
2467 case Instruction::Shl: {
2479 case Instruction::And:
2480 case Instruction::Or:
2481 case Instruction::Xor: // NOT is handled here.
2493 case Instruction::Select: {
2507 case Instruction::Add:
2534 case Instruction::Sub:
2563 case Instruction::Mul: {
2575 case Instruction::PHI: {
2594 case Instruction::Trunc:
2599 case Instruction::ExtractElement:
2606 case Instruction::ShuffleVector: {
2705 case Instruction::SExt:
2709 case Instruction::ZExt:
2712 case Instruction::Shl:
2713 case Instruction::Mul: {
2717 if (I->getOpcode() == Instruction::Shl) {
2985 case Instruction::UIToFP:
2987 case Instruction::FMul:
2994 case Instruction::FAdd:
2995 case Instruction::FDiv:
2996 case Instruction::FRem:
3001 case Instruction::Select:
3006 case Instruction::FPExt:
3007 case Instruction::FPTrunc:
3011 case Instruction::ExtractElement:
3017 case Instruction::Call:
3114 if (auto *Inst = dyn_cast<Instruction>(V)) {
3116 case Instruction::FAdd:
3117 case Instruction::FMul:
3118 case Instruction::FSub:
3119 case Instruction::FDiv:
3120 case Instruction::FRem: {
3124 case Instruction::Select: {
3128 case Instruction::SIToFP:
3129 case Instruction::UIToFP:
3131 case Instruction::FPTrunc:
3132 case Instruction::FPExt:
3244 if (CE->getOpcode() == Instruction::IntToPtr) {
3295 Instruction *InsertBefore) {
3352 Instruction *InsertBefore) {
3370 Instruction *InsertBefore) {
3697 auto *PrevValue = dyn_cast<Instruction>(PN->getIncomingValue(0));
3697 auto *PrevValue = dyn_cast<Instruction>(PN->getIncomingValue(0));
3699 PrevValue = dyn_cast<Instruction>(PN->getIncomingValue(1));
3721 } else if (Operator::getOpcode(V) == Instruction::BitCast ||
3722 Operator::getOpcode(V) == Instruction::AddrSpaceCast) {
3749 if (Instruction *I = dyn_cast<Instruction>(V))
3749 if (Instruction *I = dyn_cast<Instruction>(V))
3812 if (U->getOpcode() == Instruction::PtrToInt)
3820 if (U->getOpcode() != Instruction::Add ||
3822 Operator::getOpcode(U->getOperand(1)) != Instruction::Mul &&
3850 if (Operator::getOpcode(V) == Instruction::IntToPtr) {
3895 const Instruction *CtxI,
3909 case Instruction::UDiv:
3910 case Instruction::URem: {
3917 case Instruction::SDiv:
3918 case Instruction::SRem: {
3936 case Instruction::Load: {
3945 case Instruction::Call: {
3953 case Instruction::VAArg:
3954 case Instruction::Alloca:
3955 case Instruction::Invoke:
3956 case Instruction::CallBr:
3957 case Instruction::PHI:
3958 case Instruction::Store:
3959 case Instruction::Ret:
3960 case Instruction::Br:
3961 case Instruction::IndirectBr:
3962 case Instruction::Switch:
3963 case Instruction::Unreachable:
3964 case Instruction::Fence:
3965 case Instruction::AtomicRMW:
3966 case Instruction::AtomicCmpXchg:
3967 case Instruction::LandingPad:
3968 case Instruction::Resume:
3969 case Instruction::CatchSwitch:
3970 case Instruction::CatchPad:
3971 case Instruction::CatchRet:
3972 case Instruction::CleanupPad:
3973 case Instruction::CleanupRet:
3978 bool llvm::mayBeMemoryDependent(const Instruction &I) {
4000 AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT,
4013 AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT,
4027 const Instruction *CxtI,
4069 AssumptionCache *AC, const Instruction *CxtI, const DominatorTree *DT,
4085 const Instruction *CxtI,
4147 const Instruction *CxtI,
4160 const Instruction *CxtI,
4229 const Instruction *CxtI,
4239 const Instruction *CxtI,
4244 bool llvm::isGuaranteedToTransferExecutionToSuccessor(const Instruction *I) {
4304 bool llvm::isGuaranteedToExecuteForEveryIteration(const Instruction *I,
4312 for (const Instruction &LI : *L->getHeader()) {
4319 bool llvm::propagatesFullPoison(const Instruction *I) {
4323 case Instruction::Add:
4324 case Instruction::Sub:
4325 case Instruction::Xor:
4326 case Instruction::Trunc:
4327 case Instruction::BitCast:
4328 case Instruction::AddrSpaceCast:
4329 case Instruction::Mul:
4330 case Instruction::Shl:
4331 case Instruction::GetElementPtr:
4337 case Instruction::AShr:
4338 case Instruction::SExt:
4343 case Instruction::ICmp:
4353 const Value *llvm::getGuaranteedNonFullPoisonOp(const Instruction *I) {
4355 case Instruction::Store:
4358 case Instruction::Load:
4361 case Instruction::AtomicCmpXchg:
4364 case Instruction::AtomicRMW:
4367 case Instruction::UDiv:
4368 case Instruction::SDiv:
4369 case Instruction::URem:
4370 case Instruction::SRem:
4382 bool llvm::mustTriggerUB(const Instruction *I,
4389 bool llvm::programUndefinedIfFullPoison(const Instruction *PoisonI) {
4421 const Instruction *UserI = cast<Instruction>(User);
4421 const Instruction *UserI = cast<Instruction>(User);
4959 Instruction::CastOps *CastOp) {
4979 case Instruction::ZExt:
4983 case Instruction::SExt:
4987 case Instruction::Trunc:
5017 case Instruction::FPTrunc:
5020 case Instruction::FPExt:
5023 case Instruction::FPToUI:
5026 case Instruction::FPToSI:
5029 case Instruction::UIToFP:
5032 case Instruction::SIToFP:
5052 Instruction::CastOps *CastOp,
5072 Instruction::CastOps *CastOp, unsigned Depth) {
5089 if (*CastOp == Instruction::FPToSI || *CastOp == Instruction::FPToUI)
5089 if (*CastOp == Instruction::FPToSI || *CastOp == Instruction::FPToUI)
5098 if (*CastOp == Instruction::FPToSI || *CastOp == Instruction::FPToUI)
5098 if (*CastOp == Instruction::FPToSI || *CastOp == Instruction::FPToUI)
5379 if ((LHSBO->getOpcode() == Instruction::And ||
5380 LHSBO->getOpcode() == Instruction::Or))
5387 const Instruction *ContextI,
5423 case Instruction::Add:
5443 case Instruction::And:
5449 case Instruction::Or:
5455 case Instruction::AShr:
5476 case Instruction::LShr:
5490 case Instruction::Shl:
5512 case Instruction::SDiv:
5544 case Instruction::UDiv:
5554 case Instruction::SRem:
5562 case Instruction::URem:
5649 IIQ.hasNoSignedWrap(cast<Instruction>(RHS)))
5707 if (auto *I = dyn_cast<Instruction>(V))
lib/Analysis/VectorUtils.cpp 367 MapVector<Instruction *, uint64_t>
379 SmallPtrSet<Instruction *, 4> InstructionSet;
380 MapVector<Instruction *, uint64_t> MinBWs;
385 for (auto &I : *BB) {
419 if (!isa<Instruction>(Val))
421 Instruction *I = cast<Instruction>(Val);
421 Instruction *I = cast<Instruction>(Val);
496 if (!isa<Instruction>(*MI))
500 Ty = cast<Instruction>(*MI)->getOperand(0)->getType();
502 MinBWs[cast<Instruction>(*MI)] = MinBW;
547 MDNode *llvm::intersectAccessGroups(const Instruction *Inst1,
548 const Instruction *Inst2) {
594 Instruction *llvm::propagateMetadata(Instruction *Inst, ArrayRef<Value *> VL) {
594 Instruction *llvm::propagateMetadata(Instruction *Inst, ArrayRef<Value *> VL) {
595 Instruction *I0 = cast<Instruction>(VL[0]);
595 Instruction *I0 = cast<Instruction>(VL[0]);
606 const Instruction *IJ = cast<Instruction>(VL[J]);
606 const Instruction *IJ = cast<Instruction>(VL[J]);
639 const InterleaveGroup<Instruction> &Group) {
804 MapVector<Instruction *, StrideDescriptor> &AccessStrideInfo,
817 for (auto &I : *BB) {
889 MapVector<Instruction *, StrideDescriptor> AccessStrideInfo;
899 SmallSetVector<InterleaveGroup<Instruction> *, 4> StoreGroups;
901 SmallSetVector<InterleaveGroup<Instruction> *, 4> LoadGroups;
917 Instruction *B = BI->first;
923 InterleaveGroup<Instruction> *Group = nullptr;
939 Instruction *A = AI->first;
968 InterleaveGroup<Instruction> *StoreGroup = getInterleaveGroup(A);
1093 Instruction *LastMember = Group->getMember(Group->getFactor() - 1);
1130 SmallPtrSet<InterleaveGroup<Instruction> *, 4> DelSet;
1132 InterleaveGroup<Instruction> *Group = I.second;
1155 void InterleaveGroup<Instruction>::addMetadata(Instruction *NewInst) const {
lib/AsmParser/LLParser.cpp 226 for (auto *Inst : InstsWithTBAATag) {
2032 bool LLParser::ParseInstructionMetadata(Instruction &Inst) {
2947 LocTy NameLoc, Instruction *Inst) {
3400 if (Opc == Instruction::FCmp) {
3427 case Instruction::FNeg:
3461 if (Opc == Instruction::Add || Opc == Instruction::Sub ||
3461 if (Opc == Instruction::Add || Opc == Instruction::Sub ||
3462 Opc == Instruction::Mul || Opc == Instruction::Shl) {
3462 Opc == Instruction::Mul || Opc == Instruction::Shl) {
3470 } else if (Opc == Instruction::SDiv || Opc == Instruction::UDiv ||
3470 } else if (Opc == Instruction::SDiv || Opc == Instruction::UDiv ||
3471 Opc == Instruction::LShr || Opc == Instruction::AShr) {
3471 Opc == Instruction::LShr || Opc == Instruction::AShr) {
3485 case Instruction::Add:
3486 case Instruction::Sub:
3487 case Instruction::Mul:
3488 case Instruction::UDiv:
3489 case Instruction::SDiv:
3490 case Instruction::URem:
3491 case Instruction::SRem:
3492 case Instruction::Shl:
3493 case Instruction::AShr:
3494 case Instruction::LShr:
3498 case Instruction::FAdd:
3499 case Instruction::FSub:
3500 case Instruction::FMul:
3501 case Instruction::FDiv:
3502 case Instruction::FRem:
3552 if (Opc == Instruction::GetElementPtr)
3559 if (Opc == Instruction::GetElementPtr) {
3567 Elts, Opc == Instruction::GetElementPtr ? &InRangeOp : nullptr) ||
3571 if (Opc == Instruction::GetElementPtr) {
3619 } else if (Opc == Instruction::Select) {
3626 } else if (Opc == Instruction::ShuffleVector) {
3633 } else if (Opc == Instruction::ExtractElement) {
5634 Instruction *Inst;
5689 int LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
5847 if (Opc == Instruction::FCmp) {
5893 bool LLParser::ParseRet(Instruction *&Inst, BasicBlock *BB,
5924 bool LLParser::ParseBr(Instruction *&Inst, PerFunctionState &PFS) {
5953 bool LLParser::ParseSwitch(Instruction *&Inst, PerFunctionState &PFS) {
5998 bool LLParser::ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS) {
6038 bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
6134 bool LLParser::ParseResume(Instruction *&Inst, PerFunctionState &PFS) {
6178 bool LLParser::ParseCleanupRet(Instruction *&Inst, PerFunctionState &PFS) {
6207 bool LLParser::ParseCatchRet(Instruction *&Inst, PerFunctionState &PFS) {
6227 bool LLParser::ParseCatchSwitch(Instruction *&Inst, PerFunctionState &PFS) {
6277 bool LLParser::ParseCatchPad(Instruction *&Inst, PerFunctionState &PFS) {
6299 bool LLParser::ParseCleanupPad(Instruction *&Inst, PerFunctionState &PFS) {
6329 bool LLParser::ParseUnaryOp(Instruction *&Inst, PerFunctionState &PFS,
6349 bool LLParser::ParseCallBr(Instruction *&Inst, PerFunctionState &PFS) {
6472 bool LLParser::ParseArithmetic(Instruction *&Inst, PerFunctionState &PFS,
6492 bool LLParser::ParseLogical(Instruction *&Inst, PerFunctionState &PFS,
6510 bool LLParser::ParseCompare(Instruction *&Inst, PerFunctionState &PFS,
6522 if (Opc == Instruction::FCmp) {
6543 bool LLParser::ParseCast(Instruction *&Inst, PerFunctionState &PFS,
6565 bool LLParser::ParseSelect(Instruction *&Inst, PerFunctionState &PFS) {
6584 bool LLParser::ParseVA_Arg(Instruction *&Inst, PerFunctionState &PFS) {
6602 bool LLParser::ParseExtractElement(Instruction *&Inst, PerFunctionState &PFS) {
6619 bool LLParser::ParseInsertElement(Instruction *&Inst, PerFunctionState &PFS) {
6638 bool LLParser::ParseShuffleVector(Instruction *&Inst, PerFunctionState &PFS) {
6657 int LLParser::ParsePHI(Instruction *&Inst, PerFunctionState &PFS) {
6707 bool LLParser::ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS) {
6759 bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
6871 int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
6933 int LLParser::ParseLoad(Instruction *&Inst, PerFunctionState &PFS) {
6982 int LLParser::ParseStore(Instruction *&Inst, PerFunctionState &PFS) {
7027 int LLParser::ParseCmpXchg(Instruction *&Inst, PerFunctionState &PFS) {
7080 int LLParser::ParseAtomicRMW(Instruction *&Inst, PerFunctionState &PFS) {
7164 int LLParser::ParseFence(Instruction *&Inst, PerFunctionState &PFS) {
7181 int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
7244 int LLParser::ParseExtractValue(Instruction *&Inst, PerFunctionState &PFS) {
7263 int LLParser::ParseInsertValue(Instruction *&Inst, PerFunctionState &PFS) {
lib/AsmParser/LLParser.h 114 SmallVector<Instruction*, 64> InstsWithTBAATag;
440 Instruction *Inst);
525 bool ParseInstructionMetadata(Instruction &Inst);
561 int ParseInstruction(Instruction *&Inst, BasicBlock *BB,
565 bool ParseRet(Instruction *&Inst, BasicBlock *BB, PerFunctionState &PFS);
566 bool ParseBr(Instruction *&Inst, PerFunctionState &PFS);
567 bool ParseSwitch(Instruction *&Inst, PerFunctionState &PFS);
568 bool ParseIndirectBr(Instruction *&Inst, PerFunctionState &PFS);
569 bool ParseInvoke(Instruction *&Inst, PerFunctionState &PFS);
570 bool ParseResume(Instruction *&Inst, PerFunctionState &PFS);
571 bool ParseCleanupRet(Instruction *&Inst, PerFunctionState &PFS);
572 bool ParseCatchRet(Instruction *&Inst, PerFunctionState &PFS);
573 bool ParseCatchSwitch(Instruction *&Inst, PerFunctionState &PFS);
574 bool ParseCatchPad(Instruction *&Inst, PerFunctionState &PFS);
575 bool ParseCleanupPad(Instruction *&Inst, PerFunctionState &PFS);
576 bool ParseCallBr(Instruction *&Inst, PerFunctionState &PFS);
578 bool ParseUnaryOp(Instruction *&Inst, PerFunctionState &PFS, unsigned Opc,
580 bool ParseArithmetic(Instruction *&Inst, PerFunctionState &PFS, unsigned Opc,
582 bool ParseLogical(Instruction *&Inst, PerFunctionState &PFS, unsigned Opc);
583 bool ParseCompare(Instruction *&Inst, PerFunctionState &PFS, unsigned Opc);
584 bool ParseCast(Instruction *&Inst, PerFunctionState &PFS, unsigned Opc);
585 bool ParseSelect(Instruction *&Inst, PerFunctionState &PFS);
586 bool ParseVA_Arg(Instruction *&Inst, PerFunctionState &PFS);
587 bool ParseExtractElement(Instruction *&Inst, PerFunctionState &PFS);
588 bool ParseInsertElement(Instruction *&Inst, PerFunctionState &PFS);
589 bool ParseShuffleVector(Instruction *&Inst, PerFunctionState &PFS);
590 int ParsePHI(Instruction *&Inst, PerFunctionState &PFS);
591 bool ParseLandingPad(Instruction *&Inst, PerFunctionState &PFS);
592 bool ParseCall(Instruction *&Inst, PerFunctionState &PFS,
594 int ParseAlloc(Instruction *&Inst, PerFunctionState &PFS);
595 int ParseLoad(Instruction *&Inst, PerFunctionState &PFS);
596 int ParseStore(Instruction *&Inst, PerFunctionState &PFS);
597 int ParseCmpXchg(Instruction *&Inst, PerFunctionState &PFS);
598 int ParseAtomicRMW(Instruction *&Inst, PerFunctionState &PFS);
599 int ParseFence(Instruction *&Inst, PerFunctionState &PFS);
600 int ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS);
601 int ParseExtractValue(Instruction *&Inst, PerFunctionState &PFS);
602 int ParseInsertValue(Instruction *&Inst, PerFunctionState &PFS);
lib/Bitcode/Reader/BitcodeReader.cpp 166 for (auto &I : instructions(F))
501 SmallVector<Instruction *, 64> InstructionList;
1041 case bitc::CAST_TRUNC : return Instruction::Trunc;
1042 case bitc::CAST_ZEXT : return Instruction::ZExt;
1043 case bitc::CAST_SEXT : return Instruction::SExt;
1044 case bitc::CAST_FPTOUI : return Instruction::FPToUI;
1045 case bitc::CAST_FPTOSI : return Instruction::FPToSI;
1046 case bitc::CAST_UITOFP : return Instruction::UIToFP;
1047 case bitc::CAST_SITOFP : return Instruction::SIToFP;
1048 case bitc::CAST_FPTRUNC : return Instruction::FPTrunc;
1049 case bitc::CAST_FPEXT : return Instruction::FPExt;
1050 case bitc::CAST_PTRTOINT: return Instruction::PtrToInt;
1051 case bitc::CAST_INTTOPTR: return Instruction::IntToPtr;
1052 case bitc::CAST_BITCAST : return Instruction::BitCast;
1053 case bitc::CAST_ADDRSPACECAST: return Instruction::AddrSpaceCast;
1067 return IsFP ? Instruction::FNeg : -1;
1081 return IsFP ? Instruction::FAdd : Instruction::Add;
1081 return IsFP ? Instruction::FAdd : Instruction::Add;
1083 return IsFP ? Instruction::FSub : Instruction::Sub;
1083 return IsFP ? Instruction::FSub : Instruction::Sub;
1085 return IsFP ? Instruction::FMul : Instruction::Mul;
1085 return IsFP ? Instruction::FMul : Instruction::Mul;
1087 return IsFP ? -1 : Instruction::UDiv;
1089 return IsFP ? Instruction::FDiv : Instruction::SDiv;
1089 return IsFP ? Instruction::FDiv : Instruction::SDiv;
1091 return IsFP ? -1 : Instruction::URem;
1093 return IsFP ? Instruction::FRem : Instruction::SRem;
1093 return IsFP ? Instruction::FRem : Instruction::SRem;
1095 return IsFP ? -1 : Instruction::Shl;
1097 return IsFP ? -1 : Instruction::LShr;
1099 return IsFP ? -1 : Instruction::AShr;
1101 return IsFP ? -1 : Instruction::And;
1103 return IsFP ? -1 : Instruction::Or;
1105 return IsFP ? -1 : Instruction::Xor;
2542 if (Opc == Instruction::Add ||
2543 Opc == Instruction::Sub ||
2544 Opc == Instruction::Mul ||
2545 Opc == Instruction::Shl) {
2550 } else if (Opc == Instruction::SDiv ||
2551 Opc == Instruction::UDiv ||
2552 Opc == Instruction::LShr ||
2553 Opc == Instruction::AShr) {
3784 Instruction *I = nullptr;
3900 if (Opc == Instruction::Add ||
3901 Opc == Instruction::Sub ||
3902 Opc == Instruction::Mul ||
3903 Opc == Instruction::Shl) {
3908 } else if (Opc == Instruction::SDiv ||
3909 Opc == Instruction::UDiv ||
3910 Opc == Instruction::LShr ||
3911 Opc == Instruction::AShr) {
3935 Instruction *Temp = nullptr;
5273 for (auto &I : instructions(F)) {
lib/Bitcode/Reader/MetadataLoader.cpp 534 for (auto &I : BB)
671 Function &F, const SmallVectorImpl<Instruction *> &InstructionList);
1978 Function &F, const SmallVectorImpl<Instruction *> &InstructionList) {
2024 Instruction *Inst = InstructionList[Record[0]];
2156 Function &F, const SmallVectorImpl<Instruction *> &InstructionList) {
lib/Bitcode/Reader/MetadataLoader.h 72 Function &F, const SmallVectorImpl<Instruction *> &InstructionList);
lib/Bitcode/Reader/ValueList.cpp 39 : ConstantExpr(Ty, Instruction::UserOp1, &Op<0>(), 1) {
51 cast<ConstantExpr>(V)->getOpcode() == Instruction::UserOp1;
lib/Bitcode/Writer/BitcodeWriter.cpp 381 void writeInstruction(const Instruction &I, unsigned InstID,
504 case Instruction::Trunc : return bitc::CAST_TRUNC;
505 case Instruction::ZExt : return bitc::CAST_ZEXT;
506 case Instruction::SExt : return bitc::CAST_SEXT;
507 case Instruction::FPToUI : return bitc::CAST_FPTOUI;
508 case Instruction::FPToSI : return bitc::CAST_FPTOSI;
509 case Instruction::UIToFP : return bitc::CAST_UITOFP;
510 case Instruction::SIToFP : return bitc::CAST_SITOFP;
511 case Instruction::FPTrunc : return bitc::CAST_FPTRUNC;
512 case Instruction::FPExt : return bitc::CAST_FPEXT;
513 case Instruction::PtrToInt: return bitc::CAST_PTRTOINT;
514 case Instruction::IntToPtr: return bitc::CAST_INTTOPTR;
515 case Instruction::BitCast : return bitc::CAST_BITCAST;
516 case Instruction::AddrSpaceCast: return bitc::CAST_ADDRSPACECAST;
523 case Instruction::FNeg: return bitc::UNOP_FNEG;
530 case Instruction::Add:
531 case Instruction::FAdd: return bitc::BINOP_ADD;
532 case Instruction::Sub:
533 case Instruction::FSub: return bitc::BINOP_SUB;
534 case Instruction::Mul:
535 case Instruction::FMul: return bitc::BINOP_MUL;
536 case Instruction::UDiv: return bitc::BINOP_UDIV;
537 case Instruction::FDiv:
538 case Instruction::SDiv: return bitc::BINOP_SDIV;
539 case Instruction::URem: return bitc::BINOP_UREM;
540 case Instruction::FRem:
541 case Instruction::SRem: return bitc::BINOP_SREM;
542 case Instruction::Shl: return bitc::BINOP_SHL;
543 case Instruction::LShr: return bitc::BINOP_LSHR;
544 case Instruction::AShr: return bitc::BINOP_ASHR;
545 case Instruction::And: return bitc::BINOP_AND;
546 case Instruction::Or: return bitc::BINOP_OR;
547 case Instruction::Xor: return bitc::BINOP_XOR;
2170 for (const Instruction &I : BB) {
2430 if (Instruction::isCast(CE->getOpcode())) {
2447 case Instruction::FNeg: {
2457 case Instruction::GetElementPtr: {
2472 case Instruction::Select:
2478 case Instruction::ExtractElement:
2485 case Instruction::InsertElement:
2492 case Instruction::ShuffleVector:
2507 case Instruction::ICmp:
2508 case Instruction::FCmp:
2600 void ModuleBitcodeWriter::writeInstruction(const Instruction &I,
2608 if (Instruction::isCast(I.getOpcode())) {
2629 case Instruction::FNeg: {
2642 case Instruction::GetElementPtr: {
2652 case Instruction::ExtractValue: {
2659 case Instruction::InsertValue: {
2667 case Instruction::Select: {
2677 case Instruction::ExtractElement:
2682 case Instruction::InsertElement:
2688 case Instruction::ShuffleVector:
2694 case Instruction::ICmp:
2695 case Instruction::FCmp: {
2707 case Instruction::Ret:
2722 case Instruction::Br:
2733 case Instruction::Switch:
2746 case Instruction::IndirectBr:
2755 case Instruction::Invoke: {
2784 case Instruction::Resume:
2788 case Instruction::CleanupRet: {
2796 case Instruction::CatchRet: {
2803 case Instruction::CleanupPad:
2804 case Instruction::CatchPad: {
2816 case Instruction::CatchSwitch: {
2831 case Instruction::CallBr: {
2866 case Instruction::Unreachable:
2871 case Instruction::PHI: {
2894 case Instruction::LandingPad: {
2910 case Instruction::Alloca: {
2927 case Instruction::Load:
2944 case Instruction::Store:
2959 case Instruction::AtomicCmpXchg:
2973 case Instruction::AtomicRMW:
2984 case Instruction::Fence:
2989 case Instruction::Call: {
3030 case Instruction::VAArg:
lib/Bitcode/Writer/ValueEnumerator.cpp 158 for (const Instruction &I : BB)
164 for (const Instruction &I : BB)
282 for (const Instruction &I : BB)
287 for (const Instruction &I : BB)
402 for (const Instruction &I : BB) {
441 unsigned ValueEnumerator::getInstructionID(const Instruction *Inst) const {
453 void ValueEnumerator::setInstructionID(const Instruction *I) {
961 for (const Instruction &I : BB)
982 for (const Instruction &I : BB) {
lib/Bitcode/Writer/ValueEnumerator.h 121 using InstructionMapType = DenseMap<const Instruction *, unsigned>;
173 unsigned getInstructionID(const Instruction *I) const;
174 void setInstructionID(const Instruction *I);
lib/CodeGen/Analysis.cpp 281 const Instruction *I = dyn_cast<Instruction>(V);
281 const Instruction *I = dyn_cast<Instruction>(V);
513 const Instruction *I = CS.getInstruction();
515 const Instruction *Term = ExitBB->getTerminator();
557 bool llvm::attributesPermitTailCall(const Function *F, const Instruction *I,
615 const Instruction *I,
lib/CodeGen/AsmPrinter/AsmPrinter.cpp 1318 if (CE->getOpcode() == Instruction::BitCast)
2203 case Instruction::GetElementPtr: {
2217 case Instruction::Trunc:
2223 case Instruction::BitCast:
2226 case Instruction::IntToPtr: {
2237 case Instruction::PtrToInt: {
2263 case Instruction::Sub: {
2291 case Instruction::Add:
2292 case Instruction::Mul:
2293 case Instruction::SDiv:
2294 case Instruction::SRem:
2295 case Instruction::Shl:
2296 case Instruction::And:
2297 case Instruction::Or:
2298 case Instruction::Xor: {
2303 case Instruction::Add: return MCBinaryExpr::createAdd(LHS, RHS, Ctx);
2304 case Instruction::Sub: return MCBinaryExpr::createSub(LHS, RHS, Ctx);
2305 case Instruction::Mul: return MCBinaryExpr::createMul(LHS, RHS, Ctx);
2306 case Instruction::SDiv: return MCBinaryExpr::createDiv(LHS, RHS, Ctx);
2307 case Instruction::SRem: return MCBinaryExpr::createMod(LHS, RHS, Ctx);
2308 case Instruction::Shl: return MCBinaryExpr::createShl(LHS, RHS, Ctx);
2309 case Instruction::And: return MCBinaryExpr::createAnd(LHS, RHS, Ctx);
2310 case Instruction::Or: return MCBinaryExpr::createOr (LHS, RHS, Ctx);
2311 case Instruction::Xor: return MCBinaryExpr::createXor(LHS, RHS, Ctx);
2719 if (CE->getOpcode() == Instruction::BitCast)
lib/CodeGen/AtomicExpandPass.cpp 71 bool bracketInstWithFences(Instruction *I, AtomicOrdering Order);
85 Instruction *I, Type *ResultTy, Value *Addr, AtomicOrdering MemOpOrder,
107 bool expandAtomicOpToLibcall(Instruction *I, unsigned Size, unsigned Align,
207 SmallVector<Instruction *, 1> AtomicInsts;
212 Instruction *I = &*II;
346 bool AtomicExpand::bracketInstWithFences(Instruction *I, AtomicOrdering Order) {
638 static PartwordMaskValues createMaskInstrs(IRBuilder<> &Builder, Instruction *I,
936 Instruction *I, Type *ResultType, Value *Addr, AtomicOrdering MemOpOrder,
956 Instruction::CastOps CastOp = Instruction::ZExt;
956 Instruction::CastOps CastOp = Instruction::ZExt;
959 CastOp = Instruction::SExt;
1610 Instruction *I, unsigned Size, unsigned Align, Value *PointerOperand,
lib/CodeGen/CodeGenPrepare.cpp 236 using SetOfInstrs = SmallPtrSet<Instruction *, 16>;
238 using InstrToOrigTy = DenseMap<Instruction *, TypeIsSExt>;
239 using SExts = SmallVector<Instruction *, 16>;
277 DenseMap<Value *, Instruction *> SeenChainsForSExt;
359 bool optimizeInst(Instruction *I, bool &ModifiedDT);
360 bool optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
364 bool optimizeExt(Instruction *&I);
365 bool optimizeExtUses(Instruction *I);
371 bool optimizeExtractElementInst(Instruction *Inst);
374 bool canFormExtLd(const SmallVectorImpl<Instruction *> &MovedExts,
375 LoadInst *&LI, Instruction *&Inst, bool HasPromoted);
377 const SmallVectorImpl<Instruction *> &Exts,
378 SmallVectorImpl<Instruction *> &ProfitablyMovedExts,
383 Instruction *&Inst,
386 SmallVectorImpl<Instruction *> &SpeculativelyMovedExts);
388 bool simplifyOffsetableRelocate(Instruction &I);
390 bool tryToSinkFreeOperands(Instruction *I);
490 for (Instruction *I : RemovedInsts)
543 SmallVector<Instruction *, 2> Statepoints;
545 for (Instruction &I : BB)
761 const Instruction *UI = cast<Instruction>(U);
761 const Instruction *UI = cast<Instruction>(U);
770 Instruction *Insn = dyn_cast<Instruction>(UPN->getIncomingValue(I));
770 Instruction *Insn = dyn_cast<Instruction>(UPN->getIncomingValue(I));
1043 bool CodeGenPrepare::simplifyOffsetableRelocate(Instruction &I) {
1082 Instruction *User = cast<Instruction>(*UI);
1082 Instruction *User = cast<Instruction>(*UI);
1199 if (BO->getOpcode() == Instruction::Add &&
1206 Instruction *InsertPt = nullptr;
1207 for (Instruction &Iter : *Cmp->getParent()) {
1366 Instruction *User = cast<Instruction>(*UI);
1366 Instruction *User = cast<Instruction>(*UI);
1429 static bool sinkAndCmp0Expression(Instruction *AndI,
1440 AndI->getParent() == cast<Instruction>(*AndI->user_begin())->getParent())
1451 Instruction *User = cast<Instruction>(U);
1451 Instruction *User = cast<Instruction>(U);
1474 Instruction *User = cast<Instruction>(*UI);
1474 Instruction *User = cast<Instruction>(*UI);
1482 Instruction *InsertPt =
1484 Instruction *InsertedAnd =
1485 BinaryOperator::Create(Instruction::And, AndI->getOperand(0),
1506 static bool isExtractBitsCandidateUse(Instruction *User) {
1508 if (User->getOpcode() != Instruction::And ||
1522 SinkShiftAndTruncate(BinaryOperator *ShiftI, Instruction *User, ConstantInt *CI,
1535 Instruction *TruncUser = cast<Instruction>(*TruncUI);
1535 Instruction *TruncUser = cast<Instruction>(*TruncUI);
1569 if (ShiftI->getOpcode() == Instruction::AShr)
1625 Instruction *User = cast<Instruction>(*UI);
1625 Instruction *User = cast<Instruction>(*UI);
1670 if (ShiftI->getOpcode() == Instruction::AShr)
2261 Instruction *Inst;
2266 TypePromotionAction(Instruction *Inst) : Inst(Inst) {}
2292 Instruction *PrevInst;
2301 InsertionHandler(Instruction *Inst) {
2311 void insert(Instruction *Inst) {
2317 Instruction *Position = &*Point.BB->getFirstInsertionPt();
2333 InstructionMoveBefore(Instruction *Inst, Instruction *Before)
2333 InstructionMoveBefore(Instruction *Inst, Instruction *Before)
2357 OperandSetter(Instruction *Inst, unsigned Idx, Value *NewVal)
2383 OperandsHider(Instruction *Inst) : TypePromotionAction(Inst) {
2414 TruncBuilder(Instruction *Opnd, Type *Ty) : TypePromotionAction(Opnd) {
2426 if (Instruction *IVal = dyn_cast<Instruction>(Val))
2426 if (Instruction *IVal = dyn_cast<Instruction>(Val))
2439 SExtBuilder(Instruction *InsertPt, Value *Opnd, Type *Ty)
2452 if (Instruction *IVal = dyn_cast<Instruction>(Val))
2452 if (Instruction *IVal = dyn_cast<Instruction>(Val))
2465 ZExtBuilder(Instruction *InsertPt, Value *Opnd, Type *Ty)
2478 if (Instruction *IVal = dyn_cast<Instruction>(Val))
2478 if (Instruction *IVal = dyn_cast<Instruction>(Val))
2490 TypeMutator(Instruction *Inst, Type *NewTy)
2510 Instruction *Inst;
2515 InstructionAndIdx(Instruction *Inst, unsigned Idx)
2528 UsesReplacer(Instruction *Inst, Value *New) : TypePromotionAction(Inst) {
2533 Instruction *UserI = cast<Instruction>(U.getUser());
2533 Instruction *UserI = cast<Instruction>(U.getUser());
2584 InstructionRemover(Instruction *Inst, SetOfInstrs &RemovedInsts,
2633 void setOperand(Instruction *Inst, unsigned Idx, Value *NewVal);
2636 void eraseInstruction(Instruction *Inst, Value *NewVal = nullptr);
2639 void replaceAllUsesWith(Instruction *Inst, Value *New);
2642 void mutateType(Instruction *Inst, Type *NewTy);
2645 Value *createTrunc(Instruction *Opnd, Type *Ty);
2648 Value *createSExt(Instruction *Inst, Value *Opnd, Type *Ty);
2651 Value *createZExt(Instruction *Inst, Value *Opnd, Type *Ty);
2654 void moveBefore(Instruction *Inst, Instruction *Before);
2654 void moveBefore(Instruction *Inst, Instruction *Before);
2668 void TypePromotionTransaction::setOperand(Instruction *Inst, unsigned Idx,
2674 void TypePromotionTransaction::eraseInstruction(Instruction *Inst,
2681 void TypePromotionTransaction::replaceAllUsesWith(Instruction *Inst,
2687 void TypePromotionTransaction::mutateType(Instruction *Inst, Type *NewTy) {
2692 Value *TypePromotionTransaction::createTrunc(Instruction *Opnd,
2700 Value *TypePromotionTransaction::createSExt(Instruction *Inst,
2708 Value *TypePromotionTransaction::createZExt(Instruction *Inst,
2716 void TypePromotionTransaction::moveBefore(Instruction *Inst,
2717 Instruction *Before) {
2749 SmallVectorImpl<Instruction*> &AddrModeInsts;
2758 Instruction *MemoryInst;
2781 SmallVectorImpl<Instruction *> &AMI, const TargetLowering &TLI,
2782 const TargetRegisterInfo &TRI, Type *AT, unsigned AS, Instruction *MI,
2802 Match(Value *V, Type *AccessTy, unsigned AS, Instruction *MemoryInst,
2803 SmallVectorImpl<Instruction *> &AddrModeInsts,
2823 bool isProfitableToFoldIntoAddressingMode(Instruction *I,
3008 if (auto *PI = dyn_cast<Instruction>(P))
3008 if (auto *PI = dyn_cast<Instruction>(P))
3009 if (Value *V = SimplifyInstruction(cast<Instruction>(PI), SQ)) {
3514 if (isa<Instruction>(ScaleReg) && // not a constant expr.
3523 AddrModeInsts.push_back(cast<Instruction>(ScaleReg));
3537 static bool MightBeFoldableInst(Instruction *I) {
3539 case Instruction::BitCast:
3540 case Instruction::AddrSpaceCast:
3545 case Instruction::PtrToInt:
3548 case Instruction::IntToPtr:
3551 case Instruction::Add:
3553 case Instruction::Mul:
3554 case Instruction::Shl:
3557 case Instruction::GetElementPtr:
3570 Instruction *PromotedInst = dyn_cast<Instruction>(Val);
3570 Instruction *PromotedInst = dyn_cast<Instruction>(Val);
3632 static bool canGetThrough(const Instruction *Inst, Type *ConsideredExtType,
3637 static bool shouldExtOperand(const Instruction *Inst, int OpIdx) {
3651 Instruction *Ext, TypePromotionTransaction &TPT,
3665 static Value *promoteOperandForOther(Instruction *Ext,
3675 Instruction *Ext, TypePromotionTransaction &TPT,
3685 Instruction *Ext, TypePromotionTransaction &TPT,
3695 using Action = Value *(*)(Instruction *Ext, TypePromotionTransaction &TPT,
3718 bool TypePromotionHelper::canGetThrough(const Instruction *Inst,
3745 if ((Inst->getOpcode() == Instruction::And ||
3746 Inst->getOpcode() == Instruction::Or))
3750 if (Inst->getOpcode() == Instruction::Xor) {
3762 if (Inst->getOpcode() == Instruction::LShr && !IsSExt)
3770 if (Inst->getOpcode() == Instruction::Shl && Inst->hasOneUse()) {
3771 const auto *ExtInst = cast<const Instruction>(*Inst->user_begin());
3771 const auto *ExtInst = cast<const Instruction>(*Inst->user_begin());
3773 const auto *AndInst = dyn_cast<const Instruction>(*ExtInst->user_begin());
3773 const auto *AndInst = dyn_cast<const Instruction>(*ExtInst->user_begin());
3774 if (AndInst && AndInst->getOpcode() == Instruction::And) {
3799 Instruction *Opnd = dyn_cast<Instruction>(OpndVal);
3799 Instruction *Opnd = dyn_cast<Instruction>(OpndVal);
3825 Instruction *ExtOpnd = dyn_cast<Instruction>(Ext->getOperand(0));
3825 Instruction *ExtOpnd = dyn_cast<Instruction>(Ext->getOperand(0));
3854 Instruction *SExt, TypePromotionTransaction &TPT,
3860 Instruction *SExtOpnd = cast<Instruction>(SExt->getOperand(0));
3860 Instruction *SExtOpnd = cast<Instruction>(SExt->getOperand(0));
3884 Instruction *ExtInst = dyn_cast<Instruction>(ExtVal);
3884 Instruction *ExtInst = dyn_cast<Instruction>(ExtVal);
3902 Instruction *Ext, TypePromotionTransaction &TPT,
3909 Instruction *ExtOpnd = cast<Instruction>(Ext->getOperand(0));
3909 Instruction *ExtOpnd = cast<Instruction>(Ext->getOperand(0));
3917 if (Instruction *ITrunc = dyn_cast<Instruction>(Trunc)) {
3917 if (Instruction *ITrunc = dyn_cast<Instruction>(Trunc)) {
3943 Instruction *ExtForOpnd = Ext;
3978 if (!isa<Instruction>(ValForExtOpnd)) {
3982 ExtForOpnd = cast<Instruction>(ValForExtOpnd);
4049 case Instruction::PtrToInt:
4052 case Instruction::IntToPtr: {
4060 case Instruction::BitCast:
4070 case Instruction::AddrSpaceCast: {
4078 case Instruction::Add: {
4113 case Instruction::Mul:
4114 case Instruction::Shl: {
4121 if (Opcode == Instruction::Shl)
4126 case Instruction::GetElementPtr: {
4181 auto *BaseI = dyn_cast<Instruction>(Base);
4181 auto *BaseI = dyn_cast<Instruction>(Base);
4242 case Instruction::SExt:
4243 case Instruction::ZExt: {
4244 Instruction *Ext = dyn_cast<Instruction>(AddrInst);
4244 Instruction *Ext = dyn_cast<Instruction>(AddrInst);
4325 } else if (Instruction *I = dyn_cast<Instruction>(Addr)) {
4325 } else if (Instruction *I = dyn_cast<Instruction>(Addr)) {
4420 Instruction *I,
4421 SmallVectorImpl<std::pair<Instruction *, unsigned>> &MemoryUses,
4422 SmallPtrSetImpl<Instruction *> &ConsideredInsts, const TargetLowering &TLI,
4441 Instruction *UserI = cast<Instruction>(U.getUser());
4441 Instruction *UserI = cast<Instruction>(U.getUser());
4505 if (!isa<Instruction>(Val) && !isa<Argument>(Val)) return true;
4542 isProfitableToFoldIntoAddressingMode(Instruction *I, ExtAddrMode &AMBefore,
4573 SmallVector<std::pair<Instruction*,unsigned>, 16> MemoryUses;
4574 SmallPtrSet<Instruction*, 16> ConsideredInsts;
4587 SmallVector<Instruction*, 32> MatchedAddrModeInsts;
4589 Instruction *User = MemoryUses[i].first;
4634 if (Instruction *I = dyn_cast<Instruction>(V))
4634 if (Instruction *I = dyn_cast<Instruction>(V))
4658 bool CodeGenPrepare::optimizeMemoryInst(Instruction *MemoryInst, Value *Addr,
4672 SmallVector<Instruction*, 16> AddrModeInsts;
4964 Instruction *I = dyn_cast_or_null<Instruction>(Result);
4964 Instruction *I = dyn_cast_or_null<Instruction>(Result);
5060 const Instruction *FirstUser = cast<Instruction>(*Val->user_begin());
5060 const Instruction *FirstUser = cast<Instruction>(*Val->user_begin());
5064 const Instruction *UI = cast<Instruction>(U);
5064 const Instruction *UI = cast<Instruction>(U);
5112 TypePromotionTransaction &TPT, const SmallVectorImpl<Instruction *> &Exts,
5113 SmallVectorImpl<Instruction *> &ProfitablyMovedExts,
5145 SmallVector<Instruction *, 4> NewExts;
5176 SmallVector<Instruction *, 2> NewlyMovedExts;
5180 Instruction *MovedExt = cast<Instruction>(ExtInst);
5180 Instruction *MovedExt = cast<Instruction>(ExtInst);
5212 for (Instruction *Inst : Insts) {
5341 if (auto *BaseI = dyn_cast<Instruction>(OldBase)) {
5341 if (auto *BaseI = dyn_cast<Instruction>(OldBase)) {
5396 const SmallVectorImpl<Instruction *> &MovedExts, LoadInst *&LI,
5397 Instruction *&Inst, bool HasPromoted) {
5398 for (auto *MovedExtInst : MovedExts) {
5453 bool CodeGenPrepare::optimizeExt(Instruction *&Inst) {
5468 SmallVector<Instruction *, 1> Exts;
5469 SmallVector<Instruction *, 2> SpeculativelyMovedExts;
5476 Instruction *ExtFedByLoad;
5514 Instruction *&Inst, bool AllowPromotionWithoutCommonHeader,
5516 SmallVectorImpl<Instruction *> &SpeculativelyMovedExts) {
5518 SmallPtrSet<Instruction *, 1> UnhandledExts;
5522 DenseMap<Value *, Instruction *>::iterator AlreadySeen =
5561 SmallVector<Instruction *, 1> Exts;
5562 SmallVector<Instruction *, 2> Chains;
5578 bool CodeGenPrepare::optimizeExtUses(Instruction *I) {
5593 if (!isa<Instruction>(Src) || DefBB != cast<Instruction>(Src)->getParent())
5593 if (!isa<Instruction>(Src) || DefBB != cast<Instruction>(Src)->getParent())
5598 Instruction *UI = cast<Instruction>(U);
5598 Instruction *UI = cast<Instruction>(U);
5611 Instruction *UI = cast<Instruction>(U);
5611 Instruction *UI = cast<Instruction>(U);
5621 DenseMap<BasicBlock*, Instruction*> InsertedTruncs;
5625 Instruction *User = cast<Instruction>(U.getUser());
5625 Instruction *User = cast<Instruction>(U.getUser());
5632 Instruction *&InsertedTrunc = InsertedTruncs[UserBB];
5707 InsertedInsts.count(cast<Instruction>(*Load->user_begin())))
5712 SmallVector<Instruction *, 8> WorkList;
5713 SmallPtrSet<Instruction *, 16> Visited;
5714 SmallVector<Instruction *, 8> AndsToMaybeRemove;
5716 WorkList.push_back(cast<Instruction>(U));
5724 Instruction *I = WorkList.back();
5734 WorkList.push_back(cast<Instruction>(U));
5739 case Instruction::And: {
5753 case Instruction::Shl: {
5762 case Instruction::Trunc: {
5800 auto *NewAnd = cast<Instruction>(
5800 auto *NewAnd = cast<Instruction>(
5812 for (auto *And : AndsToMaybeRemove)
5830 auto *I = dyn_cast<Instruction>(V);
5830 auto *I = dyn_cast<Instruction>(V);
5884 const SmallPtrSet<const Instruction *, 2> &Selects) {
6028 auto *TrueInst = cast<Instruction>(SI->getTrueValue());
6028 auto *TrueInst = cast<Instruction>(SI->getTrueValue());
6038 auto *FalseInst = cast<Instruction>(SI->getFalseValue());
6038 auto *FalseInst = cast<Instruction>(SI->getFalseValue());
6075 SmallPtrSet<const Instruction *, 2> INS;
6129 DenseMap<BasicBlock*, Instruction*> InsertedShuffles;
6133 Instruction *UI = cast<Instruction>(U);
6133 Instruction *UI = cast<Instruction>(U);
6144 Instruction *&InsertedShuffle = InsertedShuffles[UserBB];
6168 bool CodeGenPrepare::tryToSinkFreeOperands(Instruction *I) {
6183 auto *UI = cast<Instruction>(U->get());
6183 auto *UI = cast<Instruction>(U->get());
6189 SetVector<Instruction *> MaybeDead;
6190 DenseMap<Instruction *, Instruction *> NewInstructions;
6190 DenseMap<Instruction *, Instruction *> NewInstructions;
6191 Instruction *InsertPoint = I;
6193 auto *UI = cast<Instruction>(U->get());
6193 auto *UI = cast<Instruction>(U->get());
6194 Instruction *NI = UI->clone();
6205 Instruction *OldI = cast<Instruction>(U->getUser());
6205 Instruction *OldI = cast<Instruction>(U->getUser());
6214 for (auto *I : MaybeDead) {
6249 Instruction::CastOps ExtType = Instruction::ZExt;
6249 Instruction::CastOps ExtType = Instruction::ZExt;
6252 ExtType = Instruction::SExt;
6260 APInt WideConst = (ExtType == Instruction::ZExt) ?
6297 Instruction *Transition;
6300 SmallVector<Instruction *, 4> InstsToBePromoted;
6306 Instruction *CombineInst = nullptr;
6311 Instruction *getEndOfTransition() const {
6350 void promoteImpl(Instruction *ToBePromoted);
6441 static bool canCauseUndefinedBehavior(const Instruction *Use,
6450 case Instruction::SDiv:
6451 case Instruction::UDiv:
6452 case Instruction::SRem:
6453 case Instruction::URem:
6455 case Instruction::FDiv:
6456 case Instruction::FRem:
6464 const TargetTransformInfo &TTI, Instruction *Transition,
6472 bool canPromote(const Instruction *ToBePromoted) const {
6479 bool shouldPromote(const Instruction *ToBePromoted) const {
6508 bool canCombine(const Instruction *Use) { return isa<StoreInst>(Use); }
6511 void enqueueForPromotion(Instruction *ToBePromoted) {
6516 void recordCombineInstruction(Instruction *ToBeCombined) {
6545 void VectorPromoteHelper::promoteImpl(Instruction *ToBePromoted) {
6589 bool CodeGenPrepare::optimizeExtractElementInst(Instruction *Inst) {
6610 Instruction *ToBePromoted = cast<Instruction>(*Inst->user_begin());
6610 Instruction *ToBePromoted = cast<Instruction>(*Inst->user_begin());
6840 if (!isa<Instruction>(GEPIOp))
6842 auto *GEPIOpI = cast<Instruction>(GEPIOp);
6842 auto *GEPIOpI = cast<Instruction>(GEPIOp);
6848 if (auto *I = dyn_cast<Instruction>(Usr)) {
6848 if (auto *I = dyn_cast<Instruction>(Usr)) {
6863 if (!isa<Instruction>(Usr))
6865 auto *UI = cast<Instruction>(Usr);
6865 auto *UI = cast<Instruction>(Usr);
6921 bool CodeGenPrepare::optimizeInst(Instruction *I, bool &ModifiedDT) {
7012 if (BinOp && (BinOp->getOpcode() == Instruction::And) &&
7017 if (BinOp && (BinOp->getOpcode() == Instruction::AShr ||
7018 BinOp->getOpcode() == Instruction::LShr)) {
7028 Instruction *NC = new BitCastInst(GEPI->getOperand(0), GEPI->getType(),
7047 case Instruction::Shl:
7048 case Instruction::LShr:
7049 case Instruction::AShr:
7051 case Instruction::Call:
7053 case Instruction::Select:
7055 case Instruction::ShuffleVector:
7057 case Instruction::Switch:
7059 case Instruction::ExtractElement:
7068 static bool makeBitReverse(Instruction &I, const DataLayout &DL,
7075 SmallVector<Instruction*, 4> Insts;
7078 Instruction *LastInst = Insts.back();
7101 for (auto &I : reverse(BB)) {
7119 Instruction *PrevNonDbgInst = nullptr;
7121 Instruction *Insn = &*BI++;
7133 Instruction *VI = dyn_cast_or_null<Instruction>(DVI->getValue());
7133 Instruction *VI = dyn_cast_or_null<Instruction>(DVI->getValue());
7208 Opc = Instruction::And;
7211 Opc = Instruction::Or;
7233 if (Opc == Instruction::And)
7240 if (auto *I = dyn_cast<Instruction>(Cond2)) {
7240 if (auto *I = dyn_cast<Instruction>(Cond2)) {
7254 if (Opc == Instruction::Or)
7268 if (Opc == Instruction::Or) {
lib/CodeGen/ExpandMemCmp.cpp 825 for (Instruction& I : BB) {
lib/CodeGen/ExpandReductions.cpp 33 return Instruction::FAdd;
35 return Instruction::FMul;
37 return Instruction::Add;
39 return Instruction::Mul;
41 return Instruction::And;
43 return Instruction::Or;
45 return Instruction::Xor;
50 return Instruction::ICmp;
53 return Instruction::FCmp;
lib/CodeGen/GCRootLowering.cpp 117 static bool CouldBecomeSafePoint(Instruction *I) {
lib/CodeGen/GlobalISel/IRTranslator.cpp 119 const Instruction *CurrInst = nullptr;
125 const Instruction *getCurrentInst() const { return CurrInst; }
126 void setCurrentInst(const Instruction *Inst) { CurrInst = Inst; }
243 unsigned IRTranslator::getMemOpAlignment(const Instruction &I) {
297 if (isa<Instruction>(U)) {
298 const Instruction &I = cast<Instruction>(U);
298 const Instruction &I = cast<Instruction>(U);
313 if (isa<Instruction>(U)) {
314 const Instruction &I = cast<Instruction>(U);
314 const Instruction &I = cast<Instruction>(U);
328 if (isa<Instruction>(U)) {
329 const Instruction &I = cast<Instruction>(U);
329 const Instruction &I = cast<Instruction>(U);
1546 const Instruction &I = *CS.getInstruction();
2089 bool IRTranslator::translate(const Instruction &Inst) {
2335 for (const Instruction &Inst : *BB) {
lib/CodeGen/GlobalMerge.cpp 316 } else if (isa<Instruction>(U.getUser())) {
326 Instruction *I = dyn_cast<Instruction>(UI->getUser());
326 Instruction *I = dyn_cast<Instruction>(UI->getUser());
583 Instruction *Pad = BB.getFirstNonPHI();
lib/CodeGen/HardwareLoops.cpp 133 Instruction *InsertLoopRegDec(Value *EltsRem);
268 Instruction *LoopDec = InsertLoopRegDec(LoopCountInit);
414 Instruction* HardwareLoop::InsertLoopRegDec(Value *EltsRem) {
426 return cast<Instruction>(Call);
lib/CodeGen/InterleavedAccessPass.cpp 108 SmallVector<Instruction *, 32> &DeadInsts);
112 SmallVector<Instruction *, 32> &DeadInsts);
281 LoadInst *LI, SmallVector<Instruction *, 32> &DeadInsts) {
418 StoreInst *SI, SmallVector<Instruction *, 32> &DeadInsts) {
457 SmallVector<Instruction *, 32> DeadInsts;
460 for (auto &I : instructions(F)) {
lib/CodeGen/InterleavedLoadCombinePass.cpp 666 std::set<Instruction *> Is;
732 Instruction *Op = dyn_cast<Instruction>(BCI->getOperand(0));
732 Instruction *Op = dyn_cast<Instruction>(BCI->getOperand(0));
915 case Instruction::Add:
923 case Instruction::LShr:
972 case Instruction::BitCast:
1129 std::set<Instruction *> Is;
1130 std::set<Instruction *> SVIs;
1171 if (Is.find(dyn_cast<Instruction>(U)) == Is.end())
1209 Instruction::Load, ILTy, Factor, Indices, InsertionPoint->getAlignment(),
1265 for (Instruction &I : BB) {
lib/CodeGen/IntrinsicLowering.cpp 62 static Value *LowerBSWAP(LLVMContext &Context, Value *V, Instruction *IP) {
157 static Value *LowerCTPOP(LLVMContext &Context, Value *V, Instruction *IP) {
196 static Value *LowerCTLZ(LLVMContext &Context, Value *V, Instruction *IP) {
lib/CodeGen/MIRParser/MIParser.cpp 3014 for (const auto &I : BB)
lib/CodeGen/MachineFunction.cpp 657 const Instruction *FirstI = LandingPad->getBasicBlock()->getFirstNonPHI();
1043 A = ConstantFoldCastOperand(Instruction::PtrToInt,
1046 A = ConstantFoldCastOperand(Instruction::BitCast, const_cast<Constant *>(A),
1049 B = ConstantFoldCastOperand(Instruction::PtrToInt,
1052 B = ConstantFoldCastOperand(Instruction::BitCast, const_cast<Constant *>(B),
lib/CodeGen/MachineInstr.cpp 526 uint16_t MachineInstr::copyFlagsFromInstruction(const Instruction &I) {
564 void MachineInstr::copyIRFlags(const Instruction &I) {
lib/CodeGen/MachinePipeliner.cpp 271 const Instruction *TI = BBLK->getTerminator();
lib/CodeGen/SafeStack.cpp 159 SmallVectorImpl<Instruction *> &StackRestorePoints);
175 Instruction *BasePointer,
185 ArrayRef<Instruction *> StackRestorePoints,
291 auto I = cast<const Instruction>(UI.getUser());
295 case Instruction::Load:
301 case Instruction::VAArg:
304 case Instruction::Store:
318 case Instruction::Ret:
322 case Instruction::Call:
323 case Instruction::Invoke: {
360 WorkList.push_back(cast<const Instruction>(I));
382 SmallVectorImpl<Instruction *> &StackRestorePoints) {
383 for (Instruction &I : instructions(&F)) {
428 ArrayRef<Instruction *> StackRestorePoints,
451 for (Instruction *I : StackRestorePoints) {
473 Instruction *CheckTerm =
489 Instruction *BasePointer, AllocaInst *StackGuardSlot) {
543 BasePointer = cast<Instruction>(IRB.CreateIntToPtr(
581 IRB.SetInsertPoint(cast<Instruction>(NewArg)->getNextNode());
599 Instruction *User = cast<Instruction>(U.getUser());
599 Instruction *User = cast<Instruction>(U.getUser());
601 Instruction *InsertBefore;
675 if (AI->hasName() && isa<Instruction>(NewAI))
686 Instruction *I = &*(It++);
693 Instruction *LI = IRB.CreateLoad(StackPtrTy, UnsafeStackPtr);
699 Instruction *SI = IRB.CreateStore(II->getArgOperand(0), UnsafeStackPtr);
754 SmallVector<Instruction *, 4> StackRestorePoints;
787 Instruction *BasePointer =
lib/CodeGen/SafeStackColoring.cpp 47 bool StackColoring::readMarker(Instruction *I, bool *IsStart) {
57 for (auto *I : Markers) {
58 auto *Op = dyn_cast<Instruction>(I->getOperand(1));
58 auto *Op = dyn_cast<Instruction>(I->getOperand(1));
68 DenseMap<BasicBlock *, SmallDenseMap<Instruction *, Marker>> BBMarkerSet;
73 SmallVector<Instruction *, 8> WorkList;
76 Instruction *I = WorkList.pop_back_val();
82 auto *UI = dyn_cast<Instruction>(U);
82 auto *UI = dyn_cast<Instruction>(U);
147 for (Instruction &I : *BB) {
lib/CodeGen/SafeStackColoring.h 82 DenseMap<Instruction *, unsigned> InstructionNumbering;
98 SmallVector<Instruction *, 8> Markers;
112 bool readMarker(Instruction *I, bool *IsStart);
lib/CodeGen/ScalarizeMaskedMemIntrin.cpp 138 Instruction *InsertPt = CI;
219 Instruction *OldBr = IfBlock->getTerminator();
276 Instruction *InsertPt = CI;
350 Instruction *OldBr = IfBlock->getTerminator();
399 Instruction *InsertPt = CI;
469 Instruction *OldBr = IfBlock->getTerminator();
526 Instruction *InsertPt = CI;
588 Instruction *OldBr = IfBlock->getTerminator();
608 Instruction *InsertPt = CI;
684 Instruction *OldBr = IfBlock->getTerminator();
719 Instruction *InsertPt = CI;
790 Instruction *OldBr = IfBlock->getTerminator();
lib/CodeGen/SelectionDAG/FastISel.cpp 332 const Instruction *I = dyn_cast<Instruction>(V);
332 const Instruction *I = dyn_cast<Instruction>(V);
356 !(I->getOpcode() == Instruction::BitCast ||
357 I->getOpcode() == Instruction::PtrToInt ||
358 I->getOpcode() == Instruction::IntToPtr) &&
359 cast<Instruction>(*I->user_begin())->getParent() == I->getParent();
387 if (isa<Instruction>(V) &&
440 if (!isa<Instruction>(Op) ||
441 !fastSelectInstruction(cast<Instruction>(Op)))
487 if (!isa<Instruction>(I)) {
607 if (isa<Instruction>(I) && cast<Instruction>(I)->isCommutative()) {
607 if (isa<Instruction>(I) && cast<Instruction>(I)->isCommutative()) {
965 if (C->getOpcode() == Instruction::IntToPtr) {
1381 if (!Op && !Address->use_empty() && isa<Instruction>(Address) &&
1590 bool FastISel::selectInstruction(const Instruction *I) {
1773 else if (isa<Instruction>(Op0))
1793 case Instruction::Add:
1795 case Instruction::FAdd:
1797 case Instruction::Sub:
1799 case Instruction::FSub: {
1806 case Instruction::Mul:
1808 case Instruction::FMul:
1810 case Instruction::SDiv:
1812 case Instruction::UDiv:
1814 case Instruction::FDiv:
1816 case Instruction::SRem:
1818 case Instruction::URem:
1820 case Instruction::FRem:
1822 case Instruction::Shl:
1824 case Instruction::LShr:
1826 case Instruction::AShr:
1828 case Instruction::And:
1830 case Instruction::Or:
1832 case Instruction::Xor:
1835 case Instruction::FNeg:
1838 case Instruction::GetElementPtr:
1841 case Instruction::Br: {
1856 case Instruction::Unreachable:
1862 case Instruction::Alloca:
1870 case Instruction::Call:
1880 case Instruction::BitCast:
1883 case Instruction::FPToSI:
1885 case Instruction::ZExt:
1887 case Instruction::SExt:
1889 case Instruction::Trunc:
1891 case Instruction::SIToFP:
1894 case Instruction::IntToPtr: // Deliberate fall-through.
1895 case Instruction::PtrToInt: {
1909 case Instruction::ExtractValue:
1912 case Instruction::PHI:
2252 const Instruction *TI = LLVMBB->getTerminator();
2300 if (const auto *Inst = dyn_cast<Instruction>(PHIOp))
2300 if (const auto *Inst = dyn_cast<Instruction>(PHIOp))
2316 bool FastISel::tryToFoldLoad(const LoadInst *LI, const Instruction *FoldInst) {
2324 const Instruction *TheUser = LI->user_back();
2381 if (isa<Instruction>(Add) &&
2382 FuncInfo.MBBMap[cast<Instruction>(Add)->getParent()] != FuncInfo.MBB)
2389 FastISel::createMachineMemOperandFor(const Instruction *I) const {
lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp 48 static bool isUsedOutsideOfDefiningBlock(const Instruction *I) {
53 if (cast<Instruction>(U)->getParent() != BB || isa<PHINode>(U))
134 for (const Instruction &I : BB) {
234 const Instruction *PadInst = BB.getFirstNonPHI();
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp 340 const Instruction *I = dyn_cast_or_null<Instruction>(V);
340 const Instruction *I = dyn_cast_or_null<Instruction>(V);
1078 void SelectionDAGBuilder::visit(const Instruction &I) {
1233 while (isa<Instruction>(V)) {
1234 Instruction &VAsInst = *cast<Instruction>(V);
1234 Instruction &VAsInst = *cast<Instruction>(V);
1566 if (const Instruction *Inst = dyn_cast<Instruction>(V)) {
1566 if (const Instruction *Inst = dyn_cast<Instruction>(V)) {
1622 SuccessorColor = cast<Instruction>(ParentPad)->getParent();
1655 const Instruction *Pad = EHPadBB->getFirstNonPHI();
1703 const Instruction *Pad = EHPadBB->getFirstNonPHI();
1948 if (!isa<Instruction>(V) && !isa<Argument>(V)) return;
1961 if (const Instruction *VI = dyn_cast<Instruction>(V)) {
1961 if (const Instruction *VI = dyn_cast<Instruction>(V)) {
2013 if (const Instruction *I = dyn_cast<Instruction>(V))
2013 if (const Instruction *I = dyn_cast<Instruction>(V))
2074 Instruction::BinaryOps Opc,
2088 const Instruction *BOp = dyn_cast<Instruction>(Cond);
2088 const Instruction *BOp = dyn_cast<Instruction>(Cond);
2098 if (BOpc == Instruction::And)
2099 BOpc = Instruction::Or;
2100 else if (BOpc == Instruction::Or)
2101 BOpc = Instruction::And;
2122 if (Opc == Instruction::Or) {
2263 Instruction::BinaryOps Opcode = BOp->getOpcode();
2266 (Opcode == Instruction::And || Opcode == Instruction::Or)) {
2266 (Opcode == Instruction::And || Opcode == Instruction::Or)) {
2979 const Instruction *Inst = dyn_cast<Instruction>(I);
2979 const Instruction *Inst = dyn_cast<Instruction>(I);
2985 case Instruction::Add:
2986 case Instruction::Mul:
2987 case Instruction::And:
2988 case Instruction::Or:
2989 case Instruction::Xor:
2991 case Instruction::FAdd:
2992 case Instruction::FMul:
3038 auto Inst = dyn_cast<Instruction>(U);
3074 auto U2 = dyn_cast<Instruction>(*U->user_begin());
7145 if (Entry.IsSRet && isa<Instruction>(V))
7180 const Instruction *Inst = CS.getInstruction();
7243 void SelectionDAGBuilder::processIntegerCallValue(const Instruction &I,
8069 const Instruction *I = CS.getInstruction();
8577 const Instruction &I,
9405 if (cast<Instruction>(U)->getParent() != &Entry || isa<SwitchInst>(U))
9446 for (const Instruction &I : FuncInfo->Fn->getEntryBlock()) {
9513 SmallPtrSetImpl<const Instruction *> &ElidedArgCopyInstrs,
9928 const Instruction *TI = LLVMBB->getTerminator();
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h 98 const Instruction *CurInst = nullptr;
468 void visit(const Instruction &I);
528 Instruction::BinaryOps Opc, BranchProbability TProb,
545 SDValue lowerRangeToAssertZExt(SelectionDAG &DAG, const Instruction &I,
576 const Instruction *StatepointInstr = nullptr;
765 void visitUserOp1(const Instruction &I) {
768 void visitUserOp2(const Instruction &I) {
772 void processIntegerCallValue(const Instruction &I,
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 397 for (const Instruction &I : instructions(F)) {
486 const Instruction *Term = BB.getTerminator();
1282 static bool isFoldedOrDeadInstruction(const Instruction *I,
1297 for (const Instruction &I : BB) {
1453 const Instruction *Inst = &*std::prev(BI);
1473 const Instruction *BeforeInst = Inst;
lib/CodeGen/SelectionDAG/StatepointLowering.cpp 603 const Instruction *StatepointInstr = SI.StatepointInstr;
968 const Instruction *I = CI.getStatepoint();
lib/CodeGen/ShadowStackGCLowering.cpp 307 Instruction *StackEntry =
315 Instruction *CurrentHead =
317 Instruction *EntryMapPtr = CreateGEP(Context, AtEntry, ConcreteStackEntryTy,
342 Instruction *EntryNextPtr = CreateGEP(Context, AtEntry, ConcreteStackEntryTy,
344 Instruction *NewHeadVal = CreateGEP(Context, AtEntry, ConcreteStackEntryTy,
354 Instruction *EntryNextPtr2 =
lib/CodeGen/SjLjEHPrepare.cpp 70 void insertCallSiteStore(Instruction *I, int Number);
102 void SjLjEHPrepare::insertCallSiteStore(Instruction *I, int Number) {
160 auto *SelI = cast<Instruction>(SelVal);
160 auto *SelI = cast<Instruction>(SelVal);
248 Instruction *SI = SelectInst::Create(
263 for (Instruction &Inst : BB) {
270 cast<Instruction>(Inst.user_back())->getParent() == &BB &&
281 SmallVector<Instruction *, 16> Users;
283 Instruction *UI = cast<Instruction>(U);
283 Instruction *UI = cast<Instruction>(U);
292 Instruction *U = Users.pop_back_val();
435 for (Instruction &I : BB)
450 for (Instruction &I : BB) {
457 Instruction *StackAddr = CallInst::Create(StackAddrFn, "sp");
459 Instruction *StoreStackAddr = new StoreInst(StackAddr, StackPtr, true);
lib/CodeGen/StackColoring.cpp 921 Instruction *Inst = const_cast<AllocaInst *>(To);
lib/CodeGen/StackProtector.cpp 159 bool StackProtector::HasAddressTaken(const Instruction *AI) {
161 const auto *I = cast<Instruction>(U);
161 const auto *I = cast<Instruction>(U);
163 case Instruction::Store:
167 case Instruction::AtomicCmpXchg:
173 case Instruction::PtrToInt:
177 case Instruction::Call: {
185 case Instruction::Invoke:
187 case Instruction::BitCast:
188 case Instruction::GetElementPtr:
189 case Instruction::Select:
190 case Instruction::AddrSpaceCast:
194 case Instruction::PHI: {
203 case Instruction::Load:
204 case Instruction::AtomicRMW:
205 case Instruction::Ret:
225 for (const Instruction &I : BB)
276 for (const Instruction &I : BB) {
lib/CodeGen/SwiftErrorValueTracking.cpp 51 const Instruction *I, const MachineBasicBlock *MBB, const Value *Val) {
66 const Instruction *I, const MachineBasicBlock *MBB, const Value *Val) {
108 for (const auto &Inst : LLVMBB) {
221 auto DLoc = isa<Instruction>(SwiftErrorVal)
222 ? cast<Instruction>(SwiftErrorVal)->getDebugLoc()
lib/CodeGen/TargetLoweringBase.cpp 1730 unsigned AS, Instruction *I) const {
lib/CodeGen/WasmEHPrepare.cpp 210 auto *Pad = BB.getFirstNonPHI();
281 Instruction *GetExnCI = nullptr, *GetSelectorCI = nullptr;
299 Instruction *ExtractExnCI = IRB.CreateCall(ExtractExnF, {}, "exn");
340 Instruction *Selector =
358 const Instruction *Pad = BB.getFirstNonPHI();
364 const Instruction *UnwindPad = UnwindBB->getFirstNonPHI();
lib/CodeGen/WinEHPrepare.cpp 209 Instruction *PadInst = InvokeUnwindDest->getFirstNonPHI();
220 const Instruction *TI = BB->getTerminator();
236 const Instruction *FirstNonPHI,
264 const auto *UserI = cast<Instruction>(U);
264 const auto *UserI = cast<Instruction>(U);
307 const auto *UserI = cast<Instruction>(U);
307 const auto *UserI = cast<Instruction>(U);
338 const Instruction *FirstNonPHI,
374 const auto *UserI = cast<Instruction>(U);
374 const auto *UserI = cast<Instruction>(U);
407 const auto *UserI = cast<Instruction>(U);
407 const auto *UserI = cast<Instruction>(U);
415 static bool isTopLevelPadForMSVC(const Instruction *EHPad) {
436 const Instruction *FirstNonPHI = BB.getFirstNonPHI();
454 const Instruction *FirstNonPHI = BB.getFirstNonPHI();
506 SmallVector<std::pair<const Instruction *, int>, 8> Worklist;
508 const Instruction *FirstNonPHI = BB.getFirstNonPHI();
527 const Instruction *Pad;
541 if (const auto *I = dyn_cast<Instruction>(U))
541 if (const auto *I = dyn_cast<Instruction>(U))
565 if (const auto *I = dyn_cast<Instruction>(U))
565 if (const auto *I = dyn_cast<Instruction>(U))
583 const Instruction *Pad =
633 const Instruction *UserUnwindPad = UserUnwindDest->getFirstNonPHI();
701 Instruction *I = &*BI++;
801 for (Instruction &I : *BB)
877 if (auto *Inst = dyn_cast<Instruction>(IV)) {
877 if (auto *Inst = dyn_cast<Instruction>(IV)) {
896 auto *OldI = dyn_cast<Instruction>(const_cast<Value *>(VT.first));
896 auto *OldI = dyn_cast<Instruction>(const_cast<Value *>(VT.first));
899 auto *NewI = cast<Instruction>(VT.second);
899 auto *NewI = cast<Instruction>(VT.second);
903 Instruction *UserI = cast<Instruction>(U.getUser());
903 Instruction *UserI = cast<Instruction>(U.getUser());
936 Instruction *FirstNonPHI = FuncletPadBB->getFirstNonPHI();
942 for (Instruction &I : *BB) {
979 Instruction *TI = BB->getTerminator();
1074 Instruction *EHPad = PHIBlock->getFirstNonPHI();
1095 auto *UsingInst = cast<Instruction>(U.getUser());
1095 auto *UsingInst = cast<Instruction>(U.getUser());
1170 auto *UsingInst = cast<Instruction>(U.getUser());
1170 auto *UsingInst = cast<Instruction>(U.getUser());
lib/ExecutionEngine/ExecutionEngine.cpp 646 case Instruction::GetElementPtr: {
656 case Instruction::Trunc: {
662 case Instruction::ZExt: {
668 case Instruction::SExt: {
674 case Instruction::FPTrunc: {
680 case Instruction::FPExt:{
686 case Instruction::UIToFP: {
701 case Instruction::SIToFP: {
716 case Instruction::FPToUI: // double->APInt conversion handles sign
717 case Instruction::FPToSI: {
729 CE->getOpcode()==Instruction::FPToSI,
735 case Instruction::PtrToInt: {
744 case Instruction::IntToPtr: {
752 case Instruction::BitCast: {
778 case Instruction::Add:
779 case Instruction::FAdd:
780 case Instruction::Sub:
781 case Instruction::FSub:
782 case Instruction::Mul:
783 case Instruction::FMul:
784 case Instruction::UDiv:
785 case Instruction::SDiv:
786 case Instruction::URem:
787 case Instruction::SRem:
788 case Instruction::And:
789 case Instruction::Or:
790 case Instruction::Xor: {
799 case Instruction::Add: GV.IntVal = LHS.IntVal + RHS.IntVal; break;
800 case Instruction::Sub: GV.IntVal = LHS.IntVal - RHS.IntVal; break;
801 case Instruction::Mul: GV.IntVal = LHS.IntVal * RHS.IntVal; break;
802 case Instruction::UDiv:GV.IntVal = LHS.IntVal.udiv(RHS.IntVal); break;
803 case Instruction::SDiv:GV.IntVal = LHS.IntVal.sdiv(RHS.IntVal); break;
804 case Instruction::URem:GV.IntVal = LHS.IntVal.urem(RHS.IntVal); break;
805 case Instruction::SRem:GV.IntVal = LHS.IntVal.srem(RHS.IntVal); break;
806 case Instruction::And: GV.IntVal = LHS.IntVal & RHS.IntVal; break;
807 case Instruction::Or: GV.IntVal = LHS.IntVal | RHS.IntVal; break;
808 case Instruction::Xor: GV.IntVal = LHS.IntVal ^ RHS.IntVal; break;
814 case Instruction::FAdd:
816 case Instruction::FSub:
818 case Instruction::FMul:
820 case Instruction::FDiv:
822 case Instruction::FRem:
829 case Instruction::FAdd:
831 case Instruction::FSub:
833 case Instruction::FMul:
835 case Instruction::FDiv:
837 case Instruction::FRem:
848 case Instruction::FAdd:
852 case Instruction::FSub:
857 case Instruction::FMul:
862 case Instruction::FDiv:
867 case Instruction::FRem:
lib/ExecutionEngine/Interpreter/Execution.cpp 76 case Instruction::FNeg:
93 case Instruction::FNeg: executeFNegInst(R, Src, Ty); break;
786 case Instruction::Add: INTEGER_VECTOR_OPERATION(+) break;
787 case Instruction::Sub: INTEGER_VECTOR_OPERATION(-) break;
788 case Instruction::Mul: INTEGER_VECTOR_OPERATION(*) break;
789 case Instruction::UDiv: INTEGER_VECTOR_FUNCTION(udiv) break;
790 case Instruction::SDiv: INTEGER_VECTOR_FUNCTION(sdiv) break;
791 case Instruction::URem: INTEGER_VECTOR_FUNCTION(urem) break;
792 case Instruction::SRem: INTEGER_VECTOR_FUNCTION(srem) break;
793 case Instruction::And: INTEGER_VECTOR_OPERATION(&) break;
794 case Instruction::Or: INTEGER_VECTOR_OPERATION(|) break;
795 case Instruction::Xor: INTEGER_VECTOR_OPERATION(^) break;
796 case Instruction::FAdd: FLOAT_VECTOR_OP(+) break;
797 case Instruction::FSub: FLOAT_VECTOR_OP(-) break;
798 case Instruction::FMul: FLOAT_VECTOR_OP(*) break;
799 case Instruction::FDiv: FLOAT_VECTOR_OP(/) break;
800 case Instruction::FRem:
823 case Instruction::Add: R.IntVal = Src1.IntVal + Src2.IntVal; break;
824 case Instruction::Sub: R.IntVal = Src1.IntVal - Src2.IntVal; break;
825 case Instruction::Mul: R.IntVal = Src1.IntVal * Src2.IntVal; break;
826 case Instruction::FAdd: executeFAddInst(R, Src1, Src2, Ty); break;
827 case Instruction::FSub: executeFSubInst(R, Src1, Src2, Ty); break;
828 case Instruction::FMul: executeFMulInst(R, Src1, Src2, Ty); break;
829 case Instruction::FDiv: executeFDivInst(R, Src1, Src2, Ty); break;
830 case Instruction::FRem: executeFRemInst(R, Src1, Src2, Ty); break;
831 case Instruction::UDiv: R.IntVal = Src1.IntVal.udiv(Src2.IntVal); break;
832 case Instruction::SDiv: R.IntVal = Src1.IntVal.sdiv(Src2.IntVal); break;
833 case Instruction::URem: R.IntVal = Src1.IntVal.urem(Src2.IntVal); break;
834 case Instruction::SRem: R.IntVal = Src1.IntVal.srem(Src2.IntVal); break;
835 case Instruction::And: R.IntVal = Src1.IntVal & Src2.IntVal; break;
836 case Instruction::Or: R.IntVal = Src1.IntVal | Src2.IntVal; break;
837 case Instruction::Xor: R.IntVal = Src1.IntVal ^ Src2.IntVal; break;
905 if (Instruction *I = CallingSF.Caller.getInstruction()) {
1040 if (I.getOpcode() == Instruction::Alloca)
2024 case Instruction::Trunc:
2026 case Instruction::ZExt:
2028 case Instruction::SExt:
2030 case Instruction::FPTrunc:
2032 case Instruction::FPExt:
2034 case Instruction::UIToFP:
2036 case Instruction::SIToFP:
2038 case Instruction::FPToUI:
2040 case Instruction::FPToSI:
2042 case Instruction::PtrToInt:
2044 case Instruction::IntToPtr:
2046 case Instruction::BitCast:
2048 case Instruction::GetElementPtr:
2051 case Instruction::FCmp:
2052 case Instruction::ICmp:
2057 case Instruction::Select:
2073 case Instruction::Add: Dest.IntVal = Op0.IntVal + Op1.IntVal; break;
2074 case Instruction::Sub: Dest.IntVal = Op0.IntVal - Op1.IntVal; break;
2075 case Instruction::Mul: Dest.IntVal = Op0.IntVal * Op1.IntVal; break;
2076 case Instruction::FAdd: executeFAddInst(Dest, Op0, Op1, Ty); break;
2077 case Instruction::FSub: executeFSubInst(Dest, Op0, Op1, Ty); break;
2078 case Instruction::FMul: executeFMulInst(Dest, Op0, Op1, Ty); break;
2079 case Instruction::FDiv: executeFDivInst(Dest, Op0, Op1, Ty); break;
2080 case Instruction::FRem: executeFRemInst(Dest, Op0, Op1, Ty); break;
2081 case Instruction::SDiv: Dest.IntVal = Op0.IntVal.sdiv(Op1.IntVal); break;
2082 case Instruction::UDiv: Dest.IntVal = Op0.IntVal.udiv(Op1.IntVal); break;
2083 case Instruction::URem: Dest.IntVal = Op0.IntVal.urem(Op1.IntVal); break;
2084 case Instruction::SRem: Dest.IntVal = Op0.IntVal.srem(Op1.IntVal); break;
2085 case Instruction::And: Dest.IntVal = Op0.IntVal & Op1.IntVal; break;
2086 case Instruction::Or: Dest.IntVal = Op0.IntVal | Op1.IntVal; break;
2087 case Instruction::Xor: Dest.IntVal = Op0.IntVal ^ Op1.IntVal; break;
2088 case Instruction::Shl:
2091 case Instruction::LShr:
2094 case Instruction::AShr:
2164 Instruction &I = *SF.CurInst++; // Increment before execute
lib/ExecutionEngine/Interpreter/Interpreter.h 170 void visitInstruction(Instruction &I) {
227 GenericValue executeCastOperation(Instruction::CastOps opcode, Value *SrcVal,
lib/ExecutionEngine/Orc/IndirectionUtils.cpp 223 ConstantExpr::getCast(Instruction::IntToPtr, AddrIntVal,
lib/FuzzMutate/IRMutator.cpp 107 SmallVector<Instruction *, 32> Insts;
154 auto RS = makeSampler<Instruction *>(IB.Rand);
155 for (Instruction &Inst : instructions(F)) {
172 void InstDeleterIRStrategy::mutate(Instruction &Inst, RandomIRBuilder &IB) {
186 SmallVector<Instruction *, 32> InstsBefore;
lib/FuzzMutate/Operations.cpp 19 Ops.push_back(binOpDescriptor(1, Instruction::Add));
20 Ops.push_back(binOpDescriptor(1, Instruction::Sub));
21 Ops.push_back(binOpDescriptor(1, Instruction::Mul));
22 Ops.push_back(binOpDescriptor(1, Instruction::SDiv));
23 Ops.push_back(binOpDescriptor(1, Instruction::UDiv));
24 Ops.push_back(binOpDescriptor(1, Instruction::SRem));
25 Ops.push_back(binOpDescriptor(1, Instruction::URem));
26 Ops.push_back(binOpDescriptor(1, Instruction::Shl));
27 Ops.push_back(binOpDescriptor(1, Instruction::LShr));
28 Ops.push_back(binOpDescriptor(1, Instruction::AShr));
29 Ops.push_back(binOpDescriptor(1, Instruction::And));
30 Ops.push_back(binOpDescriptor(1, Instruction::Or));
31 Ops.push_back(binOpDescriptor(1, Instruction::Xor));
33 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_EQ));
34 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_NE));
35 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_UGT));
36 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_UGE));
37 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_ULT));
38 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_ULE));
39 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_SGT));
40 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_SGE));
41 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_SLT));
42 Ops.push_back(cmpOpDescriptor(1, Instruction::ICmp, CmpInst::ICMP_SLE));
46 Ops.push_back(binOpDescriptor(1, Instruction::FAdd));
47 Ops.push_back(binOpDescriptor(1, Instruction::FSub));
48 Ops.push_back(binOpDescriptor(1, Instruction::FMul));
49 Ops.push_back(binOpDescriptor(1, Instruction::FDiv));
50 Ops.push_back(binOpDescriptor(1, Instruction::FRem));
52 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_FALSE));
53 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_OEQ));
54 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_OGT));
55 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_OGE));
56 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_OLT));
57 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_OLE));
58 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_ONE));
59 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_ORD));
60 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_UNO));
61 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_UEQ));
62 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_UGT));
63 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_UGE));
64 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_ULT));
65 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_ULE));
66 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_UNE));
67 Ops.push_back(cmpOpDescriptor(1, Instruction::FCmp, CmpInst::FCMP_TRUE));
92 Instruction::BinaryOps Op) {
97 case Instruction::Add:
98 case Instruction::Sub:
99 case Instruction::Mul:
100 case Instruction::SDiv:
101 case Instruction::UDiv:
102 case Instruction::SRem:
103 case Instruction::URem:
104 case Instruction::Shl:
105 case Instruction::LShr:
106 case Instruction::AShr:
107 case Instruction::And:
108 case Instruction::Or:
109 case Instruction::Xor:
111 case Instruction::FAdd:
112 case Instruction::FSub:
113 case Instruction::FMul:
114 case Instruction::FDiv:
115 case Instruction::FRem:
117 case Instruction::BinaryOpsEnd:
124 Instruction::OtherOps CmpOp,
131 case Instruction::ICmp:
133 case Instruction::FCmp:
lib/FuzzMutate/RandomIRBuilder.cpp 22 ArrayRef<Instruction *> Insts) {
27 ArrayRef<Instruction *> Insts,
36 if (Instruction *Src = RS.getSelection())
41 Value *RandomIRBuilder::newSource(BasicBlock &BB, ArrayRef<Instruction *> Insts,
52 if (auto *I = dyn_cast<Instruction>(Ptr)) {
52 if (auto *I = dyn_cast<Instruction>(Ptr)) {
70 static bool isCompatibleReplacement(const Instruction *I, const Use &Operand,
75 case Instruction::GetElementPtr:
76 case Instruction::ExtractElement:
77 case Instruction::ExtractValue:
83 case Instruction::InsertValue:
84 case Instruction::InsertElement:
85 case Instruction::ShuffleVector:
96 ArrayRef<Instruction *> Insts, Value *V) {
120 void RandomIRBuilder::newSink(BasicBlock &BB, ArrayRef<Instruction *> Insts,
134 ArrayRef<Instruction *> Insts,
lib/IR/AsmWriter.cpp 169 for (const Instruction &I : BB) {
286 for (const Instruction &I : BB)
291 for (const Instruction &I : BB)
325 if (const Instruction *I = dyn_cast<Instruction>(V)) {
325 if (const Instruction *I = dyn_cast<Instruction>(V)) {
335 if (isa<Instruction>(U))
818 void processInstructionMetadata(const Instruction &I);
868 if (const Instruction *I = dyn_cast<Instruction>(V))
868 if (const Instruction *I = dyn_cast<Instruction>(V))
1066 void SlotTracker::processInstructionMetadata(const Instruction &I) {
2408 void printInstructionLine(const Instruction &I);
2409 void printInstruction(const Instruction &I);
3607 for (const Instruction &I : *BB) {
3615 void AssemblyWriter::printInstructionLine(const Instruction &I) {
3640 static void maybePrintCallAddrSpace(const Value *Operand, const Instruction *I,
3658 void AssemblyWriter::printInstruction(const Instruction &I) {
4269 static bool isReferencingMDNode(const Instruction &I) {
4282 if (auto *I = dyn_cast<Instruction>(this))
4302 if (const Instruction *I = dyn_cast<Instruction>(this)) {
4302 if (const Instruction *I = dyn_cast<Instruction>(this)) {
lib/IR/AutoUpgrade.cpp 3505 cast<Instruction>(NewCall)->copyFastMathFlags(CI);
3516 cast<Instruction>(NewCall)->copyFastMathFlags(CI);
3765 Instruction *llvm::UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy,
3766 Instruction *&Temp) {
3767 if (Opc != Instruction::BitCast)
3779 Temp = CastInst::Create(Instruction::PtrToInt, V, MidTy);
3781 return CastInst::Create(Instruction::IntToPtr, Temp, DestTy);
3788 if (Opc != Instruction::BitCast)
3883 !CastInst::castIsValid(Instruction::BitCast, CI,
3897 if (!CastInst::castIsValid(Instruction::BitCast, Arg,
lib/IR/BasicBlock.cpp 95 std::function<bool(const Instruction &)> Fn = [](const Instruction &I) {
104 std::function<bool(Instruction &)> Fn = [](Instruction &I) {
144 const Instruction *BasicBlock::getTerminator() const {
157 const Instruction *Prev = RI->getPrevNode();
196 const Instruction* BasicBlock::getFirstNonPHI() const {
197 for (const Instruction &I : *this)
203 const Instruction* BasicBlock::getFirstNonPHIOrDbg() const {
204 for (const Instruction &I : *this)
210 const Instruction* BasicBlock::getFirstNonPHIOrDbgOrLifetime() const {
211 for (const Instruction &I : *this) {
224 const Instruction *FirstNonPHI = getFirstNonPHI();
234 for (Instruction &I : *this)
379 const Instruction *FirstNonPHI = getFirstNonPHI();
454 Instruction *TI = getTerminator();
480 const Instruction *TI = getTerminator();
lib/IR/ConstantFold.cpp 88 Instruction::CastOps firstOp = Instruction::CastOps(Op->getOpcode());
89 Instruction::CastOps secondOp = Instruction::CastOps(opc);
238 case Instruction::Or: {
253 case Instruction::And: {
267 case Instruction::LShr: {
290 case Instruction::Shl: {
313 case Instruction::ZExt: {
527 if (opc == Instruction::ZExt || opc == Instruction::SExt ||
527 if (opc == Instruction::ZExt || opc == Instruction::SExt ||
528 opc == Instruction::UIToFP || opc == Instruction::SIToFP)
528 opc == Instruction::UIToFP || opc == Instruction::SIToFP)
534 opc != Instruction::AddrSpaceCast)
544 } else if (CE->getOpcode() == Instruction::GetElementPtr &&
547 opc != Instruction::AddrSpaceCast &&
592 case Instruction::FPTrunc:
593 case Instruction::FPExt:
608 case Instruction::FPToUI:
609 case Instruction::FPToSI:
614 APSInt IntVal(DestBitWidth, opc == Instruction::FPToUI);
624 case Instruction::IntToPtr: //always treated as unsigned
628 case Instruction::PtrToInt: // always treated as unsigned
636 if (CE->getOpcode() == Instruction::GetElementPtr &&
681 case Instruction::UIToFP:
682 case Instruction::SIToFP:
687 apf.convertFromAPInt(api, opc==Instruction::SIToFP,
692 case Instruction::ZExt:
699 case Instruction::SExt:
706 case Instruction::Trunc: {
726 case Instruction::BitCast:
728 case Instruction::AddrSpaceCast:
775 if (TrueVal->getOpcode() == Instruction::Select)
780 if (FalseVal->getOpcode() == Instruction::Select)
805 if (CE->getOpcode() == Instruction::GetElementPtr) {
949 case Instruction::FNeg:
951 case Instruction::UnaryOpsEnd:
966 case Instruction::FNeg:
996 case Instruction::Xor:
1002 case Instruction::Add:
1003 case Instruction::Sub:
1005 case Instruction::And:
1009 case Instruction::Mul: {
1022 case Instruction::SDiv:
1023 case Instruction::UDiv:
1033 case Instruction::URem:
1034 case Instruction::SRem:
1043 case Instruction::Or: // X | undef -> -1
1047 case Instruction::LShr:
1056 case Instruction::AShr:
1066 case Instruction::Shl:
1075 case Instruction::FAdd:
1076 case Instruction::FSub:
1077 case Instruction::FMul:
1078 case Instruction::FDiv:
1079 case Instruction::FRem:
1091 case Instruction::BinaryOpsEnd:
1102 case Instruction::Add:
1105 case Instruction::Sub:
1108 case Instruction::Mul:
1113 case Instruction::UDiv:
1114 case Instruction::SDiv:
1120 case Instruction::URem:
1121 case Instruction::SRem:
1127 case Instruction::And:
1134 if (CE1->getOpcode() == Instruction::ZExt) {
1144 if (CE1->getOpcode() == Instruction::PtrToInt &&
1184 case Instruction::Or:
1189 case Instruction::Xor:
1195 case Instruction::ICmp:
1196 case Instruction::FCmp:
1206 case Instruction::AShr:
1209 if (CE1->getOpcode() == Instruction::ZExt) // Top bits known zero.
1215 if (Instruction::isCommutative(Opcode))
1226 case Instruction::Add:
1228 case Instruction::Sub:
1230 case Instruction::Mul:
1232 case Instruction::UDiv:
1235 case Instruction::SDiv:
1240 case Instruction::URem:
1243 case Instruction::SRem:
1248 case Instruction::And:
1250 case Instruction::Or:
1252 case Instruction::Xor:
1254 case Instruction::Shl:
1258 case Instruction::LShr:
1262 case Instruction::AShr:
1270 case Instruction::SDiv:
1271 case Instruction::UDiv:
1272 case Instruction::URem:
1273 case Instruction::SRem:
1274 case Instruction::LShr:
1275 case Instruction::AShr:
1276 case Instruction::Shl:
1290 case Instruction::FAdd:
1293 case Instruction::FSub:
1296 case Instruction::FMul:
1299 case Instruction::FDiv:
1302 case Instruction::FRem:
1317 if (Instruction::isIntDivRem(Opcode) && RHS->isNullValue())
1333 if (Instruction::isAssociative(Opcode) && CE1->getOpcode() == Opcode) {
1341 if (Instruction::isCommutative(Opcode))
1348 case Instruction::Add:
1349 case Instruction::Sub:
1351 case Instruction::Mul:
1353 case Instruction::Shl:
1354 case Instruction::LShr:
1355 case Instruction::AShr:
1359 case Instruction::SDiv:
1360 case Instruction::UDiv:
1364 case Instruction::URem:
1365 case Instruction::SRem:
1484 case Instruction::FPTrunc:
1485 case Instruction::FPExt:
1486 case Instruction::UIToFP:
1487 case Instruction::SIToFP:
1630 case Instruction::Trunc:
1631 case Instruction::FPTrunc:
1632 case Instruction::FPExt:
1633 case Instruction::FPToUI:
1634 case Instruction::FPToSI:
1637 case Instruction::UIToFP:
1638 case Instruction::SIToFP:
1639 case Instruction::BitCast:
1640 case Instruction::ZExt:
1641 case Instruction::SExt:
1649 if (CE1->getOpcode() == Instruction::ZExt) isSigned = false;
1650 if (CE1->getOpcode() == Instruction::SExt) isSigned = true;
1657 case Instruction::GetElementPtr: {
1718 case Instruction::GetElementPtr:
2082 if (CE2->getOpcode() == Instruction::BitCast &&
2092 if ((CE1->getOpcode() == Instruction::SExt &&
2094 (CE1->getOpcode() == Instruction::ZExt &&
2219 if (CE->getOpcode() == Instruction::GetElementPtr) {
2277 Combined = ConstantExpr::get(Instruction::Add, C1, C2);
2280 ConstantExpr::get(Instruction::Add, Idx0, Combined);
lib/IR/ConstantRange.cpp 225 ConstantRange::makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
243 case Instruction::Add: {
255 case Instruction::Sub: {
266 case Instruction::Mul:
273 case Instruction::Shl: {
296 ConstantRange ConstantRange::makeExactNoWrapRegion(Instruction::BinaryOps BinOp,
626 ConstantRange ConstantRange::castOp(Instruction::CastOps CastOp,
631 case Instruction::Trunc:
633 case Instruction::SExt:
635 case Instruction::ZExt:
637 case Instruction::BitCast:
639 case Instruction::FPToUI:
640 case Instruction::FPToSI:
645 case Instruction::UIToFP: {
652 case Instruction::SIToFP: {
659 case Instruction::FPTrunc:
660 case Instruction::FPExt:
661 case Instruction::IntToPtr:
662 case Instruction::PtrToInt:
663 case Instruction::AddrSpaceCast:
776 ConstantRange ConstantRange::binaryOp(Instruction::BinaryOps BinOp,
781 case Instruction::Add:
783 case Instruction::Sub:
785 case Instruction::Mul:
787 case Instruction::UDiv:
789 case Instruction::SDiv:
791 case Instruction::URem:
793 case Instruction::SRem:
795 case Instruction::Shl:
797 case Instruction::LShr:
799 case Instruction::AShr:
801 case Instruction::And:
803 case Instruction::Or:
807 case Instruction::FAdd:
809 case Instruction::FSub:
811 case Instruction::FMul:
819 ConstantRange ConstantRange::overflowingBinaryOp(Instruction::BinaryOps BinOp,
825 case Instruction::Add:
lib/IR/Constants.cpp 446 case Instruction::UDiv:
447 case Instruction::SDiv:
448 case Instruction::URem:
449 case Instruction::SRem:
521 if (CE->getOpcode() == Instruction::Sub) {
524 if (LHS && RHS && LHS->getOpcode() == Instruction::PtrToInt &&
525 RHS->getOpcode() == Instruction::PtrToInt) {
1177 return Instruction::isCast(getOpcode());
1181 return getOpcode() == Instruction::ICmp || getOpcode() == Instruction::FCmp;
1181 return getOpcode() == Instruction::ICmp || getOpcode() == Instruction::FCmp;
1185 if (getOpcode() != Instruction::GetElementPtr) return false;
1207 return getOpcode() == Instruction::ExtractValue ||
1208 getOpcode() == Instruction::InsertValue;
1247 case Instruction::Trunc:
1248 case Instruction::ZExt:
1249 case Instruction::SExt:
1250 case Instruction::FPTrunc:
1251 case Instruction::FPExt:
1252 case Instruction::UIToFP:
1253 case Instruction::SIToFP:
1254 case Instruction::FPToUI:
1255 case Instruction::FPToSI:
1256 case Instruction::PtrToInt:
1257 case Instruction::IntToPtr:
1258 case Instruction::BitCast:
1259 case Instruction::AddrSpaceCast:
1261 case Instruction::Select:
1263 case Instruction::InsertElement:
1266 case Instruction::ExtractElement:
1268 case Instruction::InsertValue:
1271 case Instruction::ExtractValue:
1273 case Instruction::ShuffleVector:
1276 case Instruction::GetElementPtr: {
1283 case Instruction::ICmp:
1284 case Instruction::FCmp:
1543 static Constant *getFoldedCast(Instruction::CastOps opc, Constant *C, Type *Ty,
1563 Instruction::CastOps opc = Instruction::CastOps(oc);
1571 case Instruction::Trunc:
1573 case Instruction::ZExt:
1575 case Instruction::SExt:
1577 case Instruction::FPTrunc:
1579 case Instruction::FPExt:
1581 case Instruction::UIToFP:
1583 case Instruction::SIToFP:
1585 case Instruction::FPToUI:
1587 case Instruction::FPToSI:
1589 case Instruction::PtrToInt:
1591 case Instruction::IntToPtr:
1593 case Instruction::BitCast:
1595 case Instruction::AddrSpaceCast:
1649 Instruction::CastOps opcode =
1650 (SrcBits == DstBits ? Instruction::BitCast :
1651 (SrcBits > DstBits ? Instruction::Trunc :
1652 (isSigned ? Instruction::SExt : Instruction::ZExt)));
1652 (isSigned ? Instruction::SExt : Instruction::ZExt)));
1663 Instruction::CastOps opcode =
1664 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt);
1664 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt);
1679 return getFoldedCast(Instruction::Trunc, C, Ty, OnlyIfReduced);
1693 return getFoldedCast(Instruction::SExt, C, Ty, OnlyIfReduced);
1707 return getFoldedCast(Instruction::ZExt, C, Ty, OnlyIfReduced);
1719 return getFoldedCast(Instruction::FPTrunc, C, Ty, OnlyIfReduced);
1731 return getFoldedCast(Instruction::FPExt, C, Ty, OnlyIfReduced);
1742 return getFoldedCast(Instruction::UIToFP, C, Ty, OnlyIfReduced);
1753 return getFoldedCast(Instruction::SIToFP, C, Ty, OnlyIfReduced);
1764 return getFoldedCast(Instruction::FPToUI, C, Ty, OnlyIfReduced);
1775 return getFoldedCast(Instruction::FPToSI, C, Ty, OnlyIfReduced);
1788 return getFoldedCast(Instruction::PtrToInt, C, DstTy, OnlyIfReduced);
1801 return getFoldedCast(Instruction::IntToPtr, C, DstTy, OnlyIfReduced);
1813 return getFoldedCast(Instruction::BitCast, C, DstTy, OnlyIfReduced);
1834 return getFoldedCast(Instruction::AddrSpaceCast, C, DstTy, OnlyIfReduced);
1845 case Instruction::FNeg:
1878 case Instruction::Add:
1879 case Instruction::Sub:
1880 case Instruction::Mul:
1881 case Instruction::UDiv:
1882 case Instruction::SDiv:
1883 case Instruction::URem:
1884 case Instruction::SRem:
1888 case Instruction::FAdd:
1889 case Instruction::FSub:
1890 case Instruction::FMul:
1891 case Instruction::FDiv:
1892 case Instruction::FRem:
1897 case Instruction::And:
1898 case Instruction::Or:
1899 case Instruction::Xor:
1903 case Instruction::Shl:
1904 case Instruction::LShr:
1905 case Instruction::AShr:
2001 ConstantExprKeyType Key(Instruction::Select, ArgVec);
2058 const ConstantExprKeyType Key(Instruction::GetElementPtr, ArgVec, 0,
2080 const ConstantExprKeyType Key(Instruction::ICmp, ArgVec, pred);
2105 const ConstantExprKeyType Key(Instruction::FCmp, ArgVec, pred);
2131 const ConstantExprKeyType Key(Instruction::ExtractElement, ArgVec);
2154 const ConstantExprKeyType Key(Instruction::InsertElement, ArgVec);
2177 const ConstantExprKeyType Key(Instruction::ShuffleVector, ArgVec);
2201 const ConstantExprKeyType Key(Instruction::InsertValue, ArgVec, 0, 0, Idxs);
2225 const ConstantExprKeyType Key(Instruction::ExtractValue, ArgVec, 0, 0, Idxs);
2241 return get(Instruction::FNeg, C);
2247 return get(Instruction::Xor, C, Constant::getAllOnesValue(C->getType()));
2254 return get(Instruction::Add, C1, C2, Flags);
2258 return get(Instruction::FAdd, C1, C2);
2265 return get(Instruction::Sub, C1, C2, Flags);
2269 return get(Instruction::FSub, C1, C2);
2276 return get(Instruction::Mul, C1, C2, Flags);
2280 return get(Instruction::FMul, C1, C2);
2284 return get(Instruction::UDiv, C1, C2,
2289 return get(Instruction::SDiv, C1, C2,
2294 return get(Instruction::FDiv, C1, C2);
2298 return get(Instruction::URem, C1, C2);
2302 return get(Instruction::SRem, C1, C2);
2306 return get(Instruction::FRem, C1, C2);
2310 return get(Instruction::And, C1, C2);
2314 return get(Instruction::Or, C1, C2);
2318 return get(Instruction::Xor, C1, C2);
2325 return get(Instruction::Shl, C1, C2, Flags);
2329 return get(Instruction::LShr, C1, C2,
2334 return get(Instruction::AShr, C1, C2,
2343 if (Instruction::isCommutative(Opcode)) {
2345 case Instruction::Add: // X + 0 = X
2346 case Instruction::Or: // X | 0 = X
2347 case Instruction::Xor: // X ^ 0 = X
2349 case Instruction::Mul: // X * 1 = X
2351 case Instruction::And: // X & -1 = X
2353 case Instruction::FAdd: // X + -0.0 = X
2356 case Instruction::FMul: // X * 1.0 = X
2368 case Instruction::Sub: // X - 0 = X
2369 case Instruction::Shl: // X << 0 = X
2370 case Instruction::LShr: // X >>u 0 = X
2371 case Instruction::AShr: // X >> 0 = X
2372 case Instruction::FSub: // X - 0.0 = X
2374 case Instruction::SDiv: // X / 1 = X
2375 case Instruction::UDiv: // X /u 1 = X
2377 case Instruction::FDiv: // X / 1.0 = X
2390 case Instruction::Or:
2393 case Instruction::And:
2394 case Instruction::Mul:
2405 return Instruction::getOpcodeName(getOpcode());
2410 : ConstantExpr(DestTy, Instruction::GetElementPtr,
2985 Instruction *ConstantExpr::getAsInstruction() {
2990 case Instruction::Trunc:
2991 case Instruction::ZExt:
2992 case Instruction::SExt:
2993 case Instruction::FPTrunc:
2994 case Instruction::FPExt:
2995 case Instruction::UIToFP:
2996 case Instruction::SIToFP:
2997 case Instruction::FPToUI:
2998 case Instruction::FPToSI:
2999 case Instruction::PtrToInt:
3000 case Instruction::IntToPtr:
3001 case Instruction::BitCast:
3002 case Instruction::AddrSpaceCast:
3005 case Instruction::Select:
3007 case Instruction::InsertElement:
3009 case Instruction::ExtractElement:
3011 case Instruction::InsertValue:
3013 case Instruction::ExtractValue:
3015 case Instruction::ShuffleVector:
3018 case Instruction::GetElementPtr: {
3026 case Instruction::ICmp:
3027 case Instruction::FCmp:
3030 case Instruction::FNeg:
lib/IR/ConstantsContext.h 86 : ConstantExpr(C2->getType(), Instruction::Select, &Op<0>(), 3) {
108 Instruction::ExtractElement, &Op<0>(), 2) {
128 : ConstantExpr(C1->getType(), Instruction::InsertElement,
153 Instruction::ShuffleVector,
176 : ConstantExpr(DestTy, Instruction::ExtractValue, &Op<0>(), 1),
193 return CE->getOpcode() == Instruction::ExtractValue;
207 : ConstantExpr(DestTy, Instruction::InsertValue, &Op<0>(), 2),
225 return CE->getOpcode() == Instruction::InsertValue;
258 return CE->getOpcode() == Instruction::GetElementPtr;
271 CompareConstantExpr(Type *ty, Instruction::OtherOps opc,
287 return CE->getOpcode() == Instruction::ICmp ||
288 CE->getOpcode() == Instruction::FCmp;
533 if (Instruction::isCast(Opcode) ||
534 (Opcode >= Instruction::UnaryOpsBegin &&
535 Opcode < Instruction::UnaryOpsEnd))
537 if ((Opcode >= Instruction::BinaryOpsBegin &&
538 Opcode < Instruction::BinaryOpsEnd))
542 case Instruction::Select:
544 case Instruction::ExtractElement:
546 case Instruction::InsertElement:
548 case Instruction::ShuffleVector:
550 case Instruction::InsertValue:
552 case Instruction::ExtractValue:
554 case Instruction::GetElementPtr:
560 case Instruction::ICmp:
561 return new CompareConstantExpr(Ty, Instruction::ICmp, SubclassData,
563 case Instruction::FCmp:
564 return new CompareConstantExpr(Ty, Instruction::FCmp, SubclassData,
lib/IR/Core.cpp 860 return unwrap<Instruction>(Inst)->hasMetadata();
864 auto *I = unwrap<Instruction>(Inst);
864 auto *I = unwrap<Instruction>(Inst);
888 unwrap<Instruction>(Inst)->setMetadata(KindID, N);
919 unwrap<Instruction>(Value)->getAllMetadata(Entries);
1221 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1221 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1245 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1245 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1268 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1268 if (const auto *I = dyn_cast<Instruction>(unwrap(Val))) {
1290 if (const auto *I = dyn_cast<Instruction>(unwrap(Val)))
1290 if (const auto *I = dyn_cast<Instruction>(unwrap(Val)))
2026 if (Instruction *Instr = dyn_cast<Instruction>(unwrap(Value))) {
2026 if (Instruction *Instr = dyn_cast<Instruction>(unwrap(Value))) {
2692 return wrap(unwrap<Instruction>(Inst)->getParent());
2712 Instruction *Instr = unwrap<Instruction>(Inst);
2712 Instruction *Instr = unwrap<Instruction>(Inst);
2720 Instruction *Instr = unwrap<Instruction>(Inst);
2720 Instruction *Instr = unwrap<Instruction>(Inst);
2728 unwrap<Instruction>(Inst)->removeFromParent();
2732 unwrap<Instruction>(Inst)->eraseFromParent();
2739 if (CE->getOpcode() == Instruction::ICmp)
2748 if (CE->getOpcode() == Instruction::FCmp)
2754 if (Instruction *C = dyn_cast<Instruction>(unwrap(Inst)))
2754 if (Instruction *C = dyn_cast<Instruction>(unwrap(Inst)))
2760 if (Instruction *C = dyn_cast<Instruction>(unwrap(Inst)))
2760 if (Instruction *C = dyn_cast<Instruction>(unwrap(Inst)))
2766 Instruction *I = dyn_cast<Instruction>(unwrap(Inst));
2766 Instruction *I = dyn_cast<Instruction>(unwrap(Inst));
2888 return unwrap<Instruction>(Term)->getNumSuccessors();
2892 return wrap(unwrap<Instruction>(Term)->getSuccessor(i));
2896 return unwrap<Instruction>(Term)->setSuccessor(i, unwrap(block));
2998 auto I = Instr ? unwrap<Instruction>(Instr)->getIterator() : BB->end();
3003 Instruction *I = unwrap<Instruction>(Instr);
3003 Instruction *I = unwrap<Instruction>(Instr);
3021 unwrap(Builder)->Insert(unwrap<Instruction>(Instr));
3026 unwrap(Builder)->Insert(unwrap<Instruction>(Instr), Name);
3059 unwrap(Builder)->SetInstDebugLocation(unwrap<Instruction>(Inst));
3425 Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(),
3436 Instruction* Malloc = CallInst::CreateMalloc(unwrap(B)->GetInsertBlock(),
lib/IR/DIBuilder.cpp 849 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
851 Instruction *InsertBefore) {
856 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
861 Instruction *InsertBefore = InsertAtEnd->getTerminator();
865 Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
866 Instruction *InsertBefore) {
872 Instruction *DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
877 Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
881 Instruction *InsertBefore) {
887 Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V,
899 Instruction *InsertBefore) {
919 Instruction *DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
921 BasicBlock *InsertBB, Instruction *InsertBefore) {
940 Instruction *DIBuilder::insertDbgValueIntrinsic(
942 const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) {
962 Instruction *DIBuilder::insertLabel(
964 BasicBlock *InsertBB, Instruction *InsertBefore) {
lib/IR/DebugInfo.cpp 71 for (const Instruction &I : BB)
107 const Instruction &I) {
323 Instruction &I = *II++; // We may delete the instruction, increment now.
335 auto *TermInst = BB.getTerminator();
596 cast<Instruction>(DbgVal->user_back())->eraseFromParent();
639 for (auto &I : BB) {
1353 unwrap<Instruction>(Instr)));
1374 unwrap<Instruction>(Instr)));
1434 return wrap(unwrap<Instruction>(Inst)->getDebugLoc().getAsMDNode());
1439 unwrap<Instruction>(Inst)->setDebugLoc(DebugLoc(unwrap<MDNode>(Loc)));
1441 unwrap<Instruction>(Inst)->setDebugLoc(DebugLoc());
lib/IR/DiagnosticInfo.cpp 53 DiagnosticInfoInlineAsm::DiagnosticInfoInlineAsm(const Instruction &I,
169 else if (auto *I = dyn_cast<Instruction>(V))
179 } else if (auto *I = dyn_cast<Instruction>(V))
241 const Instruction *Inst)
275 const Instruction *Inst)
296 const Instruction *Inst)
373 DiagnosticInfoMisExpect::DiagnosticInfoMisExpect(const Instruction *Inst,
lib/IR/Dominators.cpp 43 const Instruction *TI = Start->getTerminator();
115 bool DominatorTree::dominates(const Instruction *Def,
116 const Instruction *User) const {
152 bool DominatorTree::dominates(const Instruction *Def,
231 Instruction *UserInst = cast<Instruction>(U.getUser());
231 Instruction *UserInst = cast<Instruction>(U.getUser());
248 bool DominatorTree::dominates(const Instruction *Def, const Use &U) const {
249 Instruction *UserInst = cast<Instruction>(U.getUser());
249 Instruction *UserInst = cast<Instruction>(U.getUser());
300 Instruction *I = dyn_cast<Instruction>(U.getUser());
300 Instruction *I = dyn_cast<Instruction>(U.getUser());
lib/IR/Function.cpp 1457 for (const Instruction &I : instructions(this))
lib/IR/Globals.cpp 443 case Instruction::Add: {
450 case Instruction::Sub: {
455 case Instruction::IntToPtr:
456 case Instruction::PtrToInt:
457 case Instruction::BitCast:
458 case Instruction::GetElementPtr:
lib/IR/IRBuilder.cpp 77 Instruction *FMFSource = nullptr) {
705 CallInst *IRBuilderBase::CreateGCResult(Instruction *Statepoint,
717 CallInst *IRBuilderBase::CreateGCRelocate(Instruction *Statepoint,
734 Instruction *FMFSource,
743 Instruction *FMFSource,
753 Instruction *FMFSource,
lib/IR/Instruction.cpp 24 Instruction *InsertBefore)
67 iplist<Instruction>::iterator Instruction::eraseFromParent() {
73 void Instruction::insertBefore(Instruction *InsertPos) {
79 void Instruction::insertAfter(Instruction *InsertPos) {
86 void Instruction::moveBefore(Instruction *MovePos) {
90 void Instruction::moveAfter(Instruction *MovePos) {
95 SymbolTableList<Instruction>::iterator I) {
122 case Instruction::Add:
123 case Instruction::Sub:
124 case Instruction::Mul:
125 case Instruction::Shl:
130 case Instruction::UDiv:
131 case Instruction::SDiv:
132 case Instruction::AShr:
133 case Instruction::LShr:
137 case Instruction::GetElementPtr:
239 void Instruction::copyFastMathFlags(const Instruction *I) {
379 static bool haveSameSpecialState(const Instruction *I1, const Instruction *I2,
379 static bool haveSameSpecialState(const Instruction *I1, const Instruction *I2,
440 bool Instruction::isIdenticalTo(const Instruction *I) const {
445 bool Instruction::isIdenticalToWhenDefined(const Instruction *I) const {
471 bool Instruction::isSameOperationAs(const Instruction *I,
499 const Instruction *I = cast<Instruction>(U.getUser());
499 const Instruction *I = cast<Instruction>(U.getUser());
516 case Instruction::VAArg:
517 case Instruction::Load:
518 case Instruction::Fence: // FIXME: refine definition of mayReadFromMemory
519 case Instruction::AtomicCmpXchg:
520 case Instruction::AtomicRMW:
521 case Instruction::CatchPad:
522 case Instruction::CatchRet:
524 case Instruction::Call:
525 case Instruction::Invoke:
526 case Instruction::CallBr:
528 case Instruction::Store:
536 case Instruction::Fence: // FIXME: refine definition of mayWriteToMemory
537 case Instruction::Store:
538 case Instruction::VAArg:
539 case Instruction::AtomicCmpXchg:
540 case Instruction::AtomicRMW:
541 case Instruction::CatchPad:
542 case Instruction::CatchRet:
544 case Instruction::Call:
545 case Instruction::Invoke:
546 case Instruction::CallBr:
548 case Instruction::Load:
557 case Instruction::AtomicCmpXchg:
558 case Instruction::AtomicRMW:
559 case Instruction::Fence:
561 case Instruction::Load:
563 case Instruction::Store:
573 case Instruction::AtomicCmpXchg:
574 case Instruction::AtomicRMW:
575 case Instruction::Load:
585 case Instruction::AtomicCmpXchg:
586 case Instruction::AtomicRMW:
587 case Instruction::Store:
615 const Instruction *Instruction::getNextNonDebugInstruction() const {
616 for (const Instruction *I = getNextNode(); I; I = I->getNextNode())
622 const Instruction *Instruction::getPrevNonDebugInstruction() const {
623 for (const Instruction *I = getPrevNode(); I; I = I->getPrevNode())
687 Instruction *Instruction::cloneImpl() const {
708 void Instruction::copyMetadata(const Instruction &SrcInst,
729 Instruction *Instruction::clone() const {
730 Instruction *New = nullptr;
lib/IR/Instructions.cpp 107 : Instruction(PN.getType(), Instruction::PHI, nullptr, PN.getNumOperands()),
194 const Twine &NameStr, Instruction *InsertBefore)
195 : Instruction(RetTy, Instruction::LandingPad, nullptr, 0, InsertBefore) {
201 : Instruction(RetTy, Instruction::LandingPad, nullptr, 0, InsertAtEnd) {
206 : Instruction(LP.getType(), Instruction::LandingPad, nullptr,
220 Instruction *InsertBefore) {
423 Instruction *InsertBefore)
424 : CallBase(Ty->getReturnType(), Instruction::Call,
431 : CallBase(Ty->getReturnType(), Instruction::Call,
437 : CallBase(CI.Attrs, CI.FTy, CI.getType(), Instruction::Call,
450 Instruction *InsertPt) {
522 static Instruction *createMalloc(Instruction *InsertBefore,
522 static Instruction *createMalloc(Instruction *InsertBefore,
576 Instruction *Result = nullptr;
610 Instruction *CallInst::CreateMalloc(Instruction *InsertBefore,
610 Instruction *CallInst::CreateMalloc(Instruction *InsertBefore,
618 Instruction *CallInst::CreateMalloc(Instruction *InsertBefore,
618 Instruction *CallInst::CreateMalloc(Instruction *InsertBefore,
636 Instruction *CallInst::CreateMalloc(BasicBlock *InsertAtEnd,
643 Instruction *CallInst::CreateMalloc(BasicBlock *InsertAtEnd,
652 static Instruction *createFree(Value *Source,
654 Instruction *InsertBefore,
687 Instruction *CallInst::CreateFree(Value *Source, Instruction *InsertBefore) {
687 Instruction *CallInst::CreateFree(Value *Source, Instruction *InsertBefore) {
690 Instruction *CallInst::CreateFree(Value *Source,
692 Instruction *InsertBefore) {
699 Instruction *CallInst::CreateFree(Value *Source, BasicBlock *InsertAtEnd) {
700 Instruction *FreeCall = createFree(Source, None, nullptr, InsertAtEnd);
704 Instruction *CallInst::CreateFree(Value *Source,
707 Instruction *FreeCall = createFree(Source, Bundles, nullptr, InsertAtEnd);
750 : CallBase(II.Attrs, II.FTy, II.getType(), Instruction::Invoke,
761 Instruction *InsertPt) {
832 : CallBase(CBI.Attrs, CBI.FTy, CBI.getType(), Instruction::CallBr,
844 Instruction *InsertPt) {
865 : Instruction(Type::getVoidTy(RI.getContext()), Instruction::Ret,
873 ReturnInst::ReturnInst(LLVMContext &C, Value *retVal, Instruction *InsertBefore)
874 : Instruction(Type::getVoidTy(C), Instruction::Ret,
882 : Instruction(Type::getVoidTy(C), Instruction::Ret,
890 : Instruction(Type::getVoidTy(Context), Instruction::Ret,
898 : Instruction(Type::getVoidTy(RI.getContext()), Instruction::Resume,
903 ResumeInst::ResumeInst(Value *Exn, Instruction *InsertBefore)
904 : Instruction(Type::getVoidTy(Exn->getContext()), Instruction::Resume,
910 : Instruction(Type::getVoidTy(Exn->getContext()), Instruction::Resume,
920 : Instruction(CRI.getType(), Instruction::CleanupRet,
940 unsigned Values, Instruction *InsertBefore)
942 Instruction::CleanupRet,
951 Instruction::CleanupRet,
966 : Instruction(Type::getVoidTy(CRI.getContext()), Instruction::CatchRet,
973 Instruction *InsertBefore)
974 : Instruction(Type::getVoidTy(BB->getContext()), Instruction::CatchRet,
982 : Instruction(Type::getVoidTy(BB->getContext()), Instruction::CatchRet,
995 Instruction *InsertBefore)
996 : Instruction(ParentPad->getType(), Instruction::CatchSwitch, nullptr, 0,
1007 : Instruction(ParentPad->getType(), Instruction::CatchSwitch, nullptr, 0,
1016 : Instruction(CSI.getType(), Instruction::CatchSwitch, nullptr,
1091 FuncletPadInst::FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
1093 const Twine &NameStr, Instruction *InsertBefore)
1100 FuncletPadInst::FuncletPadInst(Instruction::FuncletPadOps Op, Value *ParentPad,
1114 Instruction *InsertBefore)
1115 : Instruction(Type::getVoidTy(Context), Instruction::Unreachable, nullptr,
1118 : Instruction(Type::getVoidTy(Context), Instruction::Unreachable, nullptr,
1131 BranchInst::BranchInst(BasicBlock *IfTrue, Instruction *InsertBefore)
1132 : Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br,
1140 Instruction *InsertBefore)
1141 : Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br,
1153 : Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br,
1161 : Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br,
1172 : Instruction(Type::getVoidTy(BI.getContext()), Instruction::Br,
1211 Instruction *InsertBefore)
1219 const Twine &Name, Instruction *InsertBefore)
1229 Instruction *InsertBefore)
1291 Instruction *InsertBef)
1299 Instruction *InsertBef)
1307 MaybeAlign Align, Instruction *InsertBef)
1318 Instruction *InsertBef)
1367 StoreInst::StoreInst(Value *val, Value *addr, Instruction *InsertBefore)
1374 Instruction *InsertBefore)
1382 Instruction *InsertBefore)
1393 Instruction *InsertBefore)
1472 Instruction *InsertBefore)
1519 Instruction *InsertBefore)
1579 Instruction *InsertBefore)
1706 Instruction *InsertBef)
1745 Instruction *InsertBef)
1791 Instruction *InsertBefore)
1884 if (CE->getOpcode() == Instruction::UserOp1)
2193 Instruction *InsertBefore)
2211 Instruction *InsertBefore) {
2246 Instruction *InsertBefore)
2340 Instruction *InsertBefore) {
2355 Instruction *InsertBefore) {
2357 return new BinaryOperator(Instruction::Sub,
2365 return new BinaryOperator(Instruction::Sub,
2371 Instruction *InsertBefore) {
2383 Instruction *InsertBefore) {
2395 Instruction *InsertBefore) {
2397 return new BinaryOperator(Instruction::FSub, zero, Op,
2404 return new BinaryOperator(Instruction::FSub, zero, Op,
2409 Instruction *InsertBefore) {
2411 return new BinaryOperator(Instruction::Xor, Op, C,
2418 return new BinaryOperator(Instruction::Xor, Op, AllOnes,
2439 cast<Instruction>(this)->getMetadata(LLVMContext::MD_fpmath);
2454 case Instruction::ZExt:
2455 case Instruction::SExt:
2456 case Instruction::Trunc:
2458 case Instruction::BitCast:
2466 if (getOpcode() != Instruction::BitCast)
2489 bool CastInst::isNoopCast(Instruction::CastOps Opcode,
2495 case Instruction::Trunc:
2496 case Instruction::ZExt:
2497 case Instruction::SExt:
2498 case Instruction::FPTrunc:
2499 case Instruction::FPExt:
2500 case Instruction::UIToFP:
2501 case Instruction::SIToFP:
2502 case Instruction::FPToUI:
2503 case Instruction::FPToSI:
2504 case Instruction::AddrSpaceCast:
2507 case Instruction::BitCast:
2509 case Instruction::PtrToInt:
2512 case Instruction::IntToPtr:
2531 Instruction::CastOps firstOp, Instruction::CastOps secondOp,
2531 Instruction::CastOps firstOp, Instruction::CastOps secondOp,
2565 Instruction::CastOpsEnd - Instruction::CastOpsBegin;
2565 Instruction::CastOpsEnd - Instruction::CastOpsBegin;
2591 bool IsFirstBitcast = (firstOp == Instruction::BitCast);
2592 bool IsSecondBitcast = (secondOp == Instruction::BitCast);
2601 int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin]
2602 [secondOp-Instruction::CastOpsBegin];
2649 return Instruction::BitCast;
2656 return Instruction::BitCast;
2666 return Instruction::BitCast;
2673 return Instruction::ZExt;
2682 return Instruction::BitCast;
2689 return Instruction::AddrSpaceCast;
2690 return Instruction::BitCast;
2709 return Instruction::AddrSpaceCast;
2737 return Instruction::UIToFP;
2747 CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty,
2748 const Twine &Name, Instruction *InsertBefore) {
2769 CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty,
2793 Instruction *InsertBefore) {
2795 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2796 return Create(Instruction::ZExt, S, Ty, Name, InsertBefore);
2803 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2804 return Create(Instruction::ZExt, S, Ty, Name, InsertAtEnd);
2809 Instruction *InsertBefore) {
2811 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2812 return Create(Instruction::SExt, S, Ty, Name, InsertBefore);
2819 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2820 return Create(Instruction::SExt, S, Ty, Name, InsertAtEnd);
2825 Instruction *InsertBefore) {
2827 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2828 return Create(Instruction::Trunc, S, Ty, Name, InsertBefore);
2835 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2836 return Create(Instruction::Trunc, S, Ty, Name, InsertAtEnd);
2851 return Create(Instruction::PtrToInt, S, Ty, Name, InsertAtEnd);
2859 Instruction *InsertBefore) {
2869 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2882 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertAtEnd);
2884 return Create(Instruction::BitCast, S, Ty, Name, InsertAtEnd);
2890 Instruction *InsertBefore) {
2895 return Create(Instruction::AddrSpaceCast, S, Ty, Name, InsertBefore);
2897 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2902 Instruction *InsertBefore) {
2904 return Create(Instruction::PtrToInt, S, Ty, Name, InsertBefore);
2906 return Create(Instruction::IntToPtr, S, Ty, Name, InsertBefore);
2908 return Create(Instruction::BitCast, S, Ty, Name, InsertBefore);
2913 Instruction *InsertBefore) {
2918 Instruction::CastOps opcode =
2919 (SrcBits == DstBits ? Instruction::BitCast :
2920 (SrcBits > DstBits ? Instruction::Trunc :
2921 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2921 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2932 Instruction::CastOps opcode =
2933 (SrcBits == DstBits ? Instruction::BitCast :
2934 (SrcBits > DstBits ? Instruction::Trunc :
2935 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2935 (isSigned ? Instruction::SExt : Instruction::ZExt)));
2941 Instruction *InsertBefore) {
2946 Instruction::CastOps opcode =
2947 (SrcBits == DstBits ? Instruction::BitCast :
2948 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2948 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2959 Instruction::CastOps opcode =
2960 (SrcBits == DstBits ? Instruction::BitCast :
2961 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
2961 (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt));
3084 Instruction::CastOps
3188 CastInst::castIsValid(Instruction::CastOps op, Value *S, Type *DstTy) {
3211 case Instruction::Trunc:
3214 case Instruction::ZExt:
3217 case Instruction::SExt:
3220 case Instruction::FPTrunc:
3223 case Instruction::FPExt:
3226 case Instruction::UIToFP:
3227 case Instruction::SIToFP:
3230 case Instruction::FPToUI:
3231 case Instruction::FPToSI:
3234 case Instruction::PtrToInt:
3241 case Instruction::IntToPtr:
3248 case Instruction::BitCast: {
3278 case Instruction::AddrSpaceCast: {
3303 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3315 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3326 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3338 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3350 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3362 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3374 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3386 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3398 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3410 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3422 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3434 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3446 Value *S, Type *Ty, const Twine &Name, Instruction *InsertBefore
3462 Value *RHS, const Twine &Name, Instruction *InsertBefore,
3463 Instruction *FlagsSource)
3490 const Twine &Name, Instruction *InsertBefore) {
3491 if (Op == Instruction::ICmp) {
3511 if (Op == Instruction::ICmp) {
3811 Instruction *InsertBefore)
3812 : Instruction(Type::getVoidTy(Value->getContext()), Instruction::Switch,
3823 : Instruction(Type::getVoidTy(Value->getContext()), Instruction::Switch,
3829 : Instruction(SI.getType(), Instruction::Switch, nullptr, 0) {
3970 SymbolTableList<Instruction>::iterator
4042 Instruction *InsertBefore)
4044 Instruction::IndirectBr, nullptr, 0, InsertBefore) {
4051 Instruction::IndirectBr, nullptr, 0, InsertAtEnd) {
4056 : Instruction(Type::getVoidTy(IBI.getContext()), Instruction::IndirectBr,
lib/IR/IntrinsicInst.cpp 226 Instruction::BinaryOps BinaryOpIntrinsic::getBinaryOp() const {
232 return Instruction::Add;
237 return Instruction::Sub;
240 return Instruction::Mul;
lib/IR/LLVMContext.cpp 180 void LLVMContext::emitError(const Instruction *I, const Twine &ErrorStr) {
lib/IR/LLVMContextImpl.h 1351 DenseMap<const Instruction *, MDAttachmentMap> InstructionMetadata;
lib/IR/Metadata.cpp 339 if (BasicBlock *BB = cast<Instruction>(V)->getParent()) {
lib/IR/SafepointIRVerifier.cpp 136 const Instruction *TI = BB->getTerminator();
450 DenseSet<const Instruction *> ValidUnrelocatedDefs;
484 bool instructionMayBeSkipped(const Instruction *I) const;
515 static void transferInstruction(const Instruction &I, bool &Cleared,
526 void verifyInstruction(const GCPtrTracker *Tracker, const Instruction &I,
532 void reportInvalidUse(const Value &V, const Instruction &I);
543 for (const auto &I : BB)
571 bool GCPtrTracker::instructionMayBeSkipped(const Instruction *I) const {
590 for (const Instruction &I : *BB) {
654 for (const Instruction &I : *BB) {
782 void GCPtrTracker::transferInstruction(const Instruction &I, bool &Cleared,
792 const GCPtrTracker *Tracker, const Instruction &I,
874 const Instruction &I) {
lib/IR/SymbolTableListTraitsImpl.h 95 ValueSubClass &V = *first;
lib/IR/TypeFinder.cpp 61 for (const Instruction &I : BB) {
68 if (&*O && !isa<Instruction>(&*O))
139 if (isa<Instruction>(V))
lib/IR/Value.cpp 60 if (SubclassID == Instruction::Call || SubclassID == Instruction::Invoke ||
60 if (SubclassID == Instruction::Call || SubclassID == Instruction::Invoke ||
61 SubclassID == Instruction::CallBr)
153 const auto *User = dyn_cast<Instruction>(*UI);
153 const auto *User = dyn_cast<Instruction>(*UI);
166 if (Instruction *I = dyn_cast<Instruction>(V)) {
166 if (Instruction *I = dyn_cast<Instruction>(V)) {
448 auto *I = dyn_cast<Instruction>(U.getUser());
448 auto *I = dyn_cast<Instruction>(U.getUser());
495 } else if (Operator::getOpcode(V) == Instruction::BitCast) {
498 Operator::getOpcode(V) == Instruction::AddrSpaceCast) {
588 } else if (Operator::getOpcode(V) == Instruction::BitCast ||
589 Operator::getOpcode(V) == Instruction::AddrSpaceCast) {
lib/IR/Verifier.cpp 148 if (isa<Instruction>(V)) {
262 SmallPtrSet<Instruction *, 16> InstsInThisBlock;
292 MapVector<Instruction *, Instruction *> SiblingFuncletInfo;
292 MapVector<Instruction *, Instruction *> SiblingFuncletInfo;
311 void checkAtomicMemAccessSize(Type *Ty, const Instruction *I);
419 void visitRangeMetadata(Instruction &I, MDNode *Range, Type *Ty);
420 void visitDereferenceableMetadata(Instruction &I, MDNode *MD);
421 void visitProfMetadata(Instruction &I, MDNode *MD);
435 void visit(Instruction &I);
465 void verifyDominatesUse(Instruction &I, unsigned i);
466 void visitInstruction(Instruction &I);
467 void visitTerminator(Instruction &I);
474 void visitUserOp1(Instruction &I);
475 void visitUserOp2(Instruction &I) { visitUserOp1(I); }
486 void visitEHPadPredecessors(Instruction &I);
545 void Verifier::visit(Instruction &I) {
601 if (const Instruction *I = dyn_cast<Instruction>(V)) {
601 if (const Instruction *I = dyn_cast<Instruction>(V)) {
840 if (Instruction *I = dyn_cast<Instruction>(L->getValue())) {
840 if (Instruction *I = dyn_cast<Instruction>(L->getValue())) {
1912 if (CE->getOpcode() == Instruction::BitCast)
1917 if (CE->getOpcode() == Instruction::IntToPtr ||
1918 CE->getOpcode() == Instruction::PtrToInt) {
1919 auto *PtrTy = CE->getOpcode() == Instruction::IntToPtr
1922 StringRef Msg = CE->getOpcode() == Instruction::IntToPtr
2079 static Instruction *getSuccPad(Instruction *Terminator) {
2079 static Instruction *getSuccPad(Instruction *Terminator) {
2091 SmallPtrSet<Instruction *, 8> Visited;
2092 SmallPtrSet<Instruction *, 8> Active;
2094 Instruction *PredPad = Pair.first;
2098 Instruction *Terminator = Pair.second;
2100 Instruction *SuccPad = getSuccPad(Terminator);
2103 Instruction *CyclePad = SuccPad;
2104 SmallVector<Instruction *, 8> CycleNodes;
2107 Instruction *CycleTerminator = SiblingFuncletInfo[CyclePad];
2427 for (auto &I : BB)
2433 void Verifier::visitTerminator(Instruction &I) {
2534 void Verifier::visitUserOp1(Instruction &I) {
3095 Instruction *Next = CI.getNextNode();
3144 case Instruction::FNeg:
3165 case Instruction::Add:
3166 case Instruction::Sub:
3167 case Instruction::Mul:
3168 case Instruction::SDiv:
3169 case Instruction::UDiv:
3170 case Instruction::SRem:
3171 case Instruction::URem:
3181 case Instruction::FAdd:
3182 case Instruction::FSub:
3183 case Instruction::FMul:
3184 case Instruction::FDiv:
3185 case Instruction::FRem:
3196 case Instruction::And:
3197 case Instruction::Or:
3198 case Instruction::Xor:
3205 case Instruction::Shl:
3206 case Instruction::LShr:
3207 case Instruction::AShr:
3321 void Verifier::visitRangeMetadata(Instruction &I, MDNode *Range, Type *Ty) {
3369 void Verifier::checkAtomicMemAccessSize(Type *Ty, const Instruction *I) {
3586 void Verifier::visitEHPadPredecessors(Instruction &I) {
3621 Instruction *ToPad = &I;
3624 Instruction *TI = PredBB->getTerminator();
3809 if (!cast<Instruction>(UnwindPad)->isEHPad())
3861 SiblingFuncletInfo[&FPI] = cast<Instruction>(U);
3942 Instruction *I = UnwindDest->getFirstNonPHI();
3971 Instruction *I = UnwindDest->getFirstNonPHI();
3981 void Verifier::verifyDominatesUse(Instruction &I, unsigned i) {
3982 Instruction *Op = cast<Instruction>(I.getOperand(i));
3982 Instruction *Op = cast<Instruction>(I.getOperand(i));
4006 void Verifier::visitDereferenceableMetadata(Instruction& I, MDNode* MD) {
4019 void Verifier::visitProfMetadata(Instruction &I, MDNode *MD) {
4060 void Verifier::visitInstruction(Instruction &I) {
4089 if (Instruction *Used = dyn_cast<Instruction>(U.getUser()))
4089 if (Instruction *Used = dyn_cast<Instruction>(U.getUser()))
4142 } else if (isa<Instruction>(I.getOperand(i))) {
5205 TBAAVerifier::verifyTBAABaseNode(Instruction &I, const MDNode *BaseNode,
5224 TBAAVerifier::verifyTBAABaseNodeImpl(Instruction &I, const MDNode *BaseNode,
5375 MDNode *TBAAVerifier::getFieldNodeFromTBAABaseNode(Instruction &I,
5428 bool TBAAVerifier::visitTBAAMetadata(Instruction &I, const MDNode *MD) {
lib/ProfileData/InstrProf.cpp 931 void annotateValueSite(Module &M, Instruction &Inst,
947 void annotateValueSite(Module &M, Instruction &Inst,
976 bool getValueProfDataFromInst(const Instruction &Inst,
lib/Target/AArch64/AArch64FalkorHWPFFix.cpp 154 for (Instruction &I : *BB) {
lib/Target/AArch64/AArch64FastISel.cpp 157 bool selectAddSub(const Instruction *I);
158 bool selectLogicalOp(const Instruction *I);
159 bool selectLoad(const Instruction *I);
160 bool selectStore(const Instruction *I);
161 bool selectBranch(const Instruction *I);
162 bool selectIndirectBr(const Instruction *I);
163 bool selectCmp(const Instruction *I);
164 bool selectSelect(const Instruction *I);
165 bool selectFPExt(const Instruction *I);
166 bool selectFPTrunc(const Instruction *I);
167 bool selectFPToInt(const Instruction *I, bool Signed);
168 bool selectIntToFP(const Instruction *I, bool Signed);
169 bool selectRem(const Instruction *I, unsigned ISDOpcode);
170 bool selectRet(const Instruction *I);
171 bool selectTrunc(const Instruction *I);
172 bool selectIntExt(const Instruction *I);
173 bool selectMul(const Instruction *I);
174 bool selectShift(const Instruction *I);
175 bool selectBitCast(const Instruction *I);
176 bool selectFRem(const Instruction *I);
177 bool selectSDiv(const Instruction *I);
178 bool selectGetElementPtr(const Instruction *I);
194 bool foldXALUIntrinsic(AArch64CC::CondCode &CC, const Instruction *I,
196 bool optimizeIntExtLoad(const Instruction *I, MVT RetVT, MVT SrcVT);
300 bool fastSelectInstruction(const Instruction *I) override;
308 static bool isIntExtFree(const Instruction *I) {
582 unsigned Opcode = Instruction::UserOp1;
583 if (const Instruction *I = dyn_cast<Instruction>(Obj)) {
583 if (const Instruction *I = dyn_cast<Instruction>(Obj)) {
605 case Instruction::BitCast:
609 case Instruction::IntToPtr:
616 case Instruction::PtrToInt:
622 case Instruction::GetElementPtr: {
669 case Instruction::Alloca: {
680 case Instruction::Add: {
700 case Instruction::Sub: {
711 case Instruction::Shl: {
738 if (const auto *I = dyn_cast<Instruction>(Src)) {
738 if (const auto *I = dyn_cast<Instruction>(Src)) {
758 if (AI->getOpcode() == Instruction::And) {
786 case Instruction::Mul: {
822 if (const auto *I = dyn_cast<Instruction>(Src)) {
822 if (const auto *I = dyn_cast<Instruction>(Src)) {
847 case Instruction::And: {
878 case Instruction::SExt:
879 case Instruction::ZExt: {
930 unsigned Opcode = Instruction::UserOp1;
933 if (const auto *I = dyn_cast<Instruction>(V)) {
933 if (const auto *I = dyn_cast<Instruction>(V)) {
944 case Instruction::BitCast:
949 case Instruction::IntToPtr:
956 case Instruction::PtrToInt:
1017 if (!isa<Instruction>(V))
1020 const auto *I = cast<Instruction>(V);
1020 const auto *I = cast<Instruction>(V);
1199 if (SI->getOpcode() == Instruction::Shl ||
1200 SI->getOpcode() == Instruction::LShr ||
1201 SI->getOpcode() == Instruction::AShr )
1234 if ((SI->getOpcode() == Instruction::Shl) && (C->getZExtValue() < 4)) {
1282 case Instruction::Shl: ShiftType = AArch64_AM::LSL; break;
1283 case Instruction::LShr: ShiftType = AArch64_AM::LSR; break;
1284 case Instruction::AShr: ShiftType = AArch64_AM::ASR; break;
1922 bool AArch64FastISel::selectAddSub(const Instruction *I) {
1934 case Instruction::Add:
1937 case Instruction::Sub:
1948 bool AArch64FastISel::selectLogicalOp(const Instruction *I) {
1960 case Instruction::And:
1963 case Instruction::Or:
1966 case Instruction::Xor:
1977 bool AArch64FastISel::selectLoad(const Instruction *I) {
2179 bool AArch64FastISel::selectStore(const Instruction *I) {
2339 if (AI->getOpcode() == Instruction::And && isValueAvailable(AI)) {
2420 bool AArch64FastISel::selectBranch(const Instruction *I) {
2550 bool AArch64FastISel::selectIndirectBr(const Instruction *I) {
2568 bool AArch64FastISel::selectCmp(const Instruction *I) {
2709 bool AArch64FastISel::selectSelect(const Instruction *I) {
2839 bool AArch64FastISel::selectFPExt(const Instruction *I) {
2855 bool AArch64FastISel::selectFPTrunc(const Instruction *I) {
2872 bool AArch64FastISel::selectFPToInt(const Instruction *I, bool Signed) {
2905 bool AArch64FastISel::selectIntToFP(const Instruction *I, bool Signed) {
3382 const Instruction *I,
3834 bool AArch64FastISel::selectRet(const Instruction *I) {
3940 bool AArch64FastISel::selectTrunc(const Instruction *I) {
4524 bool AArch64FastISel::optimizeIntExtLoad(const Instruction *I, MVT RetVT,
4578 bool AArch64FastISel::selectIntExt(const Instruction *I) {
4632 bool AArch64FastISel::selectRem(const Instruction *I, unsigned ISDOpcode) {
4678 bool AArch64FastISel::selectMul(const Instruction *I) {
4751 bool AArch64FastISel::selectShift(const Instruction *I) {
4763 bool IsZExt = I->getOpcode() != Instruction::AShr;
4792 case Instruction::Shl:
4795 case Instruction::AShr:
4798 case Instruction::LShr:
4822 case Instruction::Shl:
4825 case Instruction::AShr:
4828 case Instruction::LShr:
4840 bool AArch64FastISel::selectBitCast(const Instruction *I) {
4881 bool AArch64FastISel::selectFRem(const Instruction *I) {
4919 bool AArch64FastISel::selectSDiv(const Instruction *I) {
5013 bool AArch64FastISel::selectGetElementPtr(const Instruction *I) {
5149 bool AArch64FastISel::fastSelectInstruction(const Instruction *I) {
5153 case Instruction::Add:
5154 case Instruction::Sub:
5156 case Instruction::Mul:
5158 case Instruction::SDiv:
5160 case Instruction::SRem:
5164 case Instruction::URem:
5168 case Instruction::Shl:
5169 case Instruction::LShr:
5170 case Instruction::AShr:
5172 case Instruction::And:
5173 case Instruction::Or:
5174 case Instruction::Xor:
5176 case Instruction::Br:
5178 case Instruction::IndirectBr:
5180 case Instruction::BitCast:
5184 case Instruction::FPToSI:
5188 case Instruction::FPToUI:
5190 case Instruction::ZExt:
5191 case Instruction::SExt:
5193 case Instruction::Trunc:
5197 case Instruction::FPExt:
5199 case Instruction::FPTrunc:
5201 case Instruction::SIToFP:
5205 case Instruction::UIToFP:
5207 case Instruction::Load:
5209 case Instruction::Store:
5211 case Instruction::FCmp:
5212 case Instruction::ICmp:
5214 case Instruction::Select:
5216 case Instruction::Ret:
5218 case Instruction::FRem:
5220 case Instruction::GetElementPtr:
5222 case Instruction::AtomicCmpXchg:
lib/Target/AArch64/AArch64ISelLowering.cpp 8512 bool AArch64TargetLowering::isProfitableToHoist(Instruction *I) const {
8513 if (I->getOpcode() != Instruction::FMul)
8519 Instruction *User = I->user_back();
8522 !(User->getOpcode() == Instruction::FSub ||
8523 User->getOpcode() == Instruction::FAdd))
8568 bool AArch64TargetLowering::isExtFreeImpl(const Instruction *Ext) const {
8581 const Instruction *Instr = cast<Instruction>(U.getUser());
8581 const Instruction *Instr = cast<Instruction>(U.getUser());
8585 case Instruction::Shl:
8589 case Instruction::GetElementPtr: {
8606 case Instruction::Trunc:
8672 !areExtDoubled(cast<Instruction>(Ext1)) ||
8673 !areExtDoubled(cast<Instruction>(Ext2)))
8683 Instruction *I, SmallVectorImpl<Use *> &Ops) const {
8701 case Instruction::Sub:
8702 case Instruction::Add: {
8708 auto Ext1 = cast<Instruction>(I->getOperand(0));
8709 auto Ext2 = cast<Instruction>(I->getOperand(1));
8746 AArch64TargetLowering::getMMOFlags(const Instruction &I) const {
9119 unsigned AS, Instruction *I) const {
12335 const Instruction &AndI) const {
lib/Target/AArch64/AArch64ISelLowering.h 349 bool isProfitableToHoist(Instruction *I) const override;
355 bool shouldSinkOperands(Instruction *I,
386 Instruction *I = nullptr) const override;
488 bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override;
565 MachineMemOperand::Flags getMMOFlags(const Instruction &I) const override;
577 bool isExtFreeImpl(const Instruction *Ext) const override;
lib/Target/AArch64/AArch64PromoteConstant.cpp 103 Instruction *User;
106 UpdateRecord(Constant *C, Instruction *User, unsigned Op)
146 using Uses = SmallVector<std::pair<Instruction *, unsigned>, 4>;
148 using InsertionPoints = DenseMap<Instruction *, Uses>;
151 Instruction *findInsertionPoint(Instruction &User, unsigned OpNo);
151 Instruction *findInsertionPoint(Instruction &User, unsigned OpNo);
164 bool isDominated(Instruction *NewPt, Instruction *User, unsigned OpNo,
164 bool isDominated(Instruction *NewPt, Instruction *User, unsigned OpNo,
180 bool tryAndMerge(Instruction *NewPt, Instruction *User, unsigned OpNo,
180 bool tryAndMerge(Instruction *NewPt, Instruction *User, unsigned OpNo,
190 void computeInsertionPoint(Instruction *User, unsigned OpNo,
206 static void appendAndTransferDominatedUses(Instruction *NewPt,
207 Instruction *User, unsigned OpNo,
216 Instruction *OldInstr = IPI->first;
257 static bool shouldConvertUse(const Constant *Cst, const Instruction *Instr,
356 Instruction *AArch64PromoteConstant::findInsertionPoint(Instruction &User,
356 Instruction *AArch64PromoteConstant::findInsertionPoint(Instruction &User,
366 bool AArch64PromoteConstant::isDominated(Instruction *NewPt, Instruction *User,
366 bool AArch64PromoteConstant::isDominated(Instruction *NewPt, Instruction *User,
392 bool AArch64PromoteConstant::tryAndMerge(Instruction *NewPt, Instruction *User,
392 bool AArch64PromoteConstant::tryAndMerge(Instruction *NewPt, Instruction *User,
444 Instruction *User, unsigned OpNo, InsertionPoints &InsertPts) {
449 Instruction *InsertionPoint = findInsertionPoint(*User, OpNo);
546 for (Instruction &I : instructions(&F)) {
lib/Target/AArch64/AArch64StackTagging.cpp 81 Instruction *Inst;
95 bool addRange(uint64_t Start, uint64_t End, Instruction *Inst) {
292 void tagAlloca(AllocaInst *AI, Instruction *InsertBefore, Value *Ptr,
294 void untagAlloca(AllocaInst *AI, Instruction *InsertBefore, uint64_t Size);
296 Instruction *collectInitializers(Instruction *StartInst, Value *StartPtr,
296 Instruction *collectInitializers(Instruction *StartInst, Value *StartPtr,
299 Instruction *
332 Instruction *AArch64StackTagging::collectInitializers(Instruction *StartInst,
332 Instruction *AArch64StackTagging::collectInitializers(Instruction *StartInst,
337 Instruction *LastInst = StartInst;
406 void AArch64StackTagging::tagAlloca(AllocaInst *AI, Instruction *InsertBefore,
427 void AArch64StackTagging::untagAlloca(AllocaInst *AI, Instruction *InsertBefore,
434 Instruction *AArch64StackTagging::insertBaseTaggedPointer(
455 Instruction *Base =
504 for (const Instruction &I : *ABB) {
524 SmallVector<Instruction *, 8> RetVec;
526 SmallVector<Instruction *, 4> UnrecognizedLifetimes;
530 Instruction *I = &*IT;
611 Instruction *Base = insertBaseTaggedPointer(Allocas, DT);
623 Instruction *TagPCall =
644 SmallVector<Instruction *, 8> ReachableRetVec;
lib/Target/AArch64/AArch64TargetTransformInfo.cpp 97 case Instruction::GetElementPtr:
102 case Instruction::Store:
105 case Instruction::Add:
106 case Instruction::Sub:
107 case Instruction::Mul:
108 case Instruction::UDiv:
109 case Instruction::SDiv:
110 case Instruction::URem:
111 case Instruction::SRem:
112 case Instruction::And:
113 case Instruction::Or:
114 case Instruction::Xor:
115 case Instruction::ICmp:
119 case Instruction::Shl:
120 case Instruction::LShr:
121 case Instruction::AShr:
125 case Instruction::Trunc:
126 case Instruction::ZExt:
127 case Instruction::SExt:
128 case Instruction::IntToPtr:
129 case Instruction::PtrToInt:
130 case Instruction::BitCast:
131 case Instruction::PHI:
132 case Instruction::Call:
133 case Instruction::Select:
134 case Instruction::Ret:
135 case Instruction::Load:
221 case Instruction::Add: // UADDL(2), SADDL(2), UADDW(2), SADDW(2).
222 case Instruction::Sub: // USUBL(2), SSUBL(2), USUBW(2), SSUBW(2).
263 const Instruction *I) {
270 auto *SingleUser = cast<Instruction>(*I->user_begin());
415 auto Cost = getVectorInstrCost(Instruction::ExtractElement, VecTy, Index);
439 case Instruction::SExt:
444 case Instruction::ZExt:
508 Cost += getArithmeticInstrCost(Instruction::Add, Ty, Opd1Info, Opd2Info,
511 Cost += getArithmeticInstrCost(Instruction::Sub, Ty, Opd1Info, Opd2Info,
514 Cost += getArithmeticInstrCost(Instruction::Select, Ty, Opd1Info, Opd2Info,
517 Cost += getArithmeticInstrCost(Instruction::AShr, Ty, Opd1Info, Opd2Info,
530 int MulCost = getArithmeticInstrCost(Instruction::Mul, Ty, Opd1Info,
534 int AddCost = getArithmeticInstrCost(Instruction::Add, Ty, Opd1Info,
538 int ShrCost = getArithmeticInstrCost(Instruction::AShr, Ty, Opd1Info,
551 Cost += getArithmeticInstrCost(Instruction::ExtractElement, Ty, Opd1Info,
553 Cost += getArithmeticInstrCost(Instruction::InsertElement, Ty, Opd1Info,
591 Type *CondTy, const Instruction *I) {
636 const Instruction *I) {
639 if (ST->isMisaligned128StoreSlow() && Opcode == Instruction::Store &&
653 if (Opcode == Instruction::Store)
706 Cost += getMemoryOpCost(Instruction::Store, I, Align(128), 0) +
707 getMemoryOpCost(Instruction::Load, I, Align(128), 0);
729 for (auto &I : *BB) {
869 const Instruction &I, bool &AllowPromotionWithoutCommonHeader) {
900 case Instruction::FAdd:
901 case Instruction::FMul:
902 case Instruction::And:
903 case Instruction::Or:
904 case Instruction::Xor:
905 case Instruction::Mul:
907 case Instruction::Add:
909 case Instruction::ICmp:
912 case Instruction::FCmp:
lib/Target/AArch64/AArch64TargetTransformInfo.h 114 const Instruction *I = nullptr);
132 const Instruction *I = nullptr);
138 unsigned AddressSpace, const Instruction *I = nullptr);
172 shouldConsiderAddressTypePromotion(const Instruction &I,
lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp 71 if (Instruction *I = dyn_cast<Instruction>(U)) {
71 if (Instruction *I = dyn_cast<Instruction>(U)) {
lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp 97 if (CE->getOpcode() == Instruction::AddrSpaceCast) {
276 for (Instruction &I : BB) {
lib/Target/AMDGPU/AMDGPUAnnotateUniformValues.cpp 72 static void setUniformMetadata(Instruction *I) {
75 static void setNoClobberMetadata(Instruction *I) {
134 Instruction *PtrI = dyn_cast<Instruction>(Ptr);
134 Instruction *PtrI = dyn_cast<Instruction>(Ptr);
lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp 33 Instruction *I;
52 void optimizeAtomic(Instruction &I, AtomicRMWInst::BinOp Op, unsigned ValIdx,
253 return B.CreateBinOp(Instruction::Add, LHS, RHS);
255 return B.CreateBinOp(Instruction::Sub, LHS, RHS);
257 return B.CreateBinOp(Instruction::And, LHS, RHS);
259 return B.CreateBinOp(Instruction::Or, LHS, RHS);
261 return B.CreateBinOp(Instruction::Xor, LHS, RHS);
406 void AMDGPUAtomicOptimizer::optimizeAtomic(Instruction &I,
428 Instruction *const NonHelperTerminator =
564 Instruction *const SingleLaneTerminator =
572 Instruction *const NewI = I.clone();
lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp 179 bool visitInstruction(Instruction &I) { return false; }
219 return I.getOpcode() == Instruction::AShr ||
220 I.getOpcode() == Instruction::SDiv || I.getOpcode() == Instruction::SRem;
220 I.getOpcode() == Instruction::SDiv || I.getOpcode() == Instruction::SRem;
246 static bool promotedOpIsNSW(const Instruction &I) {
248 case Instruction::Shl:
249 case Instruction::Add:
250 case Instruction::Sub:
252 case Instruction::Mul:
260 static bool promotedOpIsNUW(const Instruction &I) {
262 case Instruction::Shl:
263 case Instruction::Add:
264 case Instruction::Mul:
266 case Instruction::Sub:
287 if (I.getOpcode() == Instruction::SDiv ||
288 I.getOpcode() == Instruction::UDiv ||
289 I.getOpcode() == Instruction::SRem ||
290 I.getOpcode() == Instruction::URem)
311 if (Instruction *Inst = dyn_cast<Instruction>(ExtRes)) {
311 if (Instruction *Inst = dyn_cast<Instruction>(ExtRes)) {
312 if (promotedOpIsNSW(cast<Instruction>(I)))
315 if (promotedOpIsNUW(cast<Instruction>(I)))
461 if (I.getOpcode() != Instruction::Mul)
742 Instruction::BinaryOps Opc = I.getOpcode();
753 bool IsDiv = Opc == Instruction::UDiv || Opc == Instruction::SDiv;
753 bool IsDiv = Opc == Instruction::UDiv || Opc == Instruction::SDiv;
754 bool IsSigned = Opc == Instruction::SRem || Opc == Instruction::SDiv;
754 bool IsSigned = Opc == Instruction::SRem || Opc == Instruction::SDiv;
894 Instruction::BinaryOps Opc = I.getOpcode();
897 if ((Opc == Instruction::URem || Opc == Instruction::UDiv ||
897 if ((Opc == Instruction::URem || Opc == Instruction::UDiv ||
898 Opc == Instruction::SRem || Opc == Instruction::SDiv) &&
898 Opc == Instruction::SRem || Opc == Instruction::SDiv) &&
lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp 928 const Instruction *Term = BB->getTerminator();
lib/Target/AMDGPU/AMDGPUInline.cpp 164 if (const Instruction *I = BB.getFirstNonPHI()) {
lib/Target/AMDGPU/AMDGPUInstrInfo.cpp 48 const Instruction *I = dyn_cast<Instruction>(Ptr);
48 const Instruction *I = dyn_cast<Instruction>(Ptr);
lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp 1526 const Instruction *I = dyn_cast<Instruction>(Ptr);
1526 const Instruction *I = dyn_cast<Instruction>(Ptr);
lib/Target/AMDGPU/AMDGPULibCalls.cpp 1329 if (cast<Instruction>(BBI) == XI) {
1367 Instruction *Reload = B.CreateLoad(Alloc->getAllocatedType(), Alloc);
1372 Instruction *Reload = B.CreateLoad(Alloc->getAllocatedType(), Alloc);
lib/Target/AMDGPU/AMDGPULowerIntrinsics.cpp 68 Instruction *Inst = cast<Instruction>(*I);
68 Instruction *Inst = cast<Instruction>(*I);
lib/Target/AMDGPU/AMDGPULowerKernelAttributes.cpp 248 SmallPtrSet<Instruction *, 4> HandledUses;
lib/Target/AMDGPU/AMDGPUMCInstLower.cpp 239 if (CE && CE->getOpcode() == Instruction::AddrSpaceCast) {
lib/Target/AMDGPU/AMDGPUOpenCLEnqueuedBlockLowering.cpp 93 if (auto *I = dyn_cast<Instruction>(U)) {
93 if (auto *I = dyn_cast<Instruction>(U)) {
lib/Target/AMDGPU/AMDGPUPerfHintAnalysis.cpp 94 MemAccessInfo makeMemAccessInfo(Instruction *) const;
108 bool isIndirectAccess(const Instruction *Inst) const;
117 bool isLargeStride(const Instruction *Inst);
124 static const Value *getMemoryInstrPtr(const Instruction *Inst) {
144 bool AMDGPUPerfHint::isIndirectAccess(const Instruction *Inst) const {
316 bool AMDGPUPerfHint::isLargeStride(const Instruction *Inst) {
328 AMDGPUPerfHint::makeMemAccessInfo(Instruction *Inst) const {
lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp 69 Value *simplify(Instruction *I, const TargetLibraryInfo *TLI) {
173 if (auto I = dyn_cast<Instruction>(Op)) {
369 Instruction *Brnch =
lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp 105 Instruction *UseInst,
167 for (Instruction &I : EntryBB) {
328 static bool canVectorizeInst(Instruction *Inst, User *User) {
330 case Instruction::Load: {
340 case Instruction::BitCast:
342 case Instruction::Store: {
387 if (!canVectorizeInst(cast<Instruction>(AllocaUser), Alloca))
406 if (!canVectorizeInst(cast<Instruction>(GEPUser), AllocaUser))
421 Instruction *Inst = cast<Instruction>(V);
421 Instruction *Inst = cast<Instruction>(V);
424 case Instruction::Load: {
439 case Instruction::Store: {
456 case Instruction::BitCast:
457 case Instruction::AddrSpaceCast:
491 Instruction *Inst,
538 Instruction *UseInst = cast<Instruction>(User);
538 Instruction *UseInst = cast<Instruction>(User);
539 if (UseInst->getOpcode() == Instruction::PtrToInt)
574 if (UseInst->getOpcode() == Instruction::AddrSpaceCast) {
655 const Instruction *Use = dyn_cast<Instruction>(U);
655 const Instruction *Use = dyn_cast<Instruction>(U);
lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp 203 Instruction *I = dyn_cast<Instruction>(U);
203 Instruction *I = dyn_cast<Instruction>(U);
lib/Target/AMDGPU/AMDGPUSubtarget.cpp 432 bool AMDGPUSubtarget::makeLIDRangeMetadata(Instruction *I) const {
lib/Target/AMDGPU/AMDGPUSubtarget.h 232 bool makeLIDRangeMetadata(Instruction *I) const;
lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp 74 const Instruction *I = dyn_cast<Instruction>(Cond);
74 const Instruction *I = dyn_cast<Instruction>(Cond);
112 for (const Instruction &I : *BB) {
179 const Instruction *Inst = dyn_cast<Instruction>(Op);
179 const Instruction *Inst = dyn_cast<Instruction>(Op);
453 case Instruction::Br:
454 case Instruction::Ret:
495 case Instruction::ExtractElement:
496 case Instruction::InsertElement: {
796 case Instruction::Br:
797 case Instruction::Ret:
807 case Instruction::ExtractElement:
808 case Instruction::InsertElement: {
lib/Target/AMDGPU/R600OpenCLImageTypeLoweringPass.cpp 162 SmallVector<Instruction *, 4> InstsToErase;
lib/Target/AMDGPU/SIAnnotateControlFlow.cpp 231 if (Instruction *Inst = dyn_cast<Instruction>(Cond)) {
231 if (Instruction *Inst = dyn_cast<Instruction>(Cond)) {
233 Instruction *Insert;
246 Instruction *Insert = Cond == BoolTrue ?
314 Instruction *FirstInsertionPt = &*BB->getFirstInsertionPt();
lib/Target/AMDGPU/SIISelLowering.cpp 1143 unsigned AS, Instruction *I) const {
1337 const Instruction *I = dyn_cast_or_null<Instruction>(Ptr);
1337 const Instruction *I = dyn_cast_or_null<Instruction>(Ptr);
lib/Target/AMDGPU/SIISelLowering.h 240 Instruction *I = nullptr) const override;
lib/Target/ARC/ARCISelLowering.cpp 700 Instruction *I) const {
lib/Target/ARC/ARCISelLowering.h 75 Instruction *I = nullptr) const override;
lib/Target/ARM/ARMCodeGenPrepare.cpp 111 SmallPtrSet<Instruction*, 4> InstsToRemove;
124 SmallPtrSetImpl<Instruction*> *Sinks;
125 SmallPtrSetImpl<Instruction*> *SafeToPromote;
126 SmallPtrSetImpl<Instruction*> *SafeWrap;
144 SmallPtrSetImpl<Instruction*> &Sinks,
145 SmallPtrSetImpl<Instruction*> &SafeToPromote,
146 SmallPtrSetImpl<Instruction*> &SafeWrap);
153 SmallPtrSet<Instruction*, 8> SafeToPromote;
154 SmallPtrSet<Instruction*, 4> SafeWrap;
156 bool isSafeWrap(Instruction *I);
182 if (!isa<Instruction>(V))
185 unsigned Opc = cast<Instruction>(V)->getOpcode();
186 return Opc == Instruction::AShr || Opc == Instruction::SDiv ||
186 return Opc == Instruction::AShr || Opc == Instruction::SDiv ||
187 Opc == Instruction::SRem || Opc == Instruction::SExt;
187 Opc == Instruction::SRem || Opc == Instruction::SExt;
281 bool ARMCodeGenPrepare::isSafeWrap(Instruction *I) {
342 if (Opc != Instruction::Add && Opc != Instruction::Sub)
342 if (Opc != Instruction::Add && Opc != Instruction::Sub)
352 bool IsDecreasing = ((Opc == Instruction::Sub) && !NegImm) ||
353 ((Opc == Instruction::Add) && NegImm);
400 auto *I = dyn_cast<Instruction>(V);
400 auto *I = dyn_cast<Instruction>(V);
416 if (!isa<Instruction>(V))
422 return cast<Instruction>(V)->hasNoUnsignedWrap();
428 static Intrinsic::ID getNarrowIntrinsic(Instruction *I) {
435 case Instruction::Add:
438 case Instruction::Sub:
446 SmallVector<Instruction*, 4> Users;
447 Instruction *InstTo = dyn_cast<Instruction>(To);
447 Instruction *InstTo = dyn_cast<Instruction>(To);
454 auto *User = cast<Instruction>(U.getUser());
454 auto *User = cast<Instruction>(U.getUser());
462 for (auto *U : Users)
466 if (auto *I = dyn_cast<Instruction>(From))
466 if (auto *I = dyn_cast<Instruction>(From))
478 for (auto *I : *SafeWrap) {
479 if (I->getOpcode() != Instruction::Add)
491 if (auto *NewInst = dyn_cast<Instruction>(NewVal)) {
491 if (auto *NewInst = dyn_cast<Instruction>(NewVal)) {
510 if (auto *I = dyn_cast<Instruction>(V))
510 if (auto *I = dyn_cast<Instruction>(V))
514 if (auto *I = dyn_cast<Instruction>(ZExt)) {
514 if (auto *I = dyn_cast<Instruction>(ZExt)) {
529 if (auto *I = dyn_cast<Instruction>(V))
529 if (auto *I = dyn_cast<Instruction>(V))
552 auto *I = cast<Instruction>(V);
552 auto *I = cast<Instruction>(V);
577 auto *I = dyn_cast<Instruction>(V);
577 auto *I = dyn_cast<Instruction>(V);
609 if (!isa<Instruction>(V) || !isa<IntegerType>(V->getType()))
617 Builder.SetInsertPoint(cast<Instruction>(V));
618 auto *Trunc = dyn_cast<Instruction>(Builder.CreateTrunc(V, TruncTy));
618 auto *Trunc = dyn_cast<Instruction>(Builder.CreateTrunc(V, TruncTy));
634 if (Instruction *Trunc = InsertTrunc(Arg, Ty)) {
645 if (Instruction *Trunc = InsertTrunc(Switch->getCondition(), Ty)) {
655 if (Instruction *Trunc = InsertTrunc(I->getOperand(i), Ty)) {
695 for (auto *I : InstsToRemove) {
727 if (auto *I = dyn_cast<Instruction>(Masked))
727 if (auto *I = dyn_cast<Instruction>(Masked))
737 SmallPtrSetImpl<Instruction*> &Sinks,
738 SmallPtrSetImpl<Instruction*> &SafeToPromote,
739 SmallPtrSetImpl<Instruction*> &SafeWrap) {
755 for (auto *I : Sinks) {
805 if (auto *I = dyn_cast<Instruction>(V)) {
805 if (auto *I = dyn_cast<Instruction>(V)) {
810 case Instruction::GetElementPtr:
811 case Instruction::Store:
812 case Instruction::Br:
813 case Instruction::Switch:
815 case Instruction::PHI:
816 case Instruction::Select:
817 case Instruction::Ret:
818 case Instruction::Load:
819 case Instruction::Trunc:
820 case Instruction::BitCast:
822 case Instruction::ZExt:
824 case Instruction::ICmp:
832 case Instruction::Call: {
854 auto *I = dyn_cast<Instruction>(V);
854 auto *I = dyn_cast<Instruction>(V);
866 if (I->getOpcode() != Instruction::Add && I->getOpcode() != Instruction::Sub)
866 if (I->getOpcode() != Instruction::Add && I->getOpcode() != Instruction::Sub)
909 SmallPtrSet<Instruction*, 4> Sinks;
942 if (!isa<Instruction>(V) && !isSource(V))
957 Sinks.insert(cast<Instruction>(V));
963 if (auto *I = dyn_cast<Instruction>(V)) {
963 if (auto *I = dyn_cast<Instruction>(V)) {
990 if (Sinks.count(cast<Instruction>(V)))
1024 for (auto &I : Insts) {
1038 if (auto *I = dyn_cast<Instruction>(Op))
1038 if (auto *I = dyn_cast<Instruction>(Op))
lib/Target/ARM/ARMFastISel.cpp 156 bool fastSelectInstruction(const Instruction *I) override;
167 bool SelectLoad(const Instruction *I);
168 bool SelectStore(const Instruction *I);
169 bool SelectBranch(const Instruction *I);
170 bool SelectIndirectBr(const Instruction *I);
171 bool SelectCmp(const Instruction *I);
172 bool SelectFPExt(const Instruction *I);
173 bool SelectFPTrunc(const Instruction *I);
174 bool SelectBinaryIntOp(const Instruction *I, unsigned ISDOpcode);
175 bool SelectBinaryFPOp(const Instruction *I, unsigned ISDOpcode);
176 bool SelectIToFP(const Instruction *I, bool isSigned);
177 bool SelectFPToI(const Instruction *I, bool isSigned);
178 bool SelectDiv(const Instruction *I, bool isSigned);
179 bool SelectRem(const Instruction *I, bool isSigned);
180 bool SelectCall(const Instruction *I, const char *IntrMemName);
182 bool SelectSelect(const Instruction *I);
183 bool SelectRet(const Instruction *I);
184 bool SelectTrunc(const Instruction *I);
185 bool SelectIntExt(const Instruction *I);
186 bool SelectShift(const Instruction *I, ARM_AM::ShiftOpc ShiftTy);
231 const Instruction *I, CallingConv::ID CC,
233 bool ARMEmitLibcall(const Instruction *I, RTLIB::Libcall Call);
716 unsigned Opcode = Instruction::UserOp1;
717 if (const Instruction *I = dyn_cast<Instruction>(Obj)) {
717 if (const Instruction *I = dyn_cast<Instruction>(Obj)) {
739 case Instruction::BitCast:
742 case Instruction::IntToPtr:
748 case Instruction::PtrToInt:
753 case Instruction::GetElementPtr: {
800 case Instruction::Alloca: {
1019 bool ARMFastISel::SelectLoad(const Instruction *I) {
1148 bool ARMFastISel::SelectStore(const Instruction *I) {
1237 bool ARMFastISel::SelectBranch(const Instruction *I) {
1333 bool ARMFastISel::SelectIndirectBr(const Instruction *I) {
1469 bool ARMFastISel::SelectCmp(const Instruction *I) {
1499 bool ARMFastISel::SelectFPExt(const Instruction *I) {
1518 bool ARMFastISel::SelectFPTrunc(const Instruction *I) {
1537 bool ARMFastISel::SelectIToFP(const Instruction *I, bool isSigned) {
1582 bool ARMFastISel::SelectFPToI(const Instruction *I, bool isSigned) {
1615 bool ARMFastISel::SelectSelect(const Instruction *I) {
1691 bool ARMFastISel::SelectDiv(const Instruction *I, bool isSigned) {
1720 bool ARMFastISel::SelectRem(const Instruction *I, bool isSigned) {
1749 bool ARMFastISel::SelectBinaryIntOp(const Instruction *I, unsigned ISDOpcode) {
1789 bool ARMFastISel::SelectBinaryFPOp(const Instruction *I, unsigned ISDOpcode) {
2035 const Instruction *I, CallingConv::ID CC,
2090 bool ARMFastISel::SelectRet(const Instruction *I) {
2204 bool ARMFastISel::ARMEmitLibcall(const Instruction *I, RTLIB::Libcall Call) {
2293 bool ARMFastISel::SelectCall(const Instruction *I,
2576 bool ARMFastISel::SelectTrunc(const Instruction *I) {
2738 bool ARMFastISel::SelectIntExt(const Instruction *I) {
2763 bool ARMFastISel::SelectShift(const Instruction *I,
2819 bool ARMFastISel::fastSelectInstruction(const Instruction *I) {
2821 case Instruction::Load:
2823 case Instruction::Store:
2825 case Instruction::Br:
2827 case Instruction::IndirectBr:
2829 case Instruction::ICmp:
2830 case Instruction::FCmp:
2832 case Instruction::FPExt:
2834 case Instruction::FPTrunc:
2836 case Instruction::SIToFP:
2838 case Instruction::UIToFP:
2840 case Instruction::FPToSI:
2842 case Instruction::FPToUI:
2844 case Instruction::Add:
2846 case Instruction::Or:
2848 case Instruction::Sub:
2850 case Instruction::FAdd:
2852 case Instruction::FSub:
2854 case Instruction::FMul:
2856 case Instruction::SDiv:
2858 case Instruction::UDiv:
2860 case Instruction::SRem:
2862 case Instruction::URem:
2864 case Instruction::Call:
2868 case Instruction::Select:
2870 case Instruction::Ret:
2872 case Instruction::Trunc:
2874 case Instruction::ZExt:
2875 case Instruction::SExt:
2877 case Instruction::Shl:
2879 case Instruction::LShr:
2881 case Instruction::AShr:
lib/Target/ARM/ARMISelLowering.cpp 2084 return isa<Instruction>(U) &&
2085 cast<Instruction>(U)->getParent() == BB;
3310 auto *I = dyn_cast<Instruction>(U);
14741 !areExtDoubled(cast<Instruction>(Ext1)) ||
14742 !areExtDoubled(cast<Instruction>(Ext2)))
14751 bool ARMTargetLowering::shouldSinkOperands(Instruction *I,
14758 case Instruction::Sub:
14759 case Instruction::Add: {
14776 case Instruction::Add:
14777 case Instruction::Mul:
14779 case Instruction::Sub:
14796 Instruction *Shuffle = cast<Instruction>(I->getOperand(Op));
14796 Instruction *Shuffle = cast<Instruction>(I->getOperand(Op));
14800 Instruction *Insn = cast<Instruction>(U.getUser());
14800 Instruction *Insn = cast<Instruction>(U.getUser());
15032 unsigned AS, Instruction *I) const {
16401 Instruction* ARMTargetLowering::makeDMB(IRBuilder<> &Builder,
16431 Instruction *ARMTargetLowering::emitLeadingFence(IRBuilder<> &Builder,
16432 Instruction *Inst,
16456 Instruction *ARMTargetLowering::emitTrailingFence(IRBuilder<> &Builder,
16457 Instruction *Inst,
16526 const Instruction *I) const {
lib/Target/ARM/ARMISelLowering.h 355 bool shouldSinkOperands(Instruction *I,
369 Instruction *I = nullptr) const override;
538 Instruction *makeDMB(IRBuilder<> &Builder, ARM_MB::MemBOpt Domain) const;
546 Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst,
546 Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst,
548 Instruction *emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst,
548 Instruction *emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst,
560 bool shouldInsertFencesForAtomic(const Instruction *I) const override;
lib/Target/ARM/ARMParallelDSP.cpp 61 Instruction *Root;
69 MulCandidate(Instruction *I, Value *lhs, Value *rhs) :
84 Instruction *Root = nullptr;
88 SetVector<Instruction*> Adds;
93 Reduction (Instruction *Add) : Root(Add) { }
96 void InsertAdd(Instruction *I) { Adds.insert(I); }
103 if (auto *I = dyn_cast<Instruction>(SExt->getOperand(0)))
103 if (auto *I = dyn_cast<Instruction>(SExt->getOperand(0)))
104 if (I->getOpcode() == Instruction::Mul)
106 } else if (auto *I = dyn_cast<Instruction>(V)) {
106 } else if (auto *I = dyn_cast<Instruction>(V)) {
107 if (I->getOpcode() == Instruction::Mul)
114 Value *LHS = cast<Instruction>(I->getOperand(0))->getOperand(0);
115 Value *RHS = cast<Instruction>(I->getOperand(1))->getOperand(0);
119 for (auto *Add : Adds) {
122 if (auto *Mul = GetMulOperand(Add->getOperand(0)))
124 if (auto *Mul = GetMulOperand(Add->getOperand(1)))
158 Instruction *getRoot() { return Root; }
168 SetVector<Instruction*> &getAdds() { return Adds; }
179 void UpdateRoot(Instruction *SMLAD) {
351 SmallVector<Instruction*, 8> Writes;
359 for (auto &I : *BB) {
372 using InstSet = std::set<Instruction*>;
373 using DepMap = std::map<Instruction*, InstSet>;
443 auto *I = dyn_cast<Instruction>(V);
443 auto *I = dyn_cast<Instruction>(V);
453 case Instruction::PHI:
456 case Instruction::Add: {
471 case Instruction::Mul: {
476 case Instruction::SExt:
517 SmallPtrSet<Instruction*, 4> AllAdds;
521 for (Instruction &I : reverse(BB)) {
522 if (I.getOpcode() != Instruction::Add)
611 const Instruction *Mul0 = PMul0->Root;
612 const Instruction *Mul1 = PMul1->Root;
645 Instruction *Call = Builder.CreateCall(SMLAD, Args);
656 if (!isa<Instruction>(A))
658 else if (!isa<Instruction>(B))
661 V = DT->dominates(cast<Instruction>(A), cast<Instruction>(B)) ? B : A;
661 V = DT->dominates(cast<Instruction>(A), cast<Instruction>(B)) ? B : A;
663 return &*++BasicBlock::iterator(cast<Instruction>(V));
676 Instruction *Mul = cast<Instruction>(MulCand->Root);
676 Instruction *Mul = cast<Instruction>(MulCand->Root);
682 Mul = cast<Instruction>(Builder.CreateSExt(Mul, R.getRoot()->getType()));
709 const Instruction *A = PairA.first->Root;
710 const Instruction *B = PairB.first->Root;
725 Instruction *InsertAfter = GetInsertPoint(WideLHS, WideRHS);
729 R.UpdateRoot(cast<Instruction>(Acc));
739 Instruction *BaseSExt = dyn_cast<SExtInst>(Base->user_back());
740 Instruction *OffsetSExt = dyn_cast<SExtInst>(Offset->user_back());
747 if (!isa<Instruction>(A) || !isa<Instruction>(B))
747 if (!isa<Instruction>(A) || !isa<Instruction>(B))
750 auto *Source = cast<Instruction>(A);
750 auto *Source = cast<Instruction>(A);
751 auto *Sink = cast<Instruction>(B);
751 auto *Sink = cast<Instruction>(B);
lib/Target/ARM/ARMTargetTransformInfo.cpp 113 if ((Opcode == Instruction::SDiv || Opcode == Instruction::UDiv ||
113 if ((Opcode == Instruction::SDiv || Opcode == Instruction::UDiv ||
114 Opcode == Instruction::SRem || Opcode == Instruction::URem) &&
114 Opcode == Instruction::SRem || Opcode == Instruction::URem) &&
118 if (Opcode == Instruction::And) {
126 if (Opcode == Instruction::Add)
130 if (Opcode == Instruction::ICmp && Imm.isNegative() &&
142 if (Opcode == Instruction::Xor && Imm.isAllOnesValue())
149 const Instruction *I) {
410 if (ST->hasSlowLoadDSubregister() && Opcode == Instruction::InsertElement &&
414 if (ST->hasNEON() && (Opcode == Instruction::InsertElement ||
415 Opcode == Instruction::ExtractElement)) {
428 if (ST->hasMVEIntegerOps() && (Opcode == Instruction::InsertElement ||
429 Opcode == Instruction::ExtractElement)) {
443 const Instruction *I) {
515 int ARMTTIImpl::getMemcpyCost(const Instruction *I) {
740 const Instruction *I) {
896 case Instruction::FPToSI:
897 case Instruction::FPToUI:
898 case Instruction::SIToFP:
899 case Instruction::UIToFP:
900 case Instruction::FPTrunc:
901 case Instruction::FPExt:
934 case Instruction::Alloca:
935 case Instruction::Load:
936 case Instruction::Store:
937 case Instruction::Select:
938 case Instruction::PHI:
974 for (auto &I : *BB) {
1039 for (auto &I : *BB) {
1083 case Instruction::FAdd:
1084 case Instruction::FMul:
1085 case Instruction::And:
1086 case Instruction::Or:
1087 case Instruction::Xor:
1088 case Instruction::Mul:
1089 case Instruction::FCmp:
1091 case Instruction::ICmp:
1092 case Instruction::Add:
lib/Target/ARM/ARMTargetTransformInfo.h 162 int getMemcpyCost(const Instruction *I);
174 const Instruction *I = nullptr);
177 const Instruction *I = nullptr);
193 unsigned AddressSpace, const Instruction *I = nullptr);
lib/Target/ARM/MVETailPredication.cpp 87 bool isTailPredicate(Instruction *Predicate, Value *NumElements);
92 static bool IsDecrement(Instruction &I) {
101 static bool IsMasked(Instruction *I) {
135 for (auto &I : *BB) {
163 for (auto &I : *BB) {
181 bool MVETailPredication::isTailPredicate(Instruction *I, Value *NumElements) {
205 Instruction *Shuffle = nullptr;
206 Instruction *Induction = nullptr;
217 Instruction *Insert = nullptr;
223 Instruction *BECount = nullptr;
238 Instruction *BroadcastSplat = nullptr;
259 Instruction *IV = nullptr;
276 Instruction *LHS = nullptr;
294 for (auto &I : *BB) {
384 Instruction *InsertPt = L->getLoopPreheader()->getTerminator();
400 static void Cleanup(DenseMap<Instruction*, Instruction*> &NewPredicates,
400 static void Cleanup(DenseMap<Instruction*, Instruction*> &NewPredicates,
401 SetVector<Instruction*> &MaybeDead, Loop *L) {
404 Instruction *OldPred = Pair.first;
405 Instruction *NewPred = Pair.second;
407 for (auto &I : *Exit) {
409 Instruction *PredClone = NewPred->clone();
420 SmallPtrSet<Instruction*, 4> Dead;
422 auto *I = MaybeDead.front();
428 if (auto *OpI = dyn_cast<Instruction>(U))
428 if (auto *OpI = dyn_cast<Instruction>(U))
435 for (auto *I : Dead)
452 SetVector<Instruction*> Predicates;
453 DenseMap<Instruction*, Instruction*> NewPredicates;
453 DenseMap<Instruction*, Instruction*> NewPredicates;
458 auto *Predicate = dyn_cast<Instruction>(I->getArgOperand(PredOp));
458 auto *Predicate = dyn_cast<Instruction>(I->getArgOperand(PredOp));
481 Builder.SetInsertPoint(cast<Instruction>(Predicate));
496 NewPredicates[Predicate] = cast<Instruction>(TailPredicate);
lib/Target/AVR/AVRISelLowering.cpp 746 unsigned AS, Instruction *I) const {
lib/Target/AVR/AVRISelLowering.h 93 Instruction *I = nullptr) const override;
lib/Target/BPF/BPFAbstractMemberAccess.cpp 310 for (auto &I : BB) {
400 Instruction *Inst = dyn_cast<Instruction>(U);
400 Instruction *Inst = dyn_cast<Instruction>(U);
432 Instruction *Inst = dyn_cast<Instruction>(U);
432 Instruction *Inst = dyn_cast<Instruction>(U);
462 Instruction *Inst = dyn_cast<Instruction>(U);
462 Instruction *Inst = dyn_cast<Instruction>(U);
494 for (auto &I : BB) {
lib/Target/Hexagon/HexagonCommonGEP.cpp 738 if (!isa<Instruction>(V))
740 Instruction *In = cast<Instruction>(V);
740 Instruction *In = cast<Instruction>(V);
776 if (!isa<Instruction>(R))
780 : cast<Instruction>(R)->getParent();
804 Instruction *IdxI = dyn_cast<Instruction>(Node->Idx);
804 Instruction *IdxI = dyn_cast<Instruction>(Node->Idx);
840 Instruction *In = dyn_cast<Instruction>(Val);
840 Instruction *In = dyn_cast<Instruction>(Val);
883 if (Instruction *PIn = dyn_cast<Instruction>(Node->BaseVal))
883 if (Instruction *PIn = dyn_cast<Instruction>(Node->BaseVal))
888 if (Instruction *IIn = dyn_cast<Instruction>(Node->Idx))
888 if (Instruction *IIn = dyn_cast<Instruction>(Node->Idx))
957 BasicBlock *PB = cast<Instruction>(R)->getParent();
1264 Instruction *In = cast<Instruction>(*I);
1264 Instruction *In = cast<Instruction>(*I);
lib/Target/Hexagon/HexagonGenExtract.cpp 78 bool convert(Instruction *In);
94 bool HexagonGenExtract::convert(Instruction *In) {
238 Instruction *In = &*I;
lib/Target/Hexagon/HexagonISelDAGToDAG.cpp 1862 if (isa<Instruction>(U) &&
1863 cast<Instruction>(U)->getParent()->getParent() == &CurF)
lib/Target/Hexagon/HexagonISelLowering.cpp 1713 if (Operator::getOpcode(V) == Instruction::ExtractValue ||
1714 Operator::getOpcode(V) == Instruction::BitCast)
1717 V = cast<Instruction>(V)->getOperand(0);
3062 unsigned AS, Instruction *I) const {
lib/Target/Hexagon/HexagonISelLowering.h 289 Instruction *I = nullptr) const override;
lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp 148 bool coverLoop(Loop *L, SmallVectorImpl<Instruction*> &Insts) const;
164 using FuncType = std::function<Value* (Instruction*, LLVMContext&)>;
208 Context(Instruction *Exp)
221 void initialize(Instruction *Exp);
229 bool equal(const Instruction *I, const Instruction *J) const;
229 bool equal(const Instruction *I, const Instruction *J) const;
233 void link(Instruction *I, BasicBlock *B, BasicBlock::iterator At);
274 Instruction *U = dyn_cast<Instruction>(Q.pop_front_val());
274 Instruction *U = dyn_cast<Instruction>(Q.pop_front_val());
285 const auto *U = dyn_cast<const Instruction>(V);
285 const auto *U = dyn_cast<const Instruction>(V);
310 void Simplifier::Context::initialize(Instruction *Exp) {
323 if (Instruction *U = dyn_cast<Instruction>(V)) {
323 if (Instruction *U = dyn_cast<Instruction>(V)) {
333 Instruction *U = cast<Instruction>(P.second);
333 Instruction *U = cast<Instruction>(P.second);
366 if (!isa<Instruction>(V) || cast<Instruction>(V)->getParent() != nullptr)
366 if (!isa<Instruction>(V) || cast<Instruction>(V)->getParent() != nullptr)
387 Instruction *U = dyn_cast<Instruction>(Q.pop_front_val());
387 Instruction *U = dyn_cast<Instruction>(Q.pop_front_val());
421 Instruction *U = dyn_cast<Instruction>(V);
421 Instruction *U = dyn_cast<Instruction>(V);
440 Instruction *U = cast<Instruction>(V);
440 Instruction *U = cast<Instruction>(V);
446 Instruction *U = cast<Instruction>(V);
446 Instruction *U = cast<Instruction>(V);
452 bool Simplifier::Context::equal(const Instruction *I,
453 const Instruction *J) const {
465 auto *InI = dyn_cast<const Instruction>(OpI);
466 auto *InJ = dyn_cast<const Instruction>(OpJ);
477 Instruction *SubI = dyn_cast<Instruction>(Sub);
477 Instruction *SubI = dyn_cast<Instruction>(Sub);
485 Instruction *U = dyn_cast<Instruction>(V);
485 Instruction *U = dyn_cast<Instruction>(V);
497 void Simplifier::Context::link(Instruction *I, BasicBlock *B,
503 if (Instruction *OpI = dyn_cast<Instruction>(Op))
503 if (Instruction *OpI = dyn_cast<Instruction>(Op))
512 if (Instruction *RootI = dyn_cast<Instruction>(Root))
512 if (Instruction *RootI = dyn_cast<Instruction>(Root))
526 Instruction *U = dyn_cast<Instruction>(Q.pop_front_val());
526 Instruction *U = dyn_cast<Instruction>(Q.pop_front_val());
574 void promoteTo(Instruction *In, IntegerType *DestTy, BasicBlock *LoopB);
579 void classifyCycle(Instruction *DivI, ValueSeq &Cycle, ValueSeq &Early,
581 bool classifyInst(Instruction *UseI, ValueSeq &Early, ValueSeq &Late);
582 bool commutesWithShift(Instruction *I);
585 bool isOperandShifted(Instruction *I, Value *Op);
598 Instruction *Res = nullptr;
638 if (BO->getOpcode() != Instruction::Add)
659 if (auto *II = dyn_cast<Instruction>(TheUse.getUser()))
659 if (auto *II = dyn_cast<Instruction>(TheUse.getUser()))
925 auto *I1 = dyn_cast<Instruction>(X1);
925 auto *I1 = dyn_cast<Instruction>(X1);
926 auto *I2 = dyn_cast<Instruction>(X2);
926 auto *I2 = dyn_cast<Instruction>(X2);
975 Instruction *In = dyn_cast<Instruction>(Val);
975 Instruction *In = dyn_cast<Instruction>(Val);
981 case Instruction::PHI:
982 case Instruction::ZExt:
983 case Instruction::And:
984 case Instruction::Or:
985 case Instruction::Xor:
986 case Instruction::LShr: // Shift right is ok.
987 case Instruction::Select:
988 case Instruction::Trunc:
990 case Instruction::ICmp:
994 case Instruction::Add:
1000 void PolynomialMultiplyRecognize::promoteTo(Instruction *In,
1075 for (Instruction &In : *LoopB)
1080 std::vector<Instruction*> LoopIns;
1083 for (Instruction *In : LoopIns)
1088 Instruction *EndI = ExitB->getFirstNonPHI();
1106 cast<Instruction>(T)->setOperand(0, P);
1119 auto *BB = cast<Instruction>(Out)->getParent();
1123 auto *I = dyn_cast<Instruction>(&*U);
1123 auto *I = dyn_cast<Instruction>(&*U);
1145 void PolynomialMultiplyRecognize::classifyCycle(Instruction *DivI,
1181 bool PolynomialMultiplyRecognize::classifyInst(Instruction *UseI,
1186 if (UseI->getOpcode() == Instruction::Select) {
1233 bool PolynomialMultiplyRecognize::commutesWithShift(Instruction *I) {
1235 case Instruction::And:
1236 case Instruction::Or:
1237 case Instruction::Xor:
1238 case Instruction::LShr:
1239 case Instruction::Shl:
1240 case Instruction::Select:
1241 case Instruction::ICmp:
1242 case Instruction::PHI:
1268 if (auto *I = dyn_cast<Instruction>(V)) {
1268 if (auto *I = dyn_cast<Instruction>(V)) {
1270 case Instruction::And:
1271 case Instruction::Or:
1272 case Instruction::Xor:
1273 case Instruction::LShr:
1274 case Instruction::Select:
1275 case Instruction::ICmp:
1276 case Instruction::PHI:
1277 case Instruction::ZExt:
1285 bool PolynomialMultiplyRecognize::isOperandShifted(Instruction *I, Value *Op) {
1287 if (Opc == Instruction::Shl || Opc == Instruction::LShr)
1287 if (Opc == Instruction::Shl || Opc == Instruction::LShr)
1305 for (Instruction &I : *LoopB) {
1329 auto *R = cast<Instruction>(V);
1329 auto *R = cast<Instruction>(V);
1335 auto *T = cast<Instruction>(*I);
1335 auto *T = cast<Instruction>(*I);
1355 auto *R = dyn_cast<Instruction>(Internal[i]);
1355 auto *R = dyn_cast<Instruction>(Internal[i]);
1359 auto *T = dyn_cast<Instruction>(Op);
1359 auto *T = dyn_cast<Instruction>(Op);
1469 for (auto &I : *LoopB)
1566 const Instruction *I = dyn_cast<const Instruction>(V);
1566 const Instruction *I = dyn_cast<const Instruction>(V);
1570 case Instruction::LShr:
1574 case Instruction::Or:
1575 case Instruction::Xor:
1578 case Instruction::And:
1589 if (I->getOpcode() != Instruction::ZExt)
1591 Instruction *T = dyn_cast<Instruction>(I->getOperand(0));
1591 Instruction *T = dyn_cast<Instruction>(I->getOperand(0));
1595 case Instruction::And:
1596 case Instruction::Or:
1597 case Instruction::Xor:
1610 if (I->getOpcode() != Instruction::Xor)
1612 Instruction *And0 = dyn_cast<Instruction>(I->getOperand(0));
1612 Instruction *And0 = dyn_cast<Instruction>(I->getOperand(0));
1613 Instruction *And1 = dyn_cast<Instruction>(I->getOperand(1));
1613 Instruction *And1 = dyn_cast<Instruction>(I->getOperand(1));
1616 if (And0->getOpcode() != Instruction::And ||
1617 And1->getOpcode() != Instruction::And)
1632 Instruction::BinaryOps Op = BO->getOpcode();
1673 if (I->getOpcode() != Instruction::Or)
1685 if (I->getOpcode() != Instruction::LShr)
1691 case Instruction::And:
1692 case Instruction::Or:
1693 case Instruction::Xor:
1709 case Instruction::And:
1710 case Instruction::Or:
1711 case Instruction::Xor:
1736 if (I->getOpcode() != Instruction::And)
1738 Instruction *Xor = dyn_cast<Instruction>(I->getOperand(0));
1738 Instruction *Xor = dyn_cast<Instruction>(I->getOperand(0));
1742 if (Xor->getOpcode() != Instruction::Xor)
1744 Instruction *And0 = dyn_cast<Instruction>(Xor->getOperand(0));
1744 Instruction *And0 = dyn_cast<Instruction>(Xor->getOperand(0));
1745 Instruction *And1 = dyn_cast<Instruction>(Xor->getOperand(1));
1745 Instruction *And1 = dyn_cast<Instruction>(Xor->getOperand(1));
1747 if (!And0 || And0->getOpcode() != Instruction::And)
1812 for (Instruction &In : *LoopB) {
1847 for (Instruction &In : *LoopB) {
1869 for (Instruction &In : *LoopB) {
1970 SmallPtrSetImpl<Instruction *> &Ignored) {
1989 for (auto &I : *B)
2001 for (Instruction &I : *BB)
2030 Instruction *ExpPt = Preheader->getTerminator();
2069 SmallPtrSet<Instruction*, 2> Ignore1;
2098 SmallVector<Instruction*,2> Insts;
2116 SmallPtrSet<Instruction*, 2> Ignore2;
2153 if (Instruction *In = dyn_cast<Instruction>(NumBytes))
2153 if (Instruction *In = dyn_cast<Instruction>(NumBytes))
2181 for (auto &In : *Header) {
2223 Instruction *OldT = Preheader->getTerminator();
2264 if (Instruction *In = dyn_cast<Instruction>(NumWords))
2264 if (Instruction *In = dyn_cast<Instruction>(NumWords))
2304 SmallVectorImpl<Instruction*> &Insts) const {
2309 SetVector<Instruction*> Worklist(Insts.begin(), Insts.end());
2316 Instruction *In = Worklist[i];
2318 Instruction *OpI = dyn_cast<Instruction>(I);
2318 Instruction *OpI = dyn_cast<Instruction>(I);
2333 for (auto &In : *B) {
2339 Instruction *UseI = dyn_cast<Instruction>(K);
2339 Instruction *UseI = dyn_cast<Instruction>(K);
lib/Target/Hexagon/HexagonOptimizeSZextends.cpp 78 Instruction* Use = cast<Instruction>(*UI);
78 Instruction* Use = cast<Instruction>(*UI);
84 Instruction* First = &F.getEntryBlock().front();
103 for (auto &I : B) {
106 if (!(Ashr && Ashr->getOpcode() == Instruction::AShr))
115 Instruction *Shl = dyn_cast<Instruction>(Ashr->getOperand(0));
115 Instruction *Shl = dyn_cast<Instruction>(Ashr->getOperand(0));
116 if (!(Shl && Shl->getOpcode() == Instruction::Shl))
133 if (Instruction *J = dyn_cast<Instruction>(TheUse.getUser())) {
133 if (Instruction *J = dyn_cast<Instruction>(TheUse.getUser())) {
lib/Target/Hexagon/HexagonTargetObjectFile.cpp 432 auto *I = dyn_cast<Instruction>(U);
lib/Target/Hexagon/HexagonTargetTransformInfo.cpp 157 const Instruction *I) {
159 if (Opcode == Instruction::Store)
230 Type *CondTy, const Instruction *I) {
233 if (Opcode == Instruction::FCmp)
253 Type *SrcTy, const Instruction *I) {
269 if (Opcode == Instruction::InsertElement) {
275 return Cost + getVectorInstrCost(Instruction::ExtractElement, Val, Index);
278 if (Opcode == Instruction::ExtractElement)
lib/Target/Hexagon/HexagonTargetTransformInfo.h 117 const Instruction *I = nullptr);
129 const Instruction *I);
137 const Instruction *I = nullptr);
lib/Target/Hexagon/HexagonVectorLoopCarriedReuse.cpp 170 using ChainOfDependences = SmallVector<Instruction *, 4>;
199 void push_back(Instruction *I) {
207 Instruction *front() const {
211 Instruction *back() const {
215 Instruction *&operator[](const int index) {
235 Instruction *Inst2Replace = nullptr;
240 Instruction *BackedgeInst = nullptr;
241 std::map<Instruction *, DepChain *> DepChains;
288 std::set<Instruction *> ReplacedInsts;
295 void findDepChainFromPHI(Instruction *I, DepChain &D);
298 DepChain *getDepChainBtwn(Instruction *I1, Instruction *I2, int Iters);
298 DepChain *getDepChainBtwn(Instruction *I1, Instruction *I2, int Iters);
299 bool isEquivalentOperation(Instruction *I1, Instruction *I2);
299 bool isEquivalentOperation(Instruction *I1, Instruction *I2);
300 bool canReplace(Instruction *I);
400 bool HexagonVectorLoopCarriedReuse::isEquivalentOperation(Instruction *I1,
401 Instruction *I2) {
432 bool HexagonVectorLoopCarriedReuse::canReplace(Instruction *I) {
459 Instruction *BEInst = D->back();
465 SmallVector<Instruction *, 4> PNUsers;
468 Instruction *User = cast<Instruction>(U.getUser());
468 Instruction *User = cast<Instruction>(U.getUser());
494 for (Instruction *I : PNUsers) {
498 Instruction *BEUser = cast<Instruction>(U.getUser());
498 Instruction *BEUser = cast<Instruction>(U.getUser());
516 std::map<Instruction *, DepChain *> DepChains;
522 Instruction *OpInst = dyn_cast<Instruction>(Op);
522 Instruction *OpInst = dyn_cast<Instruction>(Op);
526 Instruction *BEOpInst = dyn_cast<Instruction>(BEOp);
526 Instruction *BEOpInst = dyn_cast<Instruction>(BEOp);
556 Instruction *OpInst = dyn_cast<Instruction>(Op);
556 Instruction *OpInst = dyn_cast<Instruction>(Op);
566 Instruction *BEOpInst = dyn_cast<Instruction>(BEOp);
566 Instruction *BEOpInst = dyn_cast<Instruction>(BEOp);
602 Instruction *Inst2Replace = ReuseCandidate.Inst2Replace;
603 Instruction *BEInst = ReuseCandidate.BackedgeInst;
605 std::map<Instruction *, DepChain *> &DepChains = ReuseCandidate.DepChains;
611 SmallVector<Instruction *, 4> InstsInPreheader;
613 Instruction *InstInPreheader = Inst2Replace->clone();
616 Instruction *I = dyn_cast<Instruction>(Inst2Replace->getOperand(j));
616 Instruction *I = dyn_cast<Instruction>(Inst2Replace->getOperand(j));
639 Instruction *InstInPreheader = InstsInPreheader[i];
681 void HexagonVectorLoopCarriedReuse::findDepChainFromPHI(Instruction *I,
701 Instruction *BEInst = dyn_cast<Instruction>(BEVal);
701 Instruction *BEInst = dyn_cast<Instruction>(BEVal);
708 if(!PreHdrVal || !isa<Instruction>(PreHdrVal)) {
717 DepChain *HexagonVectorLoopCarriedReuse::getDepChainBtwn(Instruction *I1,
718 Instruction *I2,
lib/Target/Mips/Mips16HardFloat.cpp 383 for (auto &I: BB) {
lib/Target/Mips/MipsFastISel.cpp 156 bool selectLogicalOp(const Instruction *I);
157 bool selectLoad(const Instruction *I);
158 bool selectStore(const Instruction *I);
159 bool selectBranch(const Instruction *I);
160 bool selectSelect(const Instruction *I);
161 bool selectCmp(const Instruction *I);
162 bool selectFPExt(const Instruction *I);
163 bool selectFPTrunc(const Instruction *I);
164 bool selectFPToInt(const Instruction *I, bool IsSigned);
165 bool selectRet(const Instruction *I);
166 bool selectTrunc(const Instruction *I);
167 bool selectIntExt(const Instruction *I);
168 bool selectShift(const Instruction *I);
169 bool selectDivRem(const Instruction *I, unsigned ISDOpcode);
267 bool fastSelectInstruction(const Instruction *I) override;
467 unsigned Opcode = Instruction::UserOp1;
468 if (const Instruction *I = dyn_cast<Instruction>(Obj)) {
468 if (const Instruction *I = dyn_cast<Instruction>(Obj)) {
483 case Instruction::BitCast:
486 case Instruction::GetElementPtr: {
530 case Instruction::Alloca: {
548 unsigned Opcode = Instruction::UserOp1;
550 if (const auto *I = dyn_cast<Instruction>(V)) {
550 if (const auto *I = dyn_cast<Instruction>(V)) {
565 case Instruction::BitCast:
569 case Instruction::IntToPtr:
575 case Instruction::PtrToInt:
865 bool MipsFastISel::selectLogicalOp(const Instruction *I) {
874 case Instruction::And:
877 case Instruction::Or:
880 case Instruction::Xor:
892 bool MipsFastISel::selectLoad(const Instruction *I) {
914 bool MipsFastISel::selectStore(const Instruction *I) {
944 bool MipsFastISel::selectBranch(const Instruction *I) {
986 bool MipsFastISel::selectCmp(const Instruction *I) {
996 bool MipsFastISel::selectFPExt(const Instruction *I) {
1018 bool MipsFastISel::selectSelect(const Instruction *I) {
1075 bool MipsFastISel::selectFPTrunc(const Instruction *I) {
1099 bool MipsFastISel::selectFPToInt(const Instruction *I, bool IsSigned) {
1681 bool MipsFastISel::selectRet(const Instruction *I) {
1780 bool MipsFastISel::selectTrunc(const Instruction *I) {
1804 bool MipsFastISel::selectIntExt(const Instruction *I) {
1918 bool MipsFastISel::selectDivRem(const Instruction *I, unsigned ISDOpcode) {
1962 bool MipsFastISel::selectShift(const Instruction *I) {
1979 if (Opcode == Instruction::AShr || Opcode == Instruction::LShr) {
1979 if (Opcode == Instruction::AShr || Opcode == Instruction::LShr) {
1985 bool IsZExt = Opcode == Instruction::LShr;
1998 case Instruction::Shl:
2001 case Instruction::AShr:
2004 case Instruction::LShr:
2021 case Instruction::Shl:
2024 case Instruction::AShr:
2027 case Instruction::LShr:
2037 bool MipsFastISel::fastSelectInstruction(const Instruction *I) {
2041 case Instruction::Load:
2043 case Instruction::Store:
2045 case Instruction::SDiv:
2049 case Instruction::UDiv:
2053 case Instruction::SRem:
2057 case Instruction::URem:
2061 case Instruction::Shl:
2062 case Instruction::LShr:
2063 case Instruction::AShr:
2065 case Instruction::And:
2066 case Instruction::Or:
2067 case Instruction::Xor:
2069 case Instruction::Br:
2071 case Instruction::Ret:
2073 case Instruction::Trunc:
2075 case Instruction::ZExt:
2076 case Instruction::SExt:
2078 case Instruction::FPTrunc:
2080 case Instruction::FPExt:
2082 case Instruction::FPToSI:
2084 case Instruction::FPToUI:
2086 case Instruction::ICmp:
2087 case Instruction::FCmp:
2089 case Instruction::Select:
lib/Target/Mips/MipsISelLowering.cpp 4116 unsigned AS, Instruction *I) const {
lib/Target/Mips/MipsISelLowering.h 668 Instruction *I = nullptr) const override;
687 bool shouldInsertFencesForAtomic(const Instruction *I) const override {
lib/Target/Mips/MipsOs16.cpp 79 const Instruction &Inst = *I;
81 case Instruction::FAdd:
82 case Instruction::FSub:
83 case Instruction::FMul:
84 case Instruction::FDiv:
85 case Instruction::FRem:
86 case Instruction::FPToUI:
87 case Instruction::FPToSI:
88 case Instruction::UIToFP:
89 case Instruction::SIToFP:
90 case Instruction::FPTrunc:
91 case Instruction::FPExt:
92 case Instruction::FCmp:
lib/Target/NVPTX/NVPTXAllocaHoisting.cpp 43 Instruction *firstTerminatorInst = (I++)->getTerminator();
lib/Target/NVPTX/NVPTXAsmPrinter.cpp 638 if (const Instruction *instr = dyn_cast<Instruction>(U)) {
638 if (const Instruction *instr = dyn_cast<Instruction>(U)) {
687 } else if (const Instruction *I = dyn_cast<Instruction>(U)) {
687 } else if (const Instruction *I = dyn_cast<Instruction>(U)) {
736 if (!isa<Instruction>(U))
738 const Instruction *instr = cast<Instruction>(U);
738 const Instruction *instr = cast<Instruction>(U);
1825 if (Cexpr->getOpcode() == Instruction::PtrToInt) {
1847 if (Cexpr->getOpcode() == Instruction::PtrToInt) {
2014 case Instruction::AddrSpaceCast: {
2028 case Instruction::GetElementPtr: {
2045 case Instruction::Trunc:
2051 case Instruction::BitCast:
2054 case Instruction::IntToPtr: {
2065 case Instruction::PtrToInt: {
2090 case Instruction::Add: {
2095 case Instruction::Add: return MCBinaryExpr::createAdd(LHS, RHS, Ctx);
lib/Target/NVPTX/NVPTXGenericToNVVM.cpp 258 case Instruction::ICmp:
262 case Instruction::FCmp:
266 case Instruction::ExtractElement:
269 case Instruction::InsertElement:
273 case Instruction::ShuffleVector:
277 case Instruction::ExtractValue:
280 case Instruction::InsertValue:
284 case Instruction::GetElementPtr:
295 case Instruction::Select:
300 if (Instruction::isBinaryOp(Opcode)) {
305 if (Instruction::isCast(Opcode)) {
lib/Target/NVPTX/NVPTXISelLowering.cpp 1385 const Instruction *CalleeI = CS.getInstruction();
4218 unsigned AS, Instruction *I) const {
lib/Target/NVPTX/NVPTXISelLowering.h 461 Instruction *I = nullptr) const override;
lib/Target/NVPTX/NVPTXImageOptimizer.cpp 30 SmallVector<Instruction*, 4> InstrToDelete;
38 bool replaceIsTypePSampler(Instruction &I);
39 bool replaceIsTypePSurface(Instruction &I);
40 bool replaceIsTypePTexture(Instruction &I);
42 void replaceWith(Instruction *From, ConstantInt *To);
63 Instruction &Instr = *I;
92 bool NVPTXImageOptimizer::replaceIsTypePSampler(Instruction &I) {
108 bool NVPTXImageOptimizer::replaceIsTypePSurface(Instruction &I) {
127 bool NVPTXImageOptimizer::replaceIsTypePTexture(Instruction &I) {
146 void NVPTXImageOptimizer::replaceWith(Instruction *From, ConstantInt *To) {
lib/Target/NVPTX/NVPTXLowerAlloca.cpp 70 for (auto &I : BB) {
lib/Target/NVPTX/NVPTXLowerArgs.cpp 156 Instruction *FirstInst = &(Func->getEntryBlock().front());
189 InsertPt = ++cast<Instruction>(Ptr)->getIterator();
194 Instruction *PtrInGlobal = new AddrSpaceCastInst(
212 for (auto &I : B) {
lib/Target/NVPTX/NVPTXTargetTransformInfo.cpp 76 if (const Instruction *I = dyn_cast<Instruction>(V)) {
76 if (const Instruction *I = dyn_cast<Instruction>(V)) {
lib/Target/NVPTX/NVPTXTargetTransformInfo.h 98 bool hasVolatileVariant(Instruction *I, unsigned AddrSpace) {
109 case Instruction::Load:
110 case Instruction::Store:
lib/Target/NVPTX/NVVMIntrRange.cpp 83 for (Instruction &I : instructions(F)) {
lib/Target/NVPTX/NVVMReflect.cpp 86 SmallVector<Instruction *, 4> ToRemove;
114 for (Instruction &I : instructions(F)) {
176 for (Instruction *I : ToRemove)
lib/Target/PowerPC/PPCBoolRetToInt.cpp 110 auto *I = dyn_cast<Instruction>(V);
110 auto *I = dyn_cast<Instruction>(V);
202 for (auto &I : BB) {
223 if (llvm::none_of(Defs, isa<Instruction, Value *>))
264 auto *I = cast<Instruction>(U.getUser());
264 auto *I = cast<Instruction>(U.getUser());
lib/Target/PowerPC/PPCFastISel.cpp 107 bool fastSelectInstruction(const Instruction *I) override;
130 bool SelectLoad(const Instruction *I);
131 bool SelectStore(const Instruction *I);
132 bool SelectBranch(const Instruction *I);
133 bool SelectIndirectBr(const Instruction *I);
134 bool SelectFPExt(const Instruction *I);
135 bool SelectFPTrunc(const Instruction *I);
136 bool SelectIToFP(const Instruction *I, bool IsSigned);
137 bool SelectFPToI(const Instruction *I, bool IsSigned);
138 bool SelectBinaryIntOp(const Instruction *I, unsigned ISDOpcode);
139 bool SelectRet(const Instruction *I);
140 bool SelectTrunc(const Instruction *I);
141 bool SelectIntExt(const Instruction *I);
182 unsigned PPCMoveToIntReg(const Instruction *I, MVT VT,
301 if (!isa<Instruction>(V))
304 const auto *I = cast<Instruction>(V);
304 const auto *I = cast<Instruction>(V);
312 unsigned Opcode = Instruction::UserOp1;
313 if (const Instruction *I = dyn_cast<Instruction>(Obj)) {
313 if (const Instruction *I = dyn_cast<Instruction>(Obj)) {
329 case Instruction::BitCast:
332 case Instruction::IntToPtr:
338 case Instruction::PtrToInt:
343 case Instruction::GetElementPtr: {
390 case Instruction::Alloca: {
593 bool PPCFastISel::SelectLoad(const Instruction *I) {
739 bool PPCFastISel::SelectStore(const Instruction *I) {
769 bool PPCFastISel::SelectBranch(const Instruction *I) {
958 bool PPCFastISel::SelectFPExt(const Instruction *I) {
976 bool PPCFastISel::SelectFPTrunc(const Instruction *I) {
1064 bool PPCFastISel::SelectIToFP(const Instruction *I, bool IsSigned) {
1154 unsigned PPCFastISel::PPCMoveToIntReg(const Instruction *I, MVT VT,
1189 bool PPCFastISel::SelectFPToI(const Instruction *I, bool IsSigned) {
1269 bool PPCFastISel::SelectBinaryIntOp(const Instruction *I, unsigned ISDOpcode) {
1686 bool PPCFastISel::SelectRet(const Instruction *I) {
1856 bool PPCFastISel::SelectIndirectBr(const Instruction *I) {
1873 bool PPCFastISel::SelectTrunc(const Instruction *I) {
1897 bool PPCFastISel::SelectIntExt(const Instruction *I) {
1937 bool PPCFastISel::fastSelectInstruction(const Instruction *I) {
1940 case Instruction::Load:
1942 case Instruction::Store:
1944 case Instruction::Br:
1946 case Instruction::IndirectBr:
1948 case Instruction::FPExt:
1950 case Instruction::FPTrunc:
1952 case Instruction::SIToFP:
1954 case Instruction::UIToFP:
1956 case Instruction::FPToSI:
1958 case Instruction::FPToUI:
1960 case Instruction::Add:
1962 case Instruction::Or:
1964 case Instruction::Sub:
1966 case Instruction::Call:
1975 case Instruction::Ret:
1977 case Instruction::Trunc:
1979 case Instruction::ZExt:
1980 case Instruction::SExt:
lib/Target/PowerPC/PPCISelDAGToDAG.cpp 522 const Instruction *BBTerm = BB->getTerminator();
lib/Target/PowerPC/PPCISelLowering.cpp10260 static Instruction* callIntrinsic(IRBuilder<> &Builder, Intrinsic::ID Id) {
10268 Instruction *PPCTargetLowering::emitLeadingFence(IRBuilder<> &Builder,
10269 Instruction *Inst,
10278 Instruction *PPCTargetLowering::emitTrailingFence(IRBuilder<> &Builder,
10279 Instruction *Inst,
14470 unsigned AS, Instruction *I) const {
15450 isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const {
lib/Target/PowerPC/PPCISelLowering.h 750 bool shouldInsertFencesForAtomic(const Instruction *I) const override {
754 Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst,
754 Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst,
756 Instruction *emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst,
756 Instruction *emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst,
824 Instruction *I = nullptr) const override;
1227 bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override;
lib/Target/PowerPC/PPCLoopPreIncPrep.cpp 70 BucketElement(const SCEVConstant *O, Instruction *I) : Offset(O), Instr(I) {}
71 BucketElement(Instruction *I) : Offset(nullptr), Instr(I) {}
74 Instruction *Instr;
78 Bucket(const SCEV *B, Instruction *I) : BaseSCEV(B),
117 bool alreadyPrepared(Loop *L, Instruction* MemI,
130 void addOneCandidate(Instruction *MemI, const SCEV *LSCEV,
216 void PPCLoopPreIncPrep::addOneCandidate(Instruction *MemI, const SCEV *LSCEV,
245 for (auto &J : *BB) {
247 Instruction *MemI;
340 Instruction *MemI = BucketChain.Elements.begin()->Instr;
387 Instruction *InsPoint = &*Header->getFirstInsertionPt();
399 Instruction *NewBasePtr;
406 if (Instruction *IDel = dyn_cast<Instruction>(BasePtr))
406 if (Instruction *IDel = dyn_cast<Instruction>(BasePtr))
423 Instruction *RealNewPtr;
427 Instruction *PtrIP = dyn_cast<Instruction>(Ptr);
427 Instruction *PtrIP = dyn_cast<Instruction>(Ptr);
428 if (PtrIP && isa<Instruction>(NewBasePtr) &&
429 cast<Instruction>(NewBasePtr)->getParent() == PtrIP->getParent())
440 NewPtr->insertAfter(cast<Instruction>(PtrInc));
445 if (Instruction *IDel = dyn_cast<Instruction>(Ptr))
445 if (Instruction *IDel = dyn_cast<Instruction>(Ptr))
448 Instruction *ReplNewPtr;
490 bool PPCLoopPreIncPrep::alreadyPrepared(Loop *L, Instruction* MemI,
lib/Target/PowerPC/PPCTargetTransformInfo.cpp 138 case Instruction::GetElementPtr:
145 case Instruction::And:
148 case Instruction::Add:
149 case Instruction::Or:
150 case Instruction::Xor:
153 case Instruction::Sub:
154 case Instruction::Mul:
155 case Instruction::Shl:
156 case Instruction::LShr:
157 case Instruction::AShr:
160 case Instruction::ICmp:
165 case Instruction::Select:
168 case Instruction::PHI:
169 case Instruction::Call:
170 case Instruction::Ret:
171 case Instruction::Load:
172 case Instruction::Store:
446 (J->getOpcode() == Instruction::UDiv ||
447 J->getOpcode() == Instruction::SDiv ||
448 J->getOpcode() == Instruction::URem ||
449 J->getOpcode() == Instruction::SRem)) {
453 (J->getOpcode() == Instruction::Shl ||
454 J->getOpcode() == Instruction::AShr ||
455 J->getOpcode() == Instruction::LShr)) {
468 if (J->getOpcode() == Instruction::FRem)
473 case Instruction::FAdd:
474 case Instruction::FSub:
475 case Instruction::FMul:
476 case Instruction::FDiv:
477 case Instruction::FPTrunc:
478 case Instruction::FPExt:
479 case Instruction::FPToUI:
480 case Instruction::FPToSI:
481 case Instruction::UIToFP:
482 case Instruction::SIToFP:
483 case Instruction::FCmp:
530 Instruction *TI = BB->getTerminator();
745 return vectorCostAdjustment(LT.first, Instruction::ShuffleVector, Tp,
750 const Instruction *I) {
758 const Instruction *I) {
838 const Instruction *I) {
860 if (Opcode == Instruction::Load && ST->hasVSX() && IsAltivecType &&
876 if (Opcode == Instruction::Load &&
902 if (Src->isVectorTy() && Opcode == Instruction::Store)
904 Cost += getVectorInstrCost(Instruction::ExtractElement, Src, i);
lib/Target/PowerPC/PPCTargetTransformInfo.h 96 const Instruction *I = nullptr);
98 const Instruction *I = nullptr);
101 unsigned AddressSpace, const Instruction *I = nullptr);
lib/Target/RISCV/RISCVISelLowering.cpp 255 Instruction *I) const {
2721 Instruction *RISCVTargetLowering::emitLeadingFence(IRBuilder<> &Builder,
2722 Instruction *Inst,
2731 Instruction *RISCVTargetLowering::emitTrailingFence(IRBuilder<> &Builder,
2732 Instruction *Inst,
lib/Target/RISCV/RISCVISelLowering.h 70 Instruction *I = nullptr) const override;
118 bool shouldInsertFencesForAtomic(const Instruction *I) const override {
121 Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst,
121 Instruction *emitLeadingFence(IRBuilder<> &Builder, Instruction *Inst,
123 Instruction *emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst,
123 Instruction *emitTrailingFence(IRBuilder<> &Builder, Instruction *Inst,
lib/Target/RISCV/RISCVTargetTransformInfo.cpp 47 case Instruction::GetElementPtr:
52 case Instruction::Add:
53 case Instruction::And:
54 case Instruction::Or:
55 case Instruction::Xor:
56 case Instruction::Mul:
59 case Instruction::Sub:
60 case Instruction::Shl:
61 case Instruction::LShr:
62 case Instruction::AShr:
72 if (Instruction::isCommutative(Opcode) || Idx == ImmArgIdx) {
lib/Target/Sparc/SparcISelLowering.h 198 bool shouldInsertFencesForAtomic(const Instruction *I) const override {
lib/Target/SystemZ/SystemZISelLowering.cpp 838 supportedAddressingMode(Instruction *I, bool HasVector) {
850 auto *SingleUser = cast<Instruction>(*I->user_begin());
850 auto *SingleUser = cast<Instruction>(*I->user_begin());
906 const AddrMode &AM, Type *Ty, unsigned AS, Instruction *I) const {
3840 SystemZTargetLowering::getMMOFlags(const Instruction &I) const {
lib/Target/SystemZ/SystemZISelLowering.h 414 Instruction *I = nullptr) const override;
657 MachineMemOperand::Flags getMMOFlags(const Instruction &I) const override;
lib/Target/SystemZ/SystemZTDC.cpp 77 MapVector<Instruction *, std::tuple<Value *, int, bool>> ConvertedInsts;
81 std::set<Instruction *> PossibleJunk;
95 void converted(Instruction *I, Value *V, int Mask, bool Worthy) {
102 (LI->getOpcode() == Instruction::And ||
103 LI->getOpcode() == Instruction::Or ||
104 LI->getOpcode() == Instruction::Xor)) {
290 std::tie(Op0, Mask0, Worthy0) = ConvertedInsts[cast<Instruction>(I.getOperand(0))];
291 std::tie(Op1, Mask1, Worthy1) = ConvertedInsts[cast<Instruction>(I.getOperand(1))];
296 case Instruction::And:
299 case Instruction::Or:
302 case Instruction::Xor:
317 for (auto &I : instructions(F)) {
318 if (I.getOpcode() == Instruction::FCmp)
320 else if (I.getOpcode() == Instruction::ICmp)
334 if (ConvertedInsts.count(dyn_cast<Instruction>(Op->getOperand(0))) &&
335 ConvertedInsts.count(dyn_cast<Instruction>(Op->getOperand(1))) &&
348 Instruction *I = It.first;
362 Instruction *TDC = IRB.CreateCall(TDCFunc, {V, MaskVal});
376 for (auto *I : PossibleJunk)
lib/Target/SystemZ/SystemZTargetTransformInfo.cpp 81 case Instruction::GetElementPtr:
88 case Instruction::Store:
98 case Instruction::ICmp:
108 case Instruction::Add:
109 case Instruction::Sub:
119 case Instruction::Mul:
126 case Instruction::Or:
127 case Instruction::Xor:
137 case Instruction::And:
155 case Instruction::Shl:
156 case Instruction::LShr:
157 case Instruction::AShr:
162 case Instruction::UDiv:
163 case Instruction::SDiv:
164 case Instruction::URem:
165 case Instruction::SRem:
166 case Instruction::Trunc:
167 case Instruction::ZExt:
168 case Instruction::SExt:
169 case Instruction::IntToPtr:
170 case Instruction::PtrToInt:
171 case Instruction::BitCast:
172 case Instruction::PHI:
173 case Instruction::Call:
174 case Instruction::Select:
175 case Instruction::Ret:
176 case Instruction::Load:
247 for (auto &I : *BB) {
262 NumStores += getMemoryOpCost(Instruction::Store, MemAccessTy, None, 0);
374 Opcode == Instruction::SDiv || Opcode == Instruction::SRem;
374 Opcode == Instruction::SDiv || Opcode == Instruction::SRem;
376 Opcode == Instruction::UDiv || Opcode == Instruction::URem;
376 Opcode == Instruction::UDiv || Opcode == Instruction::URem;
403 if (Opcode == Instruction::Shl || Opcode == Instruction::LShr ||
403 if (Opcode == Instruction::Shl || Opcode == Instruction::LShr ||
404 Opcode == Instruction::AShr) {
423 if (Opcode == Instruction::FAdd || Opcode == Instruction::FSub ||
423 if (Opcode == Instruction::FAdd || Opcode == Instruction::FSub ||
424 Opcode == Instruction::FMul || Opcode == Instruction::FDiv) {
424 Opcode == Instruction::FMul || Opcode == Instruction::FDiv) {
450 if (Opcode == Instruction::FRem) {
462 if (Opcode == Instruction::FAdd || Opcode == Instruction::FSub ||
462 if (Opcode == Instruction::FAdd || Opcode == Instruction::FSub ||
463 Opcode == Instruction::FMul || Opcode == Instruction::FDiv)
463 Opcode == Instruction::FMul || Opcode == Instruction::FDiv)
467 if (Opcode == Instruction::FRem)
472 if (Opcode == Instruction::Xor) {
474 if (const Instruction *I = dyn_cast<Instruction>(A))
474 if (const Instruction *I = dyn_cast<Instruction>(A))
476 (I->getOpcode() == Instruction::And ||
477 I->getOpcode() == Instruction::Or ||
478 I->getOpcode() == Instruction::Xor))
482 else if (Opcode == Instruction::Or || Opcode == Instruction::And) {
482 else if (Opcode == Instruction::Or || Opcode == Instruction::And) {
484 if (const Instruction *I = dyn_cast<Instruction>(A))
484 if (const Instruction *I = dyn_cast<Instruction>(A))
485 if (I->hasOneUse() && I->getOpcode() == Instruction::Xor)
492 if (Opcode == Instruction::Or)
495 if (Opcode == Instruction::Xor && ScalarBits == 1) {
628 static Type *getCmpOpsType(const Instruction *I, unsigned VF = 1) {
632 else if (Instruction *LogicI = dyn_cast<Instruction>(I->getOperand(0)))
632 else if (Instruction *LogicI = dyn_cast<Instruction>(I->getOperand(0)))
656 const Instruction *I) {
665 if (Opcode == Instruction::ZExt || Opcode == Instruction::UIToFP)
665 if (Opcode == Instruction::ZExt || Opcode == Instruction::UIToFP)
672 const Instruction *I) {
683 if (Opcode == Instruction::Trunc) {
689 if (Opcode == Instruction::ZExt || Opcode == Instruction::SExt) {
689 if (Opcode == Instruction::ZExt || Opcode == Instruction::SExt) {
706 if (Opcode == Instruction::SIToFP || Opcode == Instruction::UIToFP ||
706 if (Opcode == Instruction::SIToFP || Opcode == Instruction::UIToFP ||
707 Opcode == Instruction::FPToSI || Opcode == Instruction::FPToUI) {
707 Opcode == Instruction::FPToSI || Opcode == Instruction::FPToUI) {
729 (Opcode == Instruction::SIToFP || Opcode == Instruction::UIToFP))
729 (Opcode == Instruction::SIToFP || Opcode == Instruction::UIToFP))
732 (Opcode == Instruction::FPToSI || Opcode == Instruction::FPToUI))
732 (Opcode == Instruction::FPToSI || Opcode == Instruction::FPToUI))
745 if (Opcode == Instruction::FPTrunc) {
752 if (Opcode == Instruction::FPExt) {
766 if (Opcode == Instruction::SIToFP || Opcode == Instruction::UIToFP) {
766 if (Opcode == Instruction::SIToFP || Opcode == Instruction::UIToFP) {
773 if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt) &&
773 if ((Opcode == Instruction::ZExt || Opcode == Instruction::SExt) &&
781 if (Opcode == Instruction::SExt)
783 if (Opcode == Instruction::ZExt)
798 static unsigned getOperandsExtensionCost(const Instruction *I) {
809 Type *CondTy, const Instruction *I) {
815 if (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) {
815 if (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) {
862 case Instruction::ICmp: {
878 case Instruction::Select:
892 if (Opcode == Instruction::InsertElement && Val->isIntOrIntVectorTy(64))
895 if (Opcode == Instruction::ExtractElement) {
910 isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue) {
914 const Instruction *UserI = cast<Instruction>(*Ld->user_begin());
914 const Instruction *UserI = cast<Instruction>(*Ld->user_begin());
930 UserI = cast<Instruction>(*UserI->user_begin());
933 if ((UserI->getOpcode() == Instruction::Sub ||
934 UserI->getOpcode() == Instruction::SDiv ||
935 UserI->getOpcode() == Instruction::UDiv) &&
943 case Instruction::Add: // SE: 16->32, 16/32->64, z14:16->64. ZE: 32->64
944 case Instruction::Sub:
945 case Instruction::ICmp:
949 case Instruction::Mul: // SE: 16->32, 32->64, z14:16->64
950 if (UserI->getOpcode() != Instruction::ICmp) {
959 case Instruction::SDiv:// SE: 32->64
963 case Instruction::UDiv:
964 case Instruction::And:
965 case Instruction::Or:
966 case Instruction::Xor:
978 if (UserI->getOpcode() == Instruction::ICmp)
989 if (const Instruction *I = dyn_cast<Instruction>(V))
989 if (const Instruction *I = dyn_cast<Instruction>(V))
999 const Instruction *I) {
1002 if (!Src->isVectorTy() && Opcode == Instruction::Load && I != nullptr) {
1004 const Instruction *FoldedValue = nullptr;
1006 const Instruction *UserI = cast<Instruction>(*FoldedValue->user_begin());
1006 const Instruction *UserI = cast<Instruction>(*FoldedValue->user_begin());
1015 if (Instruction *OtherOp = dyn_cast<Instruction>(UserI->getOperand(i))){
1015 if (Instruction *OtherOp = dyn_cast<Instruction>(UserI->getOperand(i))){
1036 if (Opcode == Instruction::Load && I->hasOneUse()) {
1037 const Instruction *LdUser = cast<Instruction>(*I->user_begin());
1037 const Instruction *LdUser = cast<Instruction>(*I->user_begin());
1086 if (Opcode == Instruction::Load) {
lib/Target/SystemZ/SystemZTargetTransformInfo.h 83 const Instruction *I);
85 const Instruction *I = nullptr);
87 const Instruction *I = nullptr);
89 bool isFoldableLoad(const LoadInst *Ld, const Instruction *&FoldedValue);
91 unsigned AddressSpace, const Instruction *I = nullptr);
lib/Target/WebAssembly/WebAssemblyFastISel.cpp 179 bool selectCall(const Instruction *I);
180 bool selectSelect(const Instruction *I);
181 bool selectTrunc(const Instruction *I);
182 bool selectZExt(const Instruction *I);
183 bool selectSExt(const Instruction *I);
184 bool selectICmp(const Instruction *I);
185 bool selectFCmp(const Instruction *I);
186 bool selectBitCast(const Instruction *I);
187 bool selectLoad(const Instruction *I);
188 bool selectStore(const Instruction *I);
189 bool selectBr(const Instruction *I);
190 bool selectRet(const Instruction *I);
191 bool selectUnreachable(const Instruction *I);
202 bool fastSelectInstruction(const Instruction *I) override;
211 unsigned Opcode = Instruction::UserOp1;
212 if (const auto *I = dyn_cast<Instruction>(Obj)) {
212 if (const auto *I = dyn_cast<Instruction>(Obj)) {
245 case Instruction::BitCast: {
249 case Instruction::IntToPtr: {
256 case Instruction::PtrToInt: {
262 case Instruction::GetElementPtr: {
318 case Instruction::Alloca: {
332 case Instruction::Add: {
355 case Instruction::Sub: {
745 bool WebAssemblyFastISel::selectCall(const Instruction *I) {
887 bool WebAssemblyFastISel::selectSelect(const Instruction *I) {
946 bool WebAssemblyFastISel::selectTrunc(const Instruction *I) {
965 bool WebAssemblyFastISel::selectZExt(const Instruction *I) {
982 bool WebAssemblyFastISel::selectSExt(const Instruction *I) {
999 bool WebAssemblyFastISel::selectICmp(const Instruction *I) {
1060 bool WebAssemblyFastISel::selectFCmp(const Instruction *I) {
1125 bool WebAssemblyFastISel::selectBitCast(const Instruction *I) {
1156 bool WebAssemblyFastISel::selectLoad(const Instruction *I) {
1213 bool WebAssemblyFastISel::selectStore(const Instruction *I) {
1269 bool WebAssemblyFastISel::selectBr(const Instruction *I) {
1297 bool WebAssemblyFastISel::selectRet(const Instruction *I) {
1354 bool WebAssemblyFastISel::selectUnreachable(const Instruction *I) {
1360 bool WebAssemblyFastISel::fastSelectInstruction(const Instruction *I) {
1362 case Instruction::Call:
1366 case Instruction::Select:
1368 case Instruction::Trunc:
1370 case Instruction::ZExt:
1372 case Instruction::SExt:
1374 case Instruction::ICmp:
1376 case Instruction::FCmp:
1378 case Instruction::BitCast:
1380 case Instruction::Load:
1382 case Instruction::Store:
1384 case Instruction::Br:
1386 case Instruction::Ret:
1388 case Instruction::Unreachable:
lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp 151 Instruction *PtrCast =
191 Instruction *Cast =
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp 515 Instruction *I) const {
lib/Target/WebAssembly/WebAssemblyISelLowering.h 61 Instruction *I = nullptr) const override;
lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp 261 void wrapTestSetjmp(BasicBlock *BB, Instruction *InsertPt, Value *Threw,
540 BasicBlock *BB, Instruction *InsertPt, Value *Threw, Value *SetjmpTable,
605 for (Instruction &I : BB) {
611 auto *User = cast<Instruction>(U.getUser());
611 auto *User = cast<Instruction>(U.getUser());
713 auto *UI = cast<Instruction>(U);
713 auto *UI = cast<Instruction>(U);
744 SmallVector<Instruction *, 64> ToErase;
790 for (Instruction &I : BB) {
809 for (Instruction &I : BB) {
829 Instruction *I = BB.getFirstNonPHI();
867 for (Instruction *I : ToErase)
877 SmallVector<Instruction *, 64> ToErase;
879 std::vector<Instruction *> SetjmpTableInsts;
881 std::vector<Instruction *> SetjmpTableSizeInsts;
891 Instruction::Add, IRB.getInt32(4), IRB.getInt32(0), "setjmpTableSize",
894 Instruction *SetjmpTable = CallInst::CreateMalloc(
937 Instruction *NewSetjmpTable =
939 Instruction *NewSetjmpTableSize =
959 for (Instruction &I : *BB) {
1049 for (Instruction *I : ToErase)
1054 Instruction *TI = BB.getTerminator();
1075 for (Instruction *I : SetjmpTableInsts)
1077 for (Instruction *I : SetjmpTableSizeInsts)
1086 if (auto *I = dyn_cast<Instruction>(U.getUser()))
1086 if (auto *I = dyn_cast<Instruction>(U.getUser()))
1094 if (auto *I = dyn_cast<Instruction>(U.getUser()))
1094 if (auto *I = dyn_cast<Instruction>(U.getUser()))
lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp 61 Instruction *Inst = CS.getInstruction();
lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp 242 for (auto &I : B) {
lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp 56 case Instruction::LShr:
57 case Instruction::AShr:
58 case Instruction::Shl:
lib/Target/X86/X86FastISel.cpp 68 bool fastSelectInstruction(const Instruction *I) override;
102 bool X86SelectLoad(const Instruction *I);
104 bool X86SelectStore(const Instruction *I);
106 bool X86SelectRet(const Instruction *I);
108 bool X86SelectCmp(const Instruction *I);
110 bool X86SelectZExt(const Instruction *I);
112 bool X86SelectSExt(const Instruction *I);
114 bool X86SelectBranch(const Instruction *I);
116 bool X86SelectShift(const Instruction *I);
118 bool X86SelectDivRem(const Instruction *I);
120 bool X86FastEmitCMoveSelect(MVT RetVT, const Instruction *I);
122 bool X86FastEmitSSESelect(MVT RetVT, const Instruction *I);
124 bool X86FastEmitPseudoSelect(MVT RetVT, const Instruction *I);
126 bool X86SelectSelect(const Instruction *I);
128 bool X86SelectTrunc(const Instruction *I);
130 bool X86SelectFPExtOrFPTrunc(const Instruction *I, unsigned Opc,
133 bool X86SelectFPExt(const Instruction *I);
134 bool X86SelectFPTrunc(const Instruction *I);
135 bool X86SelectSIToFP(const Instruction *I);
136 bool X86SelectUIToFP(const Instruction *I);
137 bool X86SelectIntToFP(const Instruction *I, bool IsSigned);
171 bool foldX86XALUIntrinsic(X86::CondCode &CC, const Instruction *I,
237 bool X86FastISel::foldX86XALUIntrinsic(X86::CondCode &CC, const Instruction *I,
832 unsigned Opcode = Instruction::UserOp1;
833 if (const Instruction *I = dyn_cast<Instruction>(V)) {
833 if (const Instruction *I = dyn_cast<Instruction>(V)) {
855 case Instruction::BitCast:
859 case Instruction::IntToPtr:
866 case Instruction::PtrToInt:
872 case Instruction::Alloca: {
885 case Instruction::Add: {
898 case Instruction::GetElementPtr: {
991 unsigned Opcode = Instruction::UserOp1;
992 const Instruction *I = dyn_cast<Instruction>(V);
992 const Instruction *I = dyn_cast<Instruction>(V);
1028 case Instruction::BitCast:
1034 case Instruction::IntToPtr:
1042 case Instruction::PtrToInt:
1101 bool X86FastISel::X86SelectStore(const Instruction *I) {
1144 bool X86FastISel::X86SelectRet(const Instruction *I) {
1292 bool X86FastISel::X86SelectLoad(const Instruction *I) {
1425 bool X86FastISel::X86SelectCmp(const Instruction *I) {
1519 bool X86FastISel::X86SelectZExt(const Instruction *I) {
1578 bool X86FastISel::X86SelectSExt(const Instruction *I) {
1624 bool X86FastISel::X86SelectBranch(const Instruction *I) {
1779 bool X86FastISel::X86SelectShift(const Instruction *I) {
1786 case Instruction::LShr: OpReg = X86::SHR8rCL; break;
1787 case Instruction::AShr: OpReg = X86::SAR8rCL; break;
1788 case Instruction::Shl: OpReg = X86::SHL8rCL; break;
1796 case Instruction::LShr: OpReg = X86::SHR16rCL; break;
1797 case Instruction::AShr: OpReg = X86::SAR16rCL; break;
1798 case Instruction::Shl: OpReg = X86::SHL16rCL; break;
1805 case Instruction::LShr: OpReg = X86::SHR32rCL; break;
1806 case Instruction::AShr: OpReg = X86::SAR32rCL; break;
1807 case Instruction::Shl: OpReg = X86::SHL32rCL; break;
1814 case Instruction::LShr: OpReg = X86::SHR64rCL; break;
1815 case Instruction::AShr: OpReg = X86::SAR64rCL; break;
1816 case Instruction::Shl: OpReg = X86::SHL64rCL; break;
1848 bool X86FastISel::X86SelectDivRem(const Instruction *I) {
1927 case Instruction::SDiv: OpIndex = 0; break;
1928 case Instruction::SRem: OpIndex = 1; break;
1929 case Instruction::UDiv: OpIndex = 2; break;
1930 case Instruction::URem: OpIndex = 3; break;
1985 if ((I->getOpcode() == Instruction::SRem ||
1986 I->getOpcode() == Instruction::URem) &&
2014 bool X86FastISel::X86FastEmitCMoveSelect(MVT RetVT, const Instruction *I) {
2146 bool X86FastISel::X86FastEmitSSESelect(MVT RetVT, const Instruction *I) {
2281 bool X86FastISel::X86FastEmitPseudoSelect(MVT RetVT, const Instruction *I) {
2359 bool X86FastISel::X86SelectSelect(const Instruction *I) {
2406 bool X86FastISel::X86SelectIntToFP(const Instruction *I, bool IsSigned) {
2459 bool X86FastISel::X86SelectSIToFP(const Instruction *I) {
2463 bool X86FastISel::X86SelectUIToFP(const Instruction *I) {
2468 bool X86FastISel::X86SelectFPExtOrFPTrunc(const Instruction *I,
2501 bool X86FastISel::X86SelectFPExt(const Instruction *I) {
2515 bool X86FastISel::X86SelectFPTrunc(const Instruction *I) {
2529 bool X86FastISel::X86SelectTrunc(const Instruction *I) {
3602 X86FastISel::fastSelectInstruction(const Instruction *I) {
3605 case Instruction::Load:
3607 case Instruction::Store:
3609 case Instruction::Ret:
3611 case Instruction::ICmp:
3612 case Instruction::FCmp:
3614 case Instruction::ZExt:
3616 case Instruction::SExt:
3618 case Instruction::Br:
3620 case Instruction::LShr:
3621 case Instruction::AShr:
3622 case Instruction::Shl:
3624 case Instruction::SDiv:
3625 case Instruction::UDiv:
3626 case Instruction::SRem:
3627 case Instruction::URem:
3629 case Instruction::Select:
3631 case Instruction::Trunc:
3633 case Instruction::FPExt:
3635 case Instruction::FPTrunc:
3637 case Instruction::SIToFP:
3639 case Instruction::UIToFP:
3641 case Instruction::IntToPtr: // Deliberate fall-through.
3642 case Instruction::PtrToInt: {
3654 case Instruction::BitCast: {
lib/Target/X86/X86ISelLowering.cpp 5049 const Instruction &AndI) const {
28904 Instruction *I) const {
lib/Target/X86/X86ISelLowering.h 858 bool isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const override;
1000 Instruction *I = nullptr) const override;
lib/Target/X86/X86InstructionSelector.cpp 1687 if ((I.getOpcode() == Instruction::SRem ||
1688 I.getOpcode() == Instruction::URem) &&
lib/Target/X86/X86InterleavedAccess.cpp 52 Instruction *const Inst;
72 void decompose(Instruction *Inst, unsigned NumSubVectors, VectorType *T,
73 SmallVectorImpl<Instruction *> &DecomposedVectors);
88 void transpose_4x4(ArrayRef<Instruction *> InputVectors,
90 void interleave8bitStride4(ArrayRef<Instruction *> InputVectors,
93 void interleave8bitStride4VF8(ArrayRef<Instruction *> InputVectors,
95 void interleave8bitStride3(ArrayRef<Instruction *> InputVectors,
98 void deinterleave8bitStride3(ArrayRef<Instruction *> InputVectors,
109 explicit X86InterleavedAccessGroup(Instruction *I,
168 Instruction *VecInst, unsigned NumSubVectors, VectorType *SubVecTy,
169 SmallVectorImpl<Instruction *> &DecomposedVectors) {
218 Instruction *NewLoad =
318 ArrayRef<Instruction *> Matrix,
358 ArrayRef<Instruction *> Matrix, SmallVectorImpl<Value *> &TransposedMatrix,
521 static void concatSubVector(Value **Vec, ArrayRef<Instruction *> InVec,
542 ArrayRef<Instruction *> InVec, SmallVectorImpl<Value *> &TransposedMatrix,
628 ArrayRef<Instruction *> InVec, SmallVectorImpl<Value *> &TransposedMatrix,
689 ArrayRef<Instruction *> Matrix,
722 SmallVector<Instruction *, 4> DecomposedVectors;
lib/Target/X86/X86TargetTransformInfo.cpp 258 2 * getArithmeticInstrCost(Instruction::AShr, Ty, Op1Info, Op2Info,
261 Cost += getArithmeticInstrCost(Instruction::LShr, Ty, Op1Info, Op2Info,
264 Cost += getArithmeticInstrCost(Instruction::Add, Ty, Op1Info, Op2Info,
270 Cost += getArithmeticInstrCost(Instruction::Mul, Ty, Op1Info, Op2Info);
271 Cost += getArithmeticInstrCost(Instruction::Sub, Ty, Op1Info, Op2Info);
279 return getArithmeticInstrCost(Instruction::LShr, Ty, Op1Info, Op2Info,
284 return getArithmeticInstrCost(Instruction::And, Ty, Op1Info, Op2Info,
577 return getArithmeticInstrCost(Instruction::Mul, Ty, Op1Info, Op2Info,
1273 const Instruction *I) {
1695 const Instruction *I) {
1705 if (I && (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp)) {
1705 if (I && (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp)) {
2401 if (Opcode == Instruction::ExtractElement && ScalarType->isPointerTy())
2409 const Instruction *I) {
2429 int SplitCost = getScalarizationOverhead(Src, Opcode == Instruction::Load,
2430 Opcode == Instruction::Store);
2454 bool IsLoad = (Instruction::Load == Opcode);
2455 bool IsStore = (Instruction::Store == Opcode);
2471 Instruction::ICmp, Type::getInt8Ty(SrcVTy->getContext()), nullptr);
2472 int BranchCost = getCFInstrCost(Instruction::Br);
2974 case Instruction::GetElementPtr:
2981 case Instruction::Store:
2984 case Instruction::ICmp:
2997 case Instruction::And:
3005 case Instruction::Add:
3006 case Instruction::Sub:
3012 case Instruction::UDiv:
3013 case Instruction::SDiv:
3014 case Instruction::URem:
3015 case Instruction::SRem:
3020 case Instruction::Mul:
3021 case Instruction::Or:
3022 case Instruction::Xor:
3026 case Instruction::Shl:
3027 case Instruction::LShr:
3028 case Instruction::AShr:
3032 case Instruction::Trunc:
3033 case Instruction::ZExt:
3034 case Instruction::SExt:
3035 case Instruction::IntToPtr:
3036 case Instruction::PtrToInt:
3037 case Instruction::BitCast:
3038 case Instruction::PHI:
3039 case Instruction::Call:
3040 case Instruction::Select:
3041 case Instruction::Ret:
3042 case Instruction::Load:
3164 const int GSOverhead = (Opcode == Instruction::Load)
3190 getCmpSelInstrCost(Instruction::ICmp, Type::getInt1Ty(SrcVTy->getContext()),
3192 int BranchCost = getCFInstrCost(Instruction::Br);
3201 if (Opcode == Instruction::Load)
3205 getVectorInstrCost(Instruction::InsertElement, SrcVTy, i);
3210 getVectorInstrCost(Instruction::ExtractElement, SrcVTy, i);
3228 if ((Opcode == Instruction::Load && !isLegalMaskedGather(SrcVTy)) ||
3229 (Opcode == Instruction::Store && !isLegalMaskedScatter(SrcVTy)))
3577 if (Opcode == Instruction::Load) {
3630 if (Opcode == Instruction::Load) {
lib/Target/X86/X86TargetTransformInfo.h 133 const Instruction *I = nullptr);
135 const Instruction *I = nullptr);
138 unsigned AddressSpace, const Instruction *I = nullptr);
lib/Target/X86/X86WinEHState.cpp 63 void insertStateNumberStore(Instruction *IP, int State);
368 Instruction *T = BB.getTerminator();
468 Instruction *Inst = CS.getInstruction();
508 Instruction *NewInst = NewCS.getInstruction();
678 for (Instruction &I : *BB) {
745 for (Instruction &I : *BB) {
765 for (Instruction &I : *BB) {
795 void WinEHStatePass::insertStateNumberStore(Instruction *IP, int State) {
lib/Target/XCore/XCoreISelLowering.cpp 998 XCoreTargetLowering::getMMOFlags(const Instruction &I) const {
1886 Instruction *I) const {
lib/Target/XCore/XCoreISelLowering.h 126 Instruction *I = nullptr) const override;
191 MachineMemOperand::Flags getMMOFlags(const Instruction &I) const override;
230 bool shouldInsertFencesForAtomic(const Instruction *I) const override {
lib/Target/XCore/XCoreLowerThreadLocal.cpp 76 static Instruction *
77 createReplacementInstr(ConstantExpr *CE, Instruction *Instr) {
81 case Instruction::GetElementPtr: {
84 return dyn_cast<Instruction>(Builder.CreateInBoundsGEP(
88 case Instruction::Add:
89 case Instruction::Sub:
90 case Instruction::Mul:
91 case Instruction::UDiv:
92 case Instruction::SDiv:
93 case Instruction::FDiv:
94 case Instruction::URem:
95 case Instruction::SRem:
96 case Instruction::FRem:
97 case Instruction::Shl:
98 case Instruction::LShr:
99 case Instruction::AShr:
100 case Instruction::And:
101 case Instruction::Or:
102 case Instruction::Xor:
103 return dyn_cast<Instruction>(
107 case Instruction::Trunc:
108 case Instruction::ZExt:
109 case Instruction::SExt:
110 case Instruction::FPToUI:
111 case Instruction::FPToSI:
112 case Instruction::UIToFP:
113 case Instruction::SIToFP:
114 case Instruction::FPTrunc:
115 case Instruction::FPExt:
116 case Instruction::PtrToInt:
117 case Instruction::IntToPtr:
118 case Instruction::BitCast:
119 return dyn_cast<Instruction>(
141 Instruction *InsertPos = PredBB->getTerminator();
142 Instruction *NewInst = createReplacementInstr(CE, InsertPos);
145 } else if (Instruction *Instr = dyn_cast<Instruction>(WU)) {
145 } else if (Instruction *Instr = dyn_cast<Instruction>(WU)) {
146 Instruction *NewInst = createReplacementInstr(CE, Instr);
163 if (!isa<Instruction>(U))
206 Instruction *Inst = cast<Instruction>(U);
206 Instruction *Inst = cast<Instruction>(U);
lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp 64 static bool foldGuardedRotateToFunnelShift(Instruction &I) {
65 if (I.getOpcode() != Instruction::PHI || I.getNumOperands() != 2)
123 Instruction *TermI = GuardBB->getTerminator();
221 static bool foldAnyOrAllBitsSet(Instruction &I) {
264 static bool tryToRecognizePopCount(Instruction &I) {
265 if (I.getOpcode() != Instruction::LShr)
334 for (Instruction &I : make_range(BB.rbegin(), BB.rend())) {
lib/Transforms/AggressiveInstCombine/AggressiveInstCombineInternal.h 76 MapVector<Instruction *, Info> InstInfoMap;
lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp 41 static void getRelevantOperands(Instruction *I, SmallVectorImpl<Value *> &Ops) {
44 case Instruction::Trunc:
45 case Instruction::ZExt:
46 case Instruction::SExt:
50 case Instruction::Add:
51 case Instruction::Sub:
52 case Instruction::Mul:
53 case Instruction::And:
54 case Instruction::Or:
55 case Instruction::Xor:
66 SmallVector<Instruction *, 8> Stack;
80 auto *I = dyn_cast<Instruction>(Curr);
80 auto *I = dyn_cast<Instruction>(Curr);
104 case Instruction::Trunc:
105 case Instruction::ZExt:
106 case Instruction::SExt:
112 case Instruction::Add:
113 case Instruction::Sub:
114 case Instruction::Mul:
115 case Instruction::And:
116 case Instruction::Or:
117 case Instruction::Xor: {
139 SmallVector<Instruction *, 8> Stack;
151 InstInfoMap[cast<Instruction>(Src)].ValidBitWidth = TruncBitWidth;
162 auto *I = cast<Instruction>(Curr);
162 auto *I = cast<Instruction>(Curr);
175 if (auto *IOp = dyn_cast<Instruction>(Operand))
175 if (auto *IOp = dyn_cast<Instruction>(Operand))
190 if (auto *IOp = dyn_cast<Instruction>(Operand)) {
190 if (auto *IOp = dyn_cast<Instruction>(Operand)) {
201 unsigned MinBitWidth = InstInfoMap.lookup(cast<Instruction>(Src)).MinBitWidth;
238 Instruction *I = Itr.first;
243 if (auto *UI = dyn_cast<Instruction>(U))
243 if (auto *UI = dyn_cast<Instruction>(U))
294 auto *I = cast<Instruction>(V);
294 auto *I = cast<Instruction>(V);
302 Instruction *I = Itr.first;
311 case Instruction::Trunc:
312 case Instruction::ZExt:
313 case Instruction::SExt: {
326 Opc == Instruction::SExt);
343 case Instruction::Add:
344 case Instruction::Sub:
345 case Instruction::Mul:
346 case Instruction::And:
347 case Instruction::Or:
348 case Instruction::Xor: {
359 if (auto *ResI = dyn_cast<Instruction>(Res))
359 if (auto *ResI = dyn_cast<Instruction>(Res))
368 if (auto *ResI = dyn_cast<Instruction>(Res))
368 if (auto *ResI = dyn_cast<Instruction>(Res))
395 for (auto &I : BB)
lib/Transforms/CFGuard/CFGuard.cpp 268 for (Instruction &I : BB.getInstList()) {
lib/Transforms/Coroutines/CoroCleanup.cpp 61 Instruction &I = *IB++;
lib/Transforms/Coroutines/CoroEarly.cpp 158 Instruction &I = *IB++;
lib/Transforms/Coroutines/CoroElide.cpp 80 for (Instruction &I : instructions(F))
99 static Instruction *getFirstNonAllocaInTheEntryBlock(Function *F) {
100 for (Instruction &I : F->getEntryBlock())
110 auto *InsertPt =
156 SmallPtrSet<Instruction *, 8> Terminators;
158 auto *TI = B.getTerminator();
167 for (Instruction *TI : Terminators) {
258 for (auto &I : instructions(F))
305 for (auto &I : instructions(F))
lib/Transforms/Coroutines/CoroFrame.cpp 116 auto *I = cast<Instruction>(U);
116 auto *I = cast<Instruction>(U);
141 bool isDefinitionAcrossSuspend(Instruction &I, User *U) const {
291 Instruction *User = nullptr;
295 Spill(Value *Def, llvm::User *U) : Def(Def), User(cast<Instruction>(U)) {}
298 Instruction *user() const { return User; }
500 void visit(Instruction &I) {
506 void visit(Instruction *I) { return visit(*I); }
517 void visitInstruction(Instruction &I) { PI.setAborted(&I); }
530 auto *PointerEscapingInstr = PtrI.getEscapingInst()
552 static Instruction *splitBeforeCatchSwitch(CatchSwitchInst *CatchSwitch) {
586 static Instruction *insertSpills(const SpillInfo &Spills, coro::Shape &Shape) {
592 auto *FramePtr =
593 cast<Instruction>(Builder.CreateBitCast(CB, FramePtrTy, "FramePtr"));
672 Instruction *InsertPt = nullptr;
691 BasicBlock *DefBlock = cast<Instruction>(E.def())->getParent();
701 auto *I = cast<Instruction>(E.def());
701 auto *I = cast<Instruction>(E.def());
754 SmallVector<Instruction *, 4> UsersToUpdate;
759 auto *I = cast<Instruction>(U);
759 auto *I = cast<Instruction>(U);
768 for (Instruction *I : UsersToUpdate)
796 static void setUnwindEdgeTo(Instruction *TI, BasicBlock *Succ) {
839 auto *PadInst = Succ->getFirstNonPHI();
848 auto *NewLP = OriginalPad->clone();
941 static bool materializable(Instruction &V) {
948 static bool isCoroutineStructureIntrinsic(Instruction &I) {
958 Instruction *CurrentMaterialization = nullptr;
959 Instruction *CurrentDef = nullptr;
964 CurrentDef = cast<Instruction>(E.def());
972 CurrentMaterialization = cast<Instruction>(CurrentDef)->clone();
994 static BasicBlock *splitBlockIfNotFirst(Instruction *I, const Twine &Name) {
1007 static void splitAround(Instruction *I, const Twine &Name) {
1095 SmallVectorImpl<Instruction*> &DeadInsts) {
1128 DeadInsts.push_back(cast<Instruction>(U));
1138 static Instruction *lowerNonLocalAlloca(CoroAllocaAllocInst *AI,
1140 SmallVectorImpl<Instruction*> &DeadInsts) {
1152 DeadInsts.push_back(cast<Instruction>(U));
1159 return cast<Instruction>(Alloc);
1196 static Value *emitSetAndGetSwiftErrorValueAround(Instruction *Call,
1241 auto Call = cast<Instruction>(User);
1306 for (auto &Inst : F.getEntryBlock()) {
1360 SmallVector<Instruction*, 4> DeadInstructions;
1364 for (Instruction &I : instructions(F))
1385 for (Instruction &I : instructions(F)) {
lib/Transforms/Coroutines/CoroInstr.h 134 auto *Inst = cast<Instruction>(Arg);
134 auto *Inst = cast<Instruction>(Arg);
lib/Transforms/Coroutines/CoroInternal.h 62 Value *makeSubFnCall(Value *Arg, int Index, Instruction *InsertPt);
109 Instruction *FramePtr;
lib/Transforms/Coroutines/CoroSplit.cpp 281 auto *FramePtr = Shape.FramePtr;
890 scanPHIsAndUpdateValueMap(Instruction *Prev, BasicBlock *NewBlock,
907 static bool simplifyTerminatorLeadingToRet(Instruction *InitialInst) {
910 Instruction *I = InitialInst;
951 for (auto &I : instructions(F))
1006 static bool hasCallsInBlockBetween(Instruction *From, Instruction *To) {
1006 static bool hasCallsInBlockBetween(Instruction *From, Instruction *To) {
1007 for (Instruction *I = From; I != To; I = I->getNextNode()) {
1047 static bool hasCallsBetween(Instruction *Save, Instruction *ResumeOrDestroy) {
1047 static bool hasCallsBetween(Instruction *Save, Instruction *ResumeOrDestroy) {
1074 Instruction *Prev = Suspend->getPrevNode();
1086 auto *CallInstr = CS.getInstruction();
1123 if (auto *I = dyn_cast<Instruction>(CalledValue))
1123 if (auto *I = dyn_cast<Instruction>(CalledValue))
1227 TrackingVH<Instruction> Handle(Shape.FramePtr);
1398 Instruction *InsertPt = F.getEntryBlock().getTerminator();
lib/Transforms/Coroutines/Coroutines.cpp 108 Instruction *InsertPt) {
192 for (Instruction &I : instructions(F))
255 for (Instruction &I : instructions(F)) {
540 static void fail(const Instruction *I, const char *Reason, Value *V) {
590 static void checkWFAlloc(const Instruction *I, Value *V) {
605 static void checkWFDealloc(const Instruction *I, Value *V) {
619 static void checkConstantInt(const Instruction *I, Value *V,
lib/Transforms/IPO/ArgumentPromotion.cpp 168 Instruction *UI = cast<Instruction>(U);
168 Instruction *UI = cast<Instruction>(U);
245 Instruction *Call = CS.getInstruction();
385 Instruction *InsertPt = &NF->begin()->front();
627 for (Instruction &I : EntryBlock)
lib/Transforms/IPO/Attributor.cpp 285 static const Value *getPointerOperand(const Instruction *I) {
304 static const Value *getBasePointerOfAccessPointerOperand(const Instruction *I,
709 Instruction *CtxI = IRP.getCtxI();
722 Instruction *CtxI = this->getIRPosition().getCtxI();
732 if (const Instruction *UserI = dyn_cast<Instruction>(U->getUser())) {
732 if (const Instruction *UserI = dyn_cast<Instruction>(U->getUser())) {
779 (unsigned)Instruction::Invoke, (unsigned)Instruction::CallBr,
779 (unsigned)Instruction::Invoke, (unsigned)Instruction::CallBr,
780 (unsigned)Instruction::Call, (unsigned)Instruction::CleanupRet,
780 (unsigned)Instruction::Call, (unsigned)Instruction::CleanupRet,
781 (unsigned)Instruction::CatchSwitch, (unsigned)Instruction::Resume};
781 (unsigned)Instruction::CatchSwitch, (unsigned)Instruction::Resume};
889 for (Instruction *RI : OpcodeInstMap[Instruction::Ret])
889 for (Instruction *RI : OpcodeInstMap[Instruction::Ret])
1123 if (!A.checkForAllInstructions(CheckReturnInst, *this, {Instruction::Ret}))
1280 static bool isNonRelaxedAtomic(Instruction *I);
1283 static bool isVolatile(Instruction *I);
1287 static bool isNoSyncIntrinsic(Instruction *I);
1290 bool AANoSyncImpl::isNonRelaxedAtomic(Instruction *I) {
1296 case Instruction::AtomicRMW:
1299 case Instruction::Store:
1302 case Instruction::Load:
1305 case Instruction::Fence: {
1312 case Instruction::AtomicCmpXchg: {
1339 bool AANoSyncImpl::isNoSyncIntrinsic(Instruction *I) {
1361 bool AANoSyncImpl::isVolatile(Instruction *I) {
1366 case Instruction::AtomicRMW:
1368 case Instruction::Store:
1370 case Instruction::Load:
1372 case Instruction::AtomicCmpXchg:
1525 const Use *U, const Instruction *I, bool &IsNonNull, bool &TrackUse) {
1594 bool followUse(Attributor &A, const Use *U, const Instruction *I) {
2111 if (const Instruction *NextNoReturnI =
2127 const Instruction *findNextNoReturn(Attributor &A, const Instruction *I);
2127 const Instruction *findNextNoReturn(Attributor &A, const Instruction *I);
2154 for (const Instruction *NRC : NoReturnCalls) {
2155 Instruction *I = const_cast<Instruction *>(NRC);
2157 Instruction *SplitPos = I->getNextNode();
2250 bool isAssumedDead(const Instruction *I) const override {
2267 bool isKnownDead(const Instruction *I) const override {
2272 bool isAfterNoReturn(const Instruction *I) const;
2289 for (const Instruction &I : BB)
2297 SmallSetVector<const Instruction *, 8> ToBeExploredPaths;
2303 SmallSetVector<const Instruction *, 4> NoReturnCalls;
2317 bool AAIsDeadImpl::isAfterNoReturn(const Instruction *I) const {
2318 const Instruction *PrevI = I->getPrevNode();
2327 const Instruction *AAIsDeadImpl::findNextNoReturn(Attributor &A,
2328 const Instruction *I) {
2382 SmallVector<const Instruction *, 8> NoReturnChanged;
2384 for (const Instruction *I : NoReturnCalls)
2387 for (const Instruction *I : NoReturnChanged) {
2390 const Instruction *NextNoReturnI = findNextNoReturn(A, I);
2401 if (const Instruction *NextNoReturnI =
2487 bool followUse(Attributor &A, const Use *U, const Instruction *I) {
2871 {(unsigned)Instruction::Ret}))
3058 Instruction *UInst = cast<Instruction>(U->getUser());
3058 Instruction *UInst = cast<Instruction>(U->getUser());
3115 return !IsDeadAA.isAssumedDead(cast<Instruction>(U->getUser()));
3558 for (Instruction *MallocCall : MallocCalls) {
3563 for (Instruction *FreeCall : FreesForMalloc[MallocCall]) {
3584 Instruction *AI = new AllocaInst(Type::getInt8Ty(F->getContext()), AS,
3620 SmallSetVector<Instruction *, 4> MallocCalls;
3623 DenseSet<const Instruction *> BadMallocCalls;
3626 DenseMap<Instruction *, SmallPtrSet<Instruction *, 4>> FreesForMalloc;
3626 DenseMap<Instruction *, SmallPtrSet<Instruction *, 4>> FreesForMalloc;
3675 cast<Instruction>(const_cast<User *>(UserI)));
3796 if (auto *I = dyn_cast<Instruction>(&IRP.getAnchorValue())) {
3884 const Instruction *UserI);
3887 void analyzeUseIn(Attributor &A, const Use *U, const Instruction *UserI);
4108 Instruction *UserI = cast<Instruction>(U->getUser());
4108 Instruction *UserI = cast<Instruction>(U->getUser());
4130 const Instruction *UserI) {
4155 const Instruction *UserI) {
4162 case Instruction::Load:
4167 case Instruction::Store:
4175 case Instruction::Call:
4176 case Instruction::CallBr:
4177 case Instruction::Invoke: {
4221 const Instruction *CtxI = AA.getIRPosition().getCtxI();
4282 Instruction *I = ACS.getInstruction();
4370 for (Instruction *I : OpcodeInstMap[Opcode]) {
4385 const llvm::function_ref<bool(Instruction &)> &Pred,
4414 const llvm::function_ref<bool(Instruction &)> &Pred,
4428 for (Instruction *I :
4603 for (Instruction *I : ToBeDeletedInsts) {
4678 for (Instruction &I : instructions(&F)) {
4692 case Instruction::Load:
4694 case Instruction::Store:
4696 case Instruction::Call:
4697 case Instruction::CallBr:
4698 case Instruction::Invoke:
4699 case Instruction::CleanupRet:
4700 case Instruction::CatchSwitch:
4701 case Instruction::Resume:
4702 case Instruction::Ret:
4838 {(unsigned)Instruction::Invoke, (unsigned)Instruction::CallBr,
4838 {(unsigned)Instruction::Invoke, (unsigned)Instruction::CallBr,
4839 (unsigned)Instruction::Call});
4854 {(unsigned)Instruction::Load, (unsigned)Instruction::Store});
4854 {(unsigned)Instruction::Load, (unsigned)Instruction::Store});
lib/Transforms/IPO/BlockExtractor.cpp 137 for (Instruction &I : BB) {
lib/Transforms/IPO/CalledValuePropagation.cpp 125 if (isa<Instruction>(Key.getPointer())) {
170 Instruction &I, DenseMap<CVPLatticeKey, CVPLatticeVal> &ChangedValues,
173 case Instruction::Call:
175 case Instruction::Invoke:
177 case Instruction::Load:
179 case Instruction::Ret:
181 case Instruction::Select:
183 case Instruction::Store:
218 SmallPtrSetImpl<Instruction *> &getIndirectCalls() { return IndirectCalls; }
224 SmallPtrSet<Instruction *, 32> IndirectCalls;
260 Instruction *I = CS.getInstruction();
344 void visitInst(Instruction &I,
389 for (Instruction *C : Lattice.getIndirectCalls()) {
lib/Transforms/IPO/DeadArgumentElimination.cpp 140 for (Instruction &I : BB) {
180 Instruction *Call = CS.getInstruction();
569 const Instruction *TheCall = CS.getInstruction();
879 Instruction *Call = CS.getInstruction();
954 Instruction *New = NewCS.getInstruction();
969 Instruction *InsertPt = Call;
lib/Transforms/IPO/FunctionAttrs.cpp 131 Instruction *I = &*II;
464 Instruction *I = cast<Instruction>(U->getUser());
464 Instruction *I = cast<Instruction>(U->getUser());
467 case Instruction::BitCast:
468 case Instruction::GetElementPtr:
469 case Instruction::PHI:
470 case Instruction::Select:
471 case Instruction::AddrSpaceCast:
478 case Instruction::Call:
479 case Instruction::Invoke: {
550 case Instruction::Load:
559 case Instruction::ICmp:
560 case Instruction::Ret:
639 for (Instruction &I : Entry) {
880 if (Instruction *RVI = dyn_cast<Instruction>(RetVal))
880 if (Instruction *RVI = dyn_cast<Instruction>(RetVal))
883 case Instruction::BitCast:
884 case Instruction::GetElementPtr:
885 case Instruction::AddrSpaceCast:
888 case Instruction::Select: {
894 case Instruction::PHI: {
902 case Instruction::Alloca:
904 case Instruction::Call:
905 case Instruction::Invoke: {
991 Instruction *RVI = dyn_cast<Instruction>(RetVal);
991 Instruction *RVI = dyn_cast<Instruction>(RetVal);
996 case Instruction::BitCast:
997 case Instruction::GetElementPtr:
998 case Instruction::AddrSpaceCast:
1001 case Instruction::Select: {
1007 case Instruction::PHI: {
1013 case Instruction::Call:
1014 case Instruction::Invoke: {
1116 std::function<bool(Instruction &)> InstrBreaksAttribute;
1130 std::function<bool(Instruction &)> InstrScan,
1184 for (Instruction &I : instructions(*F)) {
1223 static bool InstrBreaksNonConvergent(Instruction &I,
1232 static bool InstrBreaksNonThrowing(Instruction &I, const SCCNodeSet &SCCNodes) {
1248 static bool InstrBreaksNoFree(Instruction &I, const SCCNodeSet &SCCNodes) {
1369 for (auto &I : BB.instructionsWithoutDebug())
1440 for (Instruction &I : instructions(F))
1574 auto *I = dyn_cast<Instruction>(U);
1574 auto *I = dyn_cast<Instruction>(U);
lib/Transforms/IPO/GlobalDCE.cpp 88 for (auto &I : Entry) {
102 if (auto *I = dyn_cast<Instruction>(V)) {
102 if (auto *I = dyn_cast<Instruction>(V)) {
lib/Transforms/IPO/GlobalOpt.cpp 171 Instruction *I = cast<Instruction>(V);
171 Instruction *I = cast<Instruction>(V);
204 SmallVector<std::pair<Instruction *, Instruction *>, 32> Dead;
204 SmallVector<std::pair<Instruction *, Instruction *>, 32> Dead;
215 } else if (Instruction *I = dyn_cast<Instruction>(V)) {
215 } else if (Instruction *I = dyn_cast<Instruction>(V)) {
223 } else if (Instruction *I = dyn_cast<Instruction>(MSI->getValue())) {
223 } else if (Instruction *I = dyn_cast<Instruction>(MSI->getValue())) {
232 } else if (Instruction *I = dyn_cast<Instruction>(MemSrc)) {
232 } else if (Instruction *I = dyn_cast<Instruction>(MemSrc)) {
255 Instruction *I = Dead[i].first;
259 Instruction *J = dyn_cast<Instruction>(I->getOperand(0));
259 Instruction *J = dyn_cast<Instruction>(I->getOperand(0));
303 if (CE->getOpcode() == Instruction::GetElementPtr) {
308 } else if ((CE->getOpcode() == Instruction::BitCast &&
310 CE->getOpcode() == Instruction::AddrSpaceCast) {
327 if (Init && CE && CE->getOpcode() == Instruction::GetElementPtr)
403 Instruction *I = dyn_cast<Instruction>(V);
403 Instruction *I = dyn_cast<Instruction>(V);
424 cast<ConstantExpr>(U)->getOpcode() != Instruction::GetElementPtr))
617 if (const Instruction *I = dyn_cast<Instruction>(U)) {
617 if (const Instruction *I = dyn_cast<Instruction>(U)) {
682 Instruction *I = cast<Instruction>(*UI++);
682 Instruction *I = cast<Instruction>(*UI++);
818 if (Instruction *I = dyn_cast<Instruction>(*UI++))
818 if (Instruction *I = dyn_cast<Instruction>(*UI++))
862 Instruction *User = cast<Instruction>(CI->user_back());
862 Instruction *User = cast<Instruction>(CI->user_back());
965 static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(const Instruction *V,
969 const Instruction *Inst = cast<Instruction>(U);
969 const Instruction *Inst = cast<Instruction>(U);
1012 static void ReplaceUsesOfMallocWithGlobal(Instruction *Alloc,
1015 Instruction *U = cast<Instruction>(*Alloc->user_begin());
1015 Instruction *U = cast<Instruction>(*Alloc->user_begin());
1016 Instruction *InsertPt = U;
1062 const Instruction *UI = cast<Instruction>(U);
1062 const Instruction *UI = cast<Instruction>(U);
1108 Instruction *StoredVal) {
1197 static void RewriteHeapSROALoadUser(Instruction *LoadUser,
1252 Instruction *User = cast<Instruction>(*UI++);
1252 Instruction *User = cast<Instruction>(*UI++);
1264 Instruction *User = cast<Instruction>(*UI++);
1264 Instruction *User = cast<Instruction>(*UI++);
1373 Instruction *BI = BranchInst::Create(FreeBlock, NextBlock,
1401 Instruction *User = cast<Instruction>(*UI++);
1401 Instruction *User = cast<Instruction>(*UI++);
1545 Instruction *Malloc =
1548 Instruction *Cast = new BitCastInst(Malloc, CI->getType(), "tmp", CI);
1697 Instruction *UI = cast<Instruction>(GV->user_back());
1697 Instruction *UI = cast<Instruction>(GV->user_back());
1710 Instruction *StoredVal = cast<Instruction>(SI->getOperand(0));
1710 Instruction *StoredVal = cast<Instruction>(SI->getOperand(0));
1738 Instruction *NSI;
1802 if (Operator::getOpcode(U) == Instruction::BitCast) {
1814 Instruction *I = dyn_cast<Instruction>(U);
1814 Instruction *I = dyn_cast<Instruction>(U);
1872 if (isa<Instruction>(U))
1878 if (!isa<Instruction>(UU))
1909 Instruction *UI = cast<Instruction>(UU);
1909 Instruction *UI = cast<Instruction>(UU);
1910 Instruction *NewU = U->getAsInstruction();
1947 Instruction &FirstI = const_cast<Instruction&>(*GS.AccessingFunction
2107 CallSite CS(cast<Instruction>(U));
2125 CallSite CS(cast<Instruction>(U));
2190 CallSite CS(cast<Instruction>(U));
2206 CallSite CS(cast<Instruction>(U));
2218 for (Instruction &I : BB) {
2220 CallSite CS(cast<Instruction>(CI));
lib/Transforms/IPO/HotColdSplitting.cpp 99 const Instruction *I = BB.getTerminator();
110 for (Instruction &I : BB)
224 for (Instruction &I : BB->instructionsWithoutDebug())
lib/Transforms/IPO/IPConstantPropagation.cpp 225 Instruction* Call = CS.getInstruction();
249 Instruction *Ins = cast<Instruction>(*I);
249 Instruction *Ins = cast<Instruction>(*I);
lib/Transforms/IPO/Inliner.cpp 424 Instruction *Call = CS.getInstruction();
563 for (Instruction &I : BB) {
628 Instruction *Instr = CS.getInstruction();
930 for (Instruction &I : instructions(N.getFunction()))
lib/Transforms/IPO/LoopExtractor.cpp 108 Instruction *EntryTI =
lib/Transforms/IPO/LowerTypeTests.cpp 715 if (Op->getOpcode() == Instruction::BitCast)
718 if (Op->getOpcode() == Instruction::Select)
lib/Transforms/IPO/MergeFunctions.cpp 264 std::vector<Instruction *> &PDIUnrelatedWL);
271 void eraseInstsUnrelatedToPDI(std::vector<Instruction *> &PDIUnrelatedWL);
511 std::vector<Instruction *> &PDIUnrelatedWL) {
517 Instruction *I = PDIUnrelatedWL.back();
553 BasicBlock *GEntryBlock, std::vector<Instruction *> &PDIUnrelatedWL) {
554 std::set<Instruction *> PDIRelated;
639 Instruction *I = &*BI;
681 std::vector<Instruction *> PDIUnrelatedWL;
950 if (auto *I = dyn_cast<Instruction>(U))
950 if (auto *I = dyn_cast<Instruction>(U))
lib/Transforms/IPO/PartialInlining.cpp 568 Instruction *TI = BB->getTerminator();
766 Instruction *Call = CS.getInstruction();
851 for (Instruction &I : BB->instructionsWithoutDebug()) {
854 case Instruction::BitCast:
855 case Instruction::PtrToInt:
856 case Instruction::IntToPtr:
857 case Instruction::Alloca:
858 case Instruction::PHI:
860 case Instruction::GetElementPtr:
1066 Instruction *Ins = &ClonedOI->ReturnBlock->front();
1067 SmallVector<Instruction *, 4> DeadPhis;
1094 for (auto *DP : DeadPhis)
1470 if (Instruction *I = dyn_cast<Instruction>(U))
1470 if (Instruction *I = dyn_cast<Instruction>(U))
lib/Transforms/IPO/PruneEH.cpp 109 const Instruction *TI = BB.getTerminator();
116 for (const Instruction &I : BB) {
234 Instruction *TokenInst = nullptr;
lib/Transforms/IPO/SampleProfile.cpp 298 ErrorOr<uint64_t> getInstWeight(const Instruction &I);
300 const FunctionSamples *findCalleeFunctionSamples(const Instruction &I) const;
302 findIndirectCallFunctionSamples(const Instruction &I, uint64_t &Sum) const;
304 const FunctionSamples *findFunctionSamples(const Instruction &I) const;
305 bool inlineCallInstruction(Instruction *I);
659 ErrorOr<uint64_t> SampleProfileLoader::getInstWeight(const Instruction &Inst) {
769 SampleProfileLoader::findCalleeFunctionSamples(const Instruction &Inst) const {
794 const Instruction &Inst, uint64_t &Sum) const {
842 SampleProfileLoader::findFunctionSamples(const Instruction &Inst) const {
853 bool SampleProfileLoader::inlineCallInstruction(Instruction *I) {
902 DenseSet<Instruction *> PromotedInsns;
912 DenseMap<Instruction *, const FunctionSamples *> localNotInlinedCallSites;
916 SmallVector<Instruction *, 10> CIS;
919 SmallVector<Instruction *, 10> Candidates;
920 for (auto &I : BB.getInstList()) {
969 Instruction *DI =
1005 Instruction *I = Pair.getFirst();
1424 for (auto &I : BB->getInstList()) {
1456 Instruction *TI = BB->getTerminator();
1469 Instruction *MaxDestInst;
lib/Transforms/IPO/SyntheticCountsPropagation.cpp 114 CallSite CS(cast<Instruction>(Edge.first));
lib/Transforms/IPO/WholeProgramDevirt.cpp 1615 SmallVector<Instruction *, 1> LoadedPtrs;
1616 SmallVector<Instruction *, 1> Preds;
1634 for (Instruction *LoadedPtr : LoadedPtrs) {
1643 for (Instruction *Pred : Preds) {
lib/Transforms/InstCombine/InstCombineAddSub.cpp 181 Value *simplify(Instruction *FAdd);
199 void createInstPostProc(Instruction *NewInst, bool NoNumber = false);
212 Instruction *Instr = nullptr;
348 Instruction *I = nullptr;
349 if (!Val || !(I = dyn_cast<Instruction>(Val)))
354 if (Opcode == Instruction::FAdd || Opcode == Instruction::FSub) {
354 if (Opcode == Instruction::FAdd || Opcode == Instruction::FSub) {
377 if (Opcode == Instruction::FSub)
389 if (I->getOpcode() == Instruction::FMul) {
426 Value *FAddCombine::simplify(Instruction *I) {
660 if (Instruction *I = dyn_cast<Instruction>(V))
660 if (Instruction *I = dyn_cast<Instruction>(V))
668 if (Instruction *I = dyn_cast<Instruction>(NewV))
668 if (Instruction *I = dyn_cast<Instruction>(NewV))
675 if (Instruction *I = dyn_cast<Instruction>(V))
675 if (Instruction *I = dyn_cast<Instruction>(V))
682 if (Instruction *I = dyn_cast<Instruction>(V))
682 if (Instruction *I = dyn_cast<Instruction>(V))
687 void FAddCombine::createInstPostProc(Instruction *NewInstr, bool NoNumber) {
826 static Instruction *foldNoWrapAdd(BinaryOperator &Add,
866 Instruction *InstCombiner::foldAddWithConstant(BinaryOperator &Add) {
872 if (Instruction *NV = foldBinOpIntoSelectOrPhi(Add))
923 return CastInst::Create(Instruction::SExt, X, Ty);
1060 static Instruction *canonicalizeLowbitMask(BinaryOperator &I,
1078 static Instruction *foldToUnsignedSaturatedAdd(BinaryOperator &I) {
1100 Instruction *
1111 Instruction *LowBitsToSkip, *Extract;
1119 if (I.getOpcode() == Instruction::Sub && I.getOperand(1) != Select)
1147 if (I.getOpcode() == Instruction::Sub)
1186 if (I.getOpcode() == Instruction::Sub
1201 Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
1210 if (Instruction *X = foldVectorBinop(I))
1217 if (Instruction *X = foldAddWithConstant(I))
1220 if (Instruction *X = foldNoWrapAdd(I, Builder))
1372 if (Instruction *Ext = narrowMathIfNoOverflow(I))
1403 if (Instruction *V = canonicalizeLowbitMask(I, Builder))
1406 if (Instruction *V =
1410 if (Instruction *SatAdd = foldToUnsignedSaturatedAdd(I))
1417 static Instruction *factorizeLerp(BinaryOperator &I,
1433 static Instruction *factorizeFAddFSub(BinaryOperator &I,
1440 if (Instruction *Lerp = factorizeLerp(I, Builder))
1461 bool IsFAdd = I.getOpcode() == Instruction::FAdd;
1475 Instruction *InstCombiner::visitFAdd(BinaryOperator &I) {
1484 if (Instruction *X = foldVectorBinop(I))
1487 if (Instruction *FoldedFAdd = foldBinOpIntoSelectOrPhi(I))
1577 if (Instruction *F = factorizeFAddFSub(I, Builder))
1672 Instruction *InstCombiner::visitSub(BinaryOperator &I) {
1678 if (Instruction *X = foldVectorBinop(I))
1753 if (Instruction *R = FoldOpIntoSelect(I, SI))
1758 if (Instruction *R = foldOpIntoPhi(I, PN))
1788 Value *ShAmtOp = cast<Instruction>(Op1Wide)->getOperand(1);
1789 Instruction *NewShift = BinaryOperator::CreateAShr(X, ShAmtOp);
1800 Value *ShAmtOp = cast<Instruction>(Op1Wide)->getOperand(1);
1801 Instruction *NewShift = BinaryOperator::CreateLShr(X, ShAmtOp);
1904 Instruction *BO = BinaryOperator::CreateSDiv(X, NegDivC);
2008 if (Instruction *V =
2012 if (Instruction *Ext = narrowMathIfNoOverflow(I))
2030 static Instruction *foldFNegIntoConstant(Instruction &I) {
2030 static Instruction *foldFNegIntoConstant(Instruction &I) {
2051 static Instruction *hoistFNegAboveFMulFDiv(Instruction &I,
2051 static Instruction *hoistFNegAboveFMulFDiv(Instruction &I,
2067 Instruction *InstCombiner::visitFNeg(UnaryOperator &I) {
2074 if (Instruction *X = foldFNegIntoConstant(I))
2084 if (Instruction *R = hoistFNegAboveFMulFDiv(I, Builder))
2090 Instruction *InstCombiner::visitFSub(BinaryOperator &I) {
2096 if (Instruction *X = foldVectorBinop(I))
2105 if (Instruction *X = foldFNegIntoConstant(I))
2108 if (Instruction *R = hoistFNegAboveFMulFDiv(I, Builder))
2129 if (Instruction *NV = FoldOpIntoSelect(I, SI))
2192 if (Instruction *F = factorizeFAddFSub(I, Builder))
lib/Transforms/InstCombine/InstCombineAndOrXor.cpp 117 Instruction *InstCombiner::OptAndOp(BinaryOperator *Op,
125 case Instruction::Add:
862 Instruction &CxtI) {
929 Instruction &CxtI,
1146 Instruction &CxtI) {
1413 static Instruction *reassociateFCmps(BinaryOperator &BO,
1415 Instruction::BinaryOps Opcode = BO.getOpcode();
1428 FCmpInst::Predicate NanPred = Opcode == Instruction::And ? FCmpInst::FCMP_ORD
1458 static Instruction *matchDeMorgansLaws(BinaryOperator &I,
1465 Opcode = (Opcode == Instruction::And) ? Instruction::Or : Instruction::And;
1465 Opcode = (Opcode == Instruction::And) ? Instruction::Or : Instruction::And;
1465 Opcode = (Opcode == Instruction::And) ? Instruction::Or : Instruction::And;
1496 static Instruction *foldLogicCastConstant(BinaryOperator &Logic, CastInst *Cast,
1535 Instruction *InstCombiner::foldCastedBitwiseLogic(BinaryOperator &I) {
1551 if (Instruction *Ret = foldLogicCastConstant(I, Cast0, Builder))
1575 if (LogicOpc == Instruction::Xor)
1583 Value *Res = LogicOpc == Instruction::And ? foldAndOfICmps(ICmp0, ICmp1, I)
1595 if (Value *R = foldLogicOfFCmps(FCmp0, FCmp1, LogicOpc == Instruction::And))
1601 static Instruction *foldAndToXor(BinaryOperator &I,
1627 static Instruction *foldOrToXor(BinaryOperator &I,
1681 Instruction *InstCombiner::narrowMaskedBinOp(BinaryOperator &And) {
1707 Instruction::BinaryOps Opc = cast<BinaryOperator>(Op0)->getOpcode();
1708 if (Opc == Instruction::LShr || Opc == Instruction::Shl)
1708 if (Opc == Instruction::LShr || Opc == Instruction::Shl)
1715 Value *NewBO = Opc == Instruction::Sub ? Builder.CreateBinOp(Opc, NewC, X)
1723 Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
1731 if (Instruction *X = foldVectorBinop(I))
1740 if (Instruction *Xor = foldAndToXor(I, Builder))
1819 case Instruction::Xor:
1820 case Instruction::Or:
1821 case Instruction::Mul:
1822 case Instruction::Add:
1823 case Instruction::Sub:
1846 if (Instruction *Res = OptAndOp(Op0I, Op0CI, AndRHS, I))
1867 if (Instruction *Z = narrowMaskedBinOp(I))
1870 if (Instruction *FoldedLogic = foldBinOpIntoSelectOrPhi(I))
1873 if (Instruction *DeMorgan = matchDeMorgansLaws(I, Builder))
1947 if (Instruction *FoldedFCmps = reassociateFCmps(I, Builder))
1950 if (Instruction *CastedAnd = foldCastedBitwiseLogic(I))
1979 Instruction *InstCombiner::matchBSwap(BinaryOperator &Or) {
1984 if (Instruction *Ext = dyn_cast<ZExtInst>(Op0))
1987 if (Instruction *Ext = dyn_cast<ZExtInst>(Op1))
2016 SmallVector<Instruction*, 4> Insts;
2019 Instruction *LastInst = Insts.pop_back_val();
2022 for (auto *Inst : Insts)
2028 static Instruction *matchRotate(Instruction &Or) {
2028 static Instruction *matchRotate(Instruction &Or) {
2188 Instruction &CxtI) {
2448 Instruction *InstCombiner::visitOr(BinaryOperator &I) {
2456 if (Instruction *X = foldVectorBinop(I))
2465 if (Instruction *Xor = foldOrToXor(I, Builder))
2475 if (Instruction *FoldedLogic = foldBinOpIntoSelectOrPhi(I))
2478 if (Instruction *BSwap = matchBSwap(I))
2481 if (Instruction *Rotate = matchRotate(I))
2592 if (Instruction *DeMorgan = matchDeMorgansLaws(I, Builder))
2628 Op1->hasOneUse() && (B->getOpcode() == Instruction::Or ||
2629 B->getOpcode() == Instruction::Xor)) {
2672 if (Instruction *FoldedFCmps = reassociateFCmps(I, Builder))
2675 if (Instruction *CastedOr = foldCastedBitwiseLogic(I))
2728 if (Instruction *V =
2737 static Instruction *foldXorToXor(BinaryOperator &I,
2851 if (Value *OrICmp = SimplifyBinOp(Instruction::Or, LHS, RHS, SQ)) {
2854 if (Value *AndICmp = SimplifyBinOp(Instruction::And, LHS, RHS, SQ)) {
2907 static Instruction *visitMaskedMerge(BinaryOperator &I,
2943 static Instruction *sinkNotIntoXor(BinaryOperator &I,
2966 Instruction *InstCombiner::visitXor(BinaryOperator &I) {
2974 if (Instruction *X = foldVectorBinop(I))
2977 if (Instruction *NewXor = foldXorToXor(I, Builder))
3021 if (Instruction *Xor = visitMaskedMerge(I, Builder))
3027 if (NotVal->getOpcode() == Instruction::And ||
3028 NotVal->getOpcode() == Instruction::Or) {
3038 if (NotVal->getOpcode() == Instruction::And)
3117 Worklist.Add(cast<Instruction>(Op0));
3128 if (Op0I->getOpcode() == Instruction::LShr) {
3135 E1->getOpcode() == Instruction::Xor &&
3144 cast<Instruction>(Opnd0)->setDebugLoc(I.getDebugLoc());
3154 if (Instruction *FoldedLogic = foldBinOpIntoSelectOrPhi(I))
3212 if (Instruction *CastedXor = foldCastedBitwiseLogic(I))
3284 if (Instruction *NewXor = sinkNotIntoXor(I, Builder))
lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp 96 Instruction *InstCombiner::visitAtomicRMWInst(AtomicRMWInst &RMWI) {
lib/Transforms/InstCombine/InstCombineCalls.cpp 110 Instruction *InstCombiner::SimplifyAnyMemTransfer(AnyMemTransferInst *MI) {
227 Instruction *InstCombiner::SimplifyAnyMemSet(AnyMemSetInst *MI) {
1076 Instruction *InstCombiner::simplifyMaskedStore(IntrinsicInst &II) {
1112 Instruction *InstCombiner::simplifyMaskedGather(IntrinsicInst &II) {
1122 Instruction *InstCombiner::simplifyMaskedScatter(IntrinsicInst &II) {
1156 static Instruction *simplifyInvariantGroupIntrinsic(IntrinsicInst &II,
1179 return cast<Instruction>(Result);
1182 static Instruction *foldCttzCtlz(IntrinsicInst &II, InstCombiner &IC) {
1258 static Instruction *foldCtpop(IntrinsicInst &II, InstCombiner &IC) {
1298 static Instruction *simplifyX86MaskedLoad(IntrinsicInst &II, InstCombiner &IC) {
1502 static Instruction *SimplifyNVVMIntrinsic(IntrinsicInst *II, InstCombiner &IC) {
1530 Optional<Instruction::CastOps> CastOp;
1531 Optional<Instruction::BinaryOps> BinaryOp;
1543 SimplifyAction(Instruction::CastOps CastOp) : CastOp(CastOp) {}
1545 SimplifyAction(Instruction::BinaryOps BinaryOp, FtzRequirementTy FtzReq)
1627 return {Instruction::FPToSI};
1632 return {Instruction::FPToUI};
1637 return {Instruction::SIToFP};
1642 return {Instruction::UIToFP};
1646 return {Instruction::FAdd, FTZ_Any};
1648 return {Instruction::FAdd, FTZ_MustBeOff};
1650 return {Instruction::FAdd, FTZ_MustBeOn};
1652 return {Instruction::FMul, FTZ_Any};
1654 return {Instruction::FMul, FTZ_MustBeOff};
1656 return {Instruction::FMul, FTZ_MustBeOn};
1658 return {Instruction::FDiv, FTZ_Any};
1660 return {Instruction::FDiv, FTZ_MustBeOff};
1662 return {Instruction::FDiv, FTZ_MustBeOn};
1742 Instruction::FDiv, ConstantFP::get(II->getArgOperand(0)->getType(), 1),
1748 Instruction *InstCombiner::visitVAStartInst(VAStartInst &I) {
1753 Instruction *InstCombiner::visitVACopyInst(VACopyInst &I) {
1758 static Instruction *canonicalizeConstantArg0ToArg1(CallInst &Call) {
1769 Instruction *InstCombiner::foldIntrinsicWithOverflowCommon(IntrinsicInst *II) {
1782 Instruction *InstCombiner::visitCallInst(CallInst &CI) {
1850 if (Instruction *I = SimplifyAnyMemTransfer(MTI))
1853 if (Instruction *I = SimplifyAnyMemSet(MSI))
1872 if (Instruction *I = SimplifyNVVMIntrinsic(II, *this))
1915 if (auto *SkippedBarrier = simplifyInvariantGroupIntrinsic(*II, *this))
1935 if (auto *I = foldCttzCtlz(*II, *this))
1940 if (auto *I = foldCtpop(*II, *this))
2012 if (Instruction *I = canonicalizeConstantArg0ToArg1(CI))
2014 if (Instruction *I = foldIntrinsicWithOverflowCommon(II))
2041 if (Instruction *I = canonicalizeConstantArg0ToArg1(CI))
2046 if (Instruction *I = foldIntrinsicWithOverflowCommon(II))
2051 if (Instruction *I = foldIntrinsicWithOverflowCommon(II))
2075 if (Instruction *I = canonicalizeConstantArg0ToArg1(CI))
2158 if (Instruction *I = canonicalizeConstantArg0ToArg1(CI))
2186 Instruction *FNeg = BinaryOperator::CreateFNeg(NewCall);
2216 Instruction *NewCall = Builder.CreateBinaryIntrinsic(
2249 if (Instruction *I = canonicalizeConstantArg0ToArg1(CI))
2325 Instruction *FNeg = BinaryOperator::CreateFNeg(NewSin);
2613 match(Arg1, m_PosZeroFP()) && isa<Instruction>(Arg0) &&
2614 cast<Instruction>(Arg0)->getFastMathFlags().noInfs())) {
3134 if (Instruction *I = simplifyX86MaskedLoad(*II, *this))
3211 return CastInst::Create(Instruction::BitCast, Result, CI.getType());
3837 Instruction *SrcInst = dyn_cast<Instruction>(Src);
3837 Instruction *SrcInst = dyn_cast<Instruction>(Src);
3874 Instruction *TI = II->getParent()->getTerminator();
3926 Instruction *Next = II->getNextNonDebugInstruction();
3953 Instruction *LHS;
3955 Pred == ICmpInst::ICMP_NE && LHS->getOpcode() == Instruction::Load &&
4035 Instruction *NextInst = II->getNextNode();
4052 Instruction* MoveI = II->getNextNode();
4054 auto *Temp = MoveI;
4068 Instruction *InstCombiner::visitFenceInst(FenceInst &FI) {
4070 Instruction *Next = FI.getNextNonDebugInstruction();
4078 Instruction *InstCombiner::visitInvokeInst(InvokeInst &II) {
4083 Instruction *InstCombiner::visitCallBrInst(CallBrInst &CBI) {
4122 Instruction *InstCombiner::tryOptimizeCall(CallInst *CI) {
4187 Instruction *Inst = &*--I;
4266 Instruction *InstCombiner::visitCallBase(CallBase &Call) {
4320 Instruction *OldCall = &Call;
4394 Instruction *I = tryOptimizeCall(CI);
4426 Instruction *Caller = &Call;
4602 Instruction::CastOps opcode =
4650 Instruction *NC = NewCall;
4692 Instruction *
4806 Instruction *NewCaller;
lib/Transforms/InstCombine/InstCombineCasts.cpp 48 if (I->getOpcode() == Instruction::Shl) {
55 if (I->getOpcode() == Instruction::Mul) {
62 if (I->getOpcode() == Instruction::Add) {
83 Instruction *InstCombiner::PromoteCastOfAllocation(BitCastInst &CI,
172 Instruction *I = cast<Instruction>(V);
172 Instruction *I = cast<Instruction>(V);
173 Instruction *Res = nullptr;
176 case Instruction::Add:
177 case Instruction::Sub:
178 case Instruction::Mul:
179 case Instruction::And:
180 case Instruction::Or:
181 case Instruction::Xor:
182 case Instruction::AShr:
183 case Instruction::LShr:
184 case Instruction::Shl:
185 case Instruction::UDiv:
186 case Instruction::URem: {
192 case Instruction::Trunc:
193 case Instruction::ZExt:
194 case Instruction::SExt:
204 Opc == Instruction::SExt);
206 case Instruction::Select: {
212 case Instruction::PHI: {
232 Instruction::CastOps InstCombiner::isEliminableCastPair(const CastInst *CI1,
238 Instruction::CastOps firstOp = CI1->getOpcode();
239 Instruction::CastOps secondOp = CI2->getOpcode();
252 if ((Res == Instruction::IntToPtr && SrcTy != DstIntPtrTy) ||
253 (Res == Instruction::PtrToInt && DstTy != SrcIntPtrTy))
260 Instruction *InstCombiner::commonCastTransforms(CastInst &CI) {
265 if (Instruction::CastOps NewOpc = isEliminableCastPair(CSrc, &CI)) {
284 if (Instruction *NV = FoldOpIntoSelect(CI, Sel)) {
296 if (Instruction *NV = foldOpIntoPhi(CI, PN))
320 if (!isa<Instruction>(V))
342 Instruction *CxtI) {
348 auto *I = cast<Instruction>(V);
348 auto *I = cast<Instruction>(V);
351 case Instruction::Add:
352 case Instruction::Sub:
353 case Instruction::Mul:
354 case Instruction::And:
355 case Instruction::Or:
356 case Instruction::Xor:
361 case Instruction::UDiv:
362 case Instruction::URem: {
375 case Instruction::Shl: {
386 case Instruction::LShr: {
402 case Instruction::AShr: {
419 case Instruction::Trunc:
422 case Instruction::ZExt:
423 case Instruction::SExt:
427 case Instruction::Select: {
432 case Instruction::PHI: {
456 static Instruction *foldVecTruncToExtElt(TruncInst &Trunc, InstCombiner &IC) {
495 Instruction *InstCombiner::narrowRotate(TruncInst &Trunc) {
579 Instruction *InstCombiner::narrowBinOp(TruncInst &Trunc) {
592 case Instruction::And:
593 case Instruction::Or:
594 case Instruction::Xor:
595 case Instruction::Add:
596 case Instruction::Sub:
597 case Instruction::Mul: {
628 if (Instruction *NarrowOr = narrowRotate(Trunc))
637 static Instruction *shrinkSplatShuffle(TruncInst &Trunc,
657 static Instruction *shrinkInsertElt(CastInst &Trunc,
659 Instruction::CastOps Opcode = Trunc.getOpcode();
684 Instruction *InstCombiner::visitTrunc(TruncInst &CI) {
685 if (Instruction *Result = commonCastTransforms(CI))
788 Value *SExt = cast<Instruction>(Src)->getOperand(0);
812 if (Instruction *I = narrowBinOp(CI))
815 if (Instruction *I = shrinkSplatShuffle(CI, Builder))
818 if (Instruction *I = shrinkInsertElt(CI, Builder))
834 Instruction::Shl, NewTrunc,
840 if (Instruction *I = foldVecTruncToExtElt(CI, *this))
846 Instruction *InstCombiner::transformZExtICmp(ICmpInst *ICI, ZExtInst &CI,
983 InstCombiner &IC, Instruction *CxtI) {
990 auto *I = cast<Instruction>(V);
990 auto *I = cast<Instruction>(V);
993 case Instruction::ZExt: // zext(zext(x)) -> zext(x).
994 case Instruction::SExt: // zext(sext(x)) -> sext(x).
995 case Instruction::Trunc: // zext(trunc(x)) -> trunc(x) or zext(x)
997 case Instruction::And:
998 case Instruction::Or:
999 case Instruction::Xor:
1000 case Instruction::Add:
1001 case Instruction::Sub:
1002 case Instruction::Mul:
1021 if (I->getOpcode() == Instruction::And)
1030 case Instruction::Shl: {
1043 case Instruction::LShr: {
1058 case Instruction::Select:
1067 case Instruction::PHI: {
1088 Instruction *InstCombiner::visitZExt(ZExtInst &CI) {
1095 if (Instruction *Result = commonCastTransforms(CI))
1117 if (auto *SrcOp = dyn_cast<Instruction>(Src))
1117 if (auto *SrcOp = dyn_cast<Instruction>(Src))
1179 if (SrcI && SrcI->getOpcode() == Instruction::Or) {
1191 BinaryOperator *Or = BinaryOperator::Create(Instruction::Or, LCast, RCast);
1224 Instruction *InstCombiner::transformSExtICmp(ICmpInst *ICI, Instruction &CI) {
1224 Instruction *InstCombiner::transformSExtICmp(ICmpInst *ICI, Instruction &CI) {
1320 auto *I = cast<Instruction>(V);
1320 auto *I = cast<Instruction>(V);
1322 case Instruction::SExt: // sext(sext(x)) -> sext(x)
1323 case Instruction::ZExt: // sext(zext(x)) -> zext(x)
1324 case Instruction::Trunc: // sext(trunc(x)) -> trunc(x) or sext(x)
1326 case Instruction::And:
1327 case Instruction::Or:
1328 case Instruction::Xor:
1329 case Instruction::Add:
1330 case Instruction::Sub:
1331 case Instruction::Mul:
1339 case Instruction::Select:
1343 case Instruction::PHI: {
1360 Instruction *InstCombiner::visitSExt(SExtInst &CI) {
1366 if (Instruction *I = commonCastTransforms(CI))
1376 return CastInst::Create(Instruction::ZExt, Src, DestTy);
1522 Instruction *InstCombiner::visitFPTrunc(FPTruncInst &FPT) {
1523 if (Instruction *I = commonCastTransforms(FPT))
1545 case Instruction::FAdd:
1546 case Instruction::FSub:
1568 Instruction *RI = BinaryOperator::Create(BO->getOpcode(), LHS, RHS);
1573 case Instruction::FMul:
1585 case Instruction::FDiv:
1598 case Instruction::FRem: {
1622 Instruction *Op = dyn_cast<Instruction>(FPT.getOperand(0));
1622 Instruction *Op = dyn_cast<Instruction>(FPT.getOperand(0));
1673 if (Instruction *I = shrinkInsertElt(FPT, Builder))
1679 Instruction *InstCombiner::visitFPExt(CastInst &CI) {
1687 Instruction *InstCombiner::FoldItoFPtoI(Instruction &FI) {
1687 Instruction *InstCombiner::FoldItoFPtoI(Instruction &FI) {
1690 Instruction *OpI = cast<Instruction>(FI.getOperand(0));
1690 Instruction *OpI = cast<Instruction>(FI.getOperand(0));
1727 Instruction *InstCombiner::visitFPToUI(FPToUIInst &FI) {
1728 Instruction *OpI = dyn_cast<Instruction>(FI.getOperand(0));
1728 Instruction *OpI = dyn_cast<Instruction>(FI.getOperand(0));
1732 if (Instruction *I = FoldItoFPtoI(FI))
1738 Instruction *InstCombiner::visitFPToSI(FPToSIInst &FI) {
1739 Instruction *OpI = dyn_cast<Instruction>(FI.getOperand(0));
1739 Instruction *OpI = dyn_cast<Instruction>(FI.getOperand(0));
1743 if (Instruction *I = FoldItoFPtoI(FI))
1749 Instruction *InstCombiner::visitUIToFP(CastInst &CI) {
1753 Instruction *InstCombiner::visitSIToFP(CastInst &CI) {
1757 Instruction *InstCombiner::visitIntToPtr(IntToPtrInst &CI) {
1772 if (Instruction *I = commonCastTransforms(CI))
1779 Instruction *InstCombiner::commonPointerCastTransforms(CastInst &CI) {
1803 Instruction *InstCombiner::visitPtrToInt(PtrToIntInst &CI) {
1827 static Instruction *optimizeVectorResize(Value *InVal, VectorType *DestTy,
1959 Instruction *I = dyn_cast<Instruction>(V);
1959 Instruction *I = dyn_cast<Instruction>(V);
1963 case Instruction::BitCast:
1966 case Instruction::ZExt:
1973 case Instruction::Or:
1978 case Instruction::Shl: {
2035 static Instruction *canonicalizeBitCastExtElt(BitCastInst &BitCast,
2056 static Instruction *foldBitCastBitwiseLogic(BitCastInst &BitCast,
2102 static Instruction *foldBitCastSelect(BitCastInst &BitCast,
2126 auto *Sel = cast<Instruction>(BitCast.getOperand(0));
2126 auto *Sel = cast<Instruction>(BitCast.getOperand(0));
2162 Instruction *InstCombiner::optimizeBitCastFromPhi(CastInst &CI, PHINode *PN) {
2259 Instruction *RetVal = nullptr;
2278 Instruction *I = replaceInstUsesWith(*BCI, NewPN);
2289 Instruction *InstCombiner::visitBitCast(BitCastInst &CI) {
2317 if (Instruction *V = PromoteCastOfAllocation(CI, *AI))
2377 if (Instruction *I = optimizeVectorResize(BCIn->getOperand(0),
2398 return CastInst::Create(Instruction::BitCast, Elem, DestTy);
2454 if (Instruction *I = optimizeBitCastFromPhi(CI, PN))
2457 if (Instruction *I = canonicalizeBitCastExtElt(CI, *this))
2460 if (Instruction *I = foldBitCastBitwiseLogic(CI, Builder))
2463 if (Instruction *I = foldBitCastSelect(CI, Builder))
2471 Instruction *InstCombiner::visitAddrSpaceCast(AddrSpaceCastInst &CI) {
lib/Transforms/InstCombine/InstCombineCompares.cpp 145 Instruction *InstCombiner::foldCmpLoadFromIndexedGlobal(GetElementPtrInst *GEP,
603 auto *Inst = dyn_cast<Instruction>(Val);
603 auto *Inst = dyn_cast<Instruction>(Val);
624 if (auto *I = dyn_cast<Instruction>(V)) {
624 if (auto *I = dyn_cast<Instruction>(V)) {
804 static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, Value *RHS,
844 Instruction *InstCombiner::foldGEPICmp(GEPOperator *GEPLHS, Value *RHS,
846 Instruction &I) {
1024 Instruction *InstCombiner::foldAllocaCmp(ICmpInst &ICI,
1102 Instruction *InstCombiner::foldICmpAddOpConst(Value *X, const APInt &C,
1152 Instruction *InstCombiner::foldICmpShrConstConst(ICmpInst &I, Value *A,
1211 Instruction *InstCombiner::foldICmpShlConstConst(ICmpInst &I, Value *A,
1255 static Instruction *processUGT_ADDCST_ADD(ICmpInst &I, Value *A, Value *B,
1265 Instruction *AddWithCst = cast<Instruction>(I.getOperand(0));
1265 Instruction *AddWithCst = cast<Instruction>(I.getOperand(0));
1296 Instruction *OrigAdd = cast<Instruction>(AddWithCst->getOperand(0));
1296 Instruction *OrigAdd = cast<Instruction>(AddWithCst->getOperand(0));
1342 Instruction *InstCombiner::foldIRemByPowerOfTwoToBitTest(ICmpInst &I) {
1356 return ICmpInst::Create(Instruction::ICmp, Pred, Masked, Zero);
1361 Instruction *InstCombiner::foldSignBitTest(ICmpInst &I) {
1362 Instruction *Val;
1385 return ICmpInst::Create(Instruction::ICmp,
1392 Instruction *InstCombiner::foldICmpWithZero(ICmpInst &Cmp) {
1409 if (Instruction *New = foldIRemByPowerOfTwoToBitTest(Cmp))
1433 Instruction *InstCombiner::foldICmpWithConstant(ICmpInst &Cmp) {
1451 if (Instruction *Res = processUGT_ADDCST_ADD(Cmp, A, B, CI2, CI, *this))
1458 Instruction *InstCombiner::foldICmpWithDominatingICmp(ICmpInst &Cmp) {
1528 Instruction *InstCombiner::foldICmpTruncConstant(ICmpInst &Cmp,
1561 Instruction *InstCombiner::foldICmpXorConstant(ICmpInst &Cmp,
1633 Instruction *InstCombiner::foldICmpAndShift(ICmpInst &Cmp, BinaryOperator *And,
1645 bool IsShl = ShiftOpcode == Instruction::Shl;
1649 if (ShiftOpcode == Instruction::Shl) {
1657 bool IsAshr = ShiftOpcode == Instruction::AShr;
1716 Instruction *InstCombiner::foldICmpAndConstConst(ICmpInst &Cmp,
1780 if (Instruction *I = foldICmpAndShift(Cmp, And, C1, *C2))
1825 Instruction *InstCombiner::foldICmpAndConstant(ICmpInst &Cmp,
1828 if (Instruction *I = foldICmpAndConstConst(Cmp, And, C))
1842 if (Instruction *Res = foldCmpLoadFromIndexedGlobal(GEP, GV, Cmp, C2))
1879 Instruction *InstCombiner::foldICmpOrConstant(ICmpInst &Cmp, BinaryOperator *Or,
1919 auto BOpc = Pred == CmpInst::ICMP_EQ ? Instruction::And : Instruction::Or;
1919 auto BOpc = Pred == CmpInst::ICMP_EQ ? Instruction::And : Instruction::Or;
1932 auto BOpc = Pred == CmpInst::ICMP_EQ ? Instruction::And : Instruction::Or;
1932 auto BOpc = Pred == CmpInst::ICMP_EQ ? Instruction::And : Instruction::Or;
1940 Instruction *InstCombiner::foldICmpMulConstant(ICmpInst &Cmp,
1961 static Instruction *foldICmpShlOne(ICmpInst &Cmp, Instruction *Shl,
1961 static Instruction *foldICmpShlOne(ICmpInst &Cmp, Instruction *Shl,
2023 Instruction *InstCombiner::foldICmpShlConstant(ICmpInst &Cmp,
2163 Instruction *InstCombiner::foldICmpShrConstant(ICmpInst &Cmp,
2189 bool IsAShr = Shr->getOpcode() == Instruction::AShr;
2256 Instruction *InstCombiner::foldICmpSRemConstant(ICmpInst &Cmp,
2295 Instruction *InstCombiner::foldICmpUDivConstant(ICmpInst &Cmp,
2324 Instruction *InstCombiner::foldICmpDivConstant(ICmpInst &Cmp,
2345 bool DivIsSigned = Div->getOpcode() == Instruction::SDiv;
2494 Instruction *InstCombiner::foldICmpSubConstant(ICmpInst &Cmp,
2556 Instruction *InstCombiner::foldICmpAddConstant(ICmpInst &Cmp,
2674 Instruction *InstCombiner::foldICmpSelectConstant(ICmpInst &Cmp,
2725 static Instruction *foldICmpBitCast(ICmpInst &Cmp,
2819 Instruction *InstCombiner::foldICmpInstWithConstant(ICmpInst &Cmp) {
2826 case Instruction::Xor:
2827 if (Instruction *I = foldICmpXorConstant(Cmp, BO, *C))
2830 case Instruction::And:
2831 if (Instruction *I = foldICmpAndConstant(Cmp, BO, *C))
2834 case Instruction::Or:
2835 if (Instruction *I = foldICmpOrConstant(Cmp, BO, *C))
2838 case Instruction::Mul:
2839 if (Instruction *I = foldICmpMulConstant(Cmp, BO, *C))
2842 case Instruction::Shl:
2843 if (Instruction *I = foldICmpShlConstant(Cmp, BO, *C))
2846 case Instruction::LShr:
2847 case Instruction::AShr:
2848 if (Instruction *I = foldICmpShrConstant(Cmp, BO, *C))
2851 case Instruction::SRem:
2852 if (Instruction *I = foldICmpSRemConstant(Cmp, BO, *C))
2855 case Instruction::UDiv:
2856 if (Instruction *I = foldICmpUDivConstant(Cmp, BO, *C))
2859 case Instruction::SDiv:
2860 if (Instruction *I = foldICmpDivConstant(Cmp, BO, *C))
2863 case Instruction::Sub:
2864 if (Instruction *I = foldICmpSubConstant(Cmp, BO, *C))
2867 case Instruction::Add:
2868 if (Instruction *I = foldICmpAddConstant(Cmp, BO, *C))
2875 if (Instruction *I = foldICmpBinOpEqualityWithConstant(Cmp, BO, *C))
2886 if (Instruction *I = foldICmpSelectConstant(Cmp, SI, ConstRHS))
2891 if (Instruction *I = foldICmpTruncConstant(Cmp, TI, *C))
2896 if (Instruction *I = foldICmpIntrinsicWithConstant(Cmp, II, *C))
2904 Instruction *InstCombiner::foldICmpBinOpEqualityWithConstant(ICmpInst &Cmp,
2918 case Instruction::SRem:
2929 case Instruction::Add: {
2952 case Instruction::Xor:
2964 case Instruction::Sub:
2977 case Instruction::Or: {
2989 case Instruction::And: {
2999 case Instruction::Mul:
3010 case Instruction::UDiv:
3024 Instruction *InstCombiner::foldICmpEqIntrinsicWithConstant(ICmpInst &Cmp,
3096 return ICmpInst::Create(Instruction::ICmp, NewPred,
3109 Instruction *InstCombiner::foldICmpIntrinsicWithConstant(ICmpInst &Cmp,
3123 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_ULT,
3132 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_UGT,
3145 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_EQ,
3154 return CmpInst::Create(Instruction::ICmp, ICmpInst::ICMP_NE,
3168 Instruction *InstCombiner::foldICmpInstWithConstantNotInt(ICmpInst &I) {
3171 Instruction *LHSI = dyn_cast<Instruction>(Op0);
3171 Instruction *LHSI = dyn_cast<Instruction>(Op0);
3176 case Instruction::GetElementPtr:
3184 case Instruction::PHI:
3189 if (Instruction *NV = foldOpIntoPhi(I, cast<PHINode>(LHSI)))
3192 case Instruction::Select: {
3240 case Instruction::IntToPtr:
3249 case Instruction::Load:
3256 if (Instruction *Res = foldCmpLoadFromIndexedGlobal(GEP, GV, I))
3463 Instruction *XShift, *MaybeTruncation, *YShift;
3474 Instruction *WidestShift = YShift;
3477 Instruction *NarrowestShift = XShift;
3588 Value *T0 = XShiftOpcode == Instruction::BinaryOps::LShr
3606 Instruction *Mul;
3667 Instruction *InstCombiner::foldICmpBinOp(ICmpInst &I, const SimplifyQuery &SQ) {
3705 if (BO0 && BO0->getOpcode() == Instruction::Add) {
3709 if (BO1 && BO1->getOpcode() == Instruction::Add) {
3847 if (BO0 && BO0->getOpcode() == Instruction::Sub) {
3851 if (BO1 && BO1->getOpcode() == Instruction::Sub) {
3899 if (BO0 && BO0->getOpcode() == Instruction::SRem && Op1 == BO0->getOperand(1))
3902 else if (BO1 && BO1->getOpcode() == Instruction::SRem &&
3931 case Instruction::Add:
3932 case Instruction::Sub:
3933 case Instruction::Xor: {
3947 if (BO0->getOpcode() == Instruction::Xor && C->isMaxSignedValue()) {
3956 case Instruction::Mul: {
3980 case Instruction::UDiv:
3981 case Instruction::LShr:
3986 case Instruction::SDiv:
3991 case Instruction::AShr:
3996 case Instruction::Shl: {
4035 static Instruction *foldICmpWithMinMax(ICmpInst &Cmp) {
4121 Instruction *InstCombiner::foldICmpEquality(ICmpInst &I) {
4298 static Instruction *foldICmpWithZextOrSext(ICmpInst &ICmp,
4306 bool IsSignedExt = CastOp0->getOpcode() == Instruction::SExt;
4391 Instruction *InstCombiner::foldICmpWithCastOp(ICmpInst &ICmp) {
4411 if (CastOp0->getOpcode() == Instruction::PtrToInt &&
4434 static bool isNeutralValue(Instruction::BinaryOps BinaryOp, Value *RHS) {
4438 case Instruction::Add:
4439 case Instruction::Sub:
4441 case Instruction::Mul:
4447 Instruction::BinaryOps BinaryOp, bool IsSigned,
4448 Value *LHS, Value *RHS, Instruction *CxtI) const {
4452 case Instruction::Add:
4457 case Instruction::Sub:
4462 case Instruction::Mul:
4471 Instruction::BinaryOps BinaryOp, bool IsSigned, Value *LHS, Value *RHS,
4472 Instruction &OrigI, Value *&Result, Constant *&Overflow) {
4501 if (auto *Inst = dyn_cast<Instruction>(Result)) {
4501 if (auto *Inst = dyn_cast<Instruction>(Result)) {
4527 static Instruction *processUMulZExtIdiom(ICmpInst &I, Value *MulVal,
4536 auto *MulInstr = dyn_cast<Instruction>(MulVal);
4536 auto *MulInstr = dyn_cast<Instruction>(MulVal);
4575 if (BO->getOpcode() != Instruction::And)
4709 Instruction *Zext =
4710 cast<Instruction>(Builder.CreateZExt(ShortAnd, BO->getType()));
4716 IC.Worklist.Add(cast<Instruction>(U));
4719 if (isa<Instruction>(OtherVal))
4720 IC.Worklist.Add(cast<Instruction>(OtherVal));
4822 bool InstCombiner::dominatesAllUses(const Instruction *DI,
4823 const Instruction *UI,
4836 auto *Usr = cast<Instruction>(U);
4925 Instruction *InstCombiner::foldICmpUsingKnownBits(ICmpInst &I) {
5227 static Instruction *canonicalizeICmpBool(ICmpInst &I,
5306 static Instruction *foldICmpWithHighBitMask(ICmpInst &Cmp,
5354 return CmpInst::Create(Instruction::ICmp, NewPred, NewX, Zero);
5357 static Instruction *foldVectorCmp(CmpInst &Cmp,
5377 Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
5405 return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1);
5409 return CmpInst::Create(Instruction::ICmp, I.getPredicate(), V, Op1);
5415 if (Instruction *Res = canonicalizeICmpBool(I, Builder))
5421 if (Instruction *Res = foldICmpWithConstant(I))
5424 if (Instruction *Res = foldICmpWithDominatingICmp(I))
5427 if (Instruction *Res = foldICmpBinOp(I, Q))
5430 if (Instruction *Res = foldICmpUsingKnownBits(I))
5451 if (Instruction *Res = foldICmpWithZero(I))
5475 if (Instruction *Res = foldICmpInstWithConstant(I))
5480 if (Instruction *New = foldSignBitTest(I))
5483 if (Instruction *Res = foldICmpInstWithConstantNotInt(I))
5488 if (Instruction *NI = foldGEPICmp(GEP, Op1, I.getPredicate(), I))
5491 if (Instruction *NI = foldGEPICmp(GEP, Op0,
5499 if (Instruction *New = foldAllocaCmp(I, Alloca, Op1))
5502 if (Instruction *New = foldAllocaCmp(I, Alloca, Op0))
5506 if (Instruction *Res = foldICmpBitCast(I, Builder))
5509 if (Instruction *R = foldICmpWithCastOp(I))
5512 if (Instruction *Res = foldICmpWithMinMax(I))
5538 Instruction *AddI = nullptr;
5544 if (OptimizeOverflowCheck(Instruction::Add, /*Signed*/false, A, B,
5553 if (Instruction *R = processUMulZExtIdiom(I, Op0, Op1, *this))
5557 if (Instruction *R = processUMulZExtIdiom(I, Op1, Op0, *this))
5562 if (Instruction *Res = foldICmpEquality(I))
5593 if (Instruction *Res = foldICmpWithHighBitMask(I, Builder))
5597 if (Instruction *Res = foldVectorCmp(I, Builder))
5604 Instruction *InstCombiner::foldFCmpIntToFPConst(FCmpInst &I, Instruction *LHSI,
5604 Instruction *InstCombiner::foldFCmpIntToFPConst(FCmpInst &I, Instruction *LHSI,
5843 static Instruction *foldFCmpReciprocalAndZero(FCmpInst &I, Instruction *LHSI,
5843 static Instruction *foldFCmpReciprocalAndZero(FCmpInst &I, Instruction *LHSI,
5890 static Instruction *foldFabsWithFcmpZero(FCmpInst &I) {
5953 Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
6037 Instruction *LHSI;
6041 case Instruction::PHI:
6046 if (Instruction *NV = foldOpIntoPhi(I, cast<PHINode>(LHSI)))
6049 case Instruction::SIToFP:
6050 case Instruction::UIToFP:
6051 if (Instruction *NV = foldFCmpIntToFPConst(I, LHSI, RHSC))
6054 case Instruction::FDiv:
6055 if (Instruction *NV = foldFCmpReciprocalAndZero(I, LHSI, RHSC))
6058 case Instruction::Load:
6063 if (Instruction *Res = foldCmpLoadFromIndexedGlobal(GEP, GV, I))
6069 if (Instruction *R = foldFabsWithFcmpZero(I))
6109 if (Instruction *Res = foldVectorCmp(I, Builder))
lib/Transforms/InstCombine/InstCombineInternal.h 84 if (isa<Instruction>(V)) {
203 if (BO->getOpcode() == Instruction::Add ||
204 BO->getOpcode() == Instruction::Sub)
224 auto *I = cast<Instruction>(U);
224 auto *I = cast<Instruction>(U);
226 case Instruction::Select:
227 case Instruction::Br:
229 case Instruction::Xor: // Can invert 'xor' if it's a 'not', by ignoring it.
256 case Instruction::SRem: // X % 1 = 0
257 case Instruction::URem: // X %u 1 = 0
260 case Instruction::FRem: // X % 1.0 (doesn't simplify, but it is safe)
268 case Instruction::Shl: // 0 << X = 0
269 case Instruction::LShr: // 0 >>u X = 0
270 case Instruction::AShr: // 0 >> X = 0
271 case Instruction::SDiv: // 0 / X = 0
272 case Instruction::UDiv: // 0 /u X = 0
273 case Instruction::SRem: // 0 % X = 0
274 case Instruction::URem: // 0 %u X = 0
275 case Instruction::Sub: // 0 - X (doesn't simplify, but it is safe)
276 case Instruction::FSub: // 0.0 - X (doesn't simplify, but it is safe)
277 case Instruction::FDiv: // 0.0 / X (doesn't simplify, but it is safe)
278 case Instruction::FRem: // 0.0 % X = 0
301 : public InstVisitor<InstCombiner, Instruction *> {
369 Instruction *visitFNeg(UnaryOperator &I);
370 Instruction *visitAdd(BinaryOperator &I);
371 Instruction *visitFAdd(BinaryOperator &I);
373 Instruction *visitSub(BinaryOperator &I);
374 Instruction *visitFSub(BinaryOperator &I);
375 Instruction *visitMul(BinaryOperator &I);
376 Instruction *visitFMul(BinaryOperator &I);
377 Instruction *visitURem(BinaryOperator &I);
378 Instruction *visitSRem(BinaryOperator &I);
379 Instruction *visitFRem(BinaryOperator &I);
381 Instruction *commonRemTransforms(BinaryOperator &I);
382 Instruction *commonIRemTransforms(BinaryOperator &I);
383 Instruction *commonDivTransforms(BinaryOperator &I);
384 Instruction *commonIDivTransforms(BinaryOperator &I);
385 Instruction *visitUDiv(BinaryOperator &I);
386 Instruction *visitSDiv(BinaryOperator &I);
387 Instruction *visitFDiv(BinaryOperator &I);
389 Instruction *visitAnd(BinaryOperator &I);
390 Instruction *visitOr(BinaryOperator &I);
391 Instruction *visitXor(BinaryOperator &I);
392 Instruction *visitShl(BinaryOperator &I);
396 Instruction *canonicalizeCondSignextOfHighBitExtractToSignextHighBitExtract(
398 Instruction *foldVariableSignZeroExtensionOfVariableHighBitExtract(
400 Instruction *visitAShr(BinaryOperator &I);
401 Instruction *visitLShr(BinaryOperator &I);
402 Instruction *commonShiftTransforms(BinaryOperator &I);
403 Instruction *visitFCmpInst(FCmpInst &I);
404 Instruction *visitICmpInst(ICmpInst &I);
405 Instruction *FoldShiftByConstant(Value *Op0, Constant *Op1,
407 Instruction *commonCastTransforms(CastInst &CI);
408 Instruction *commonPointerCastTransforms(CastInst &CI);
409 Instruction *visitTrunc(TruncInst &CI);
410 Instruction *visitZExt(ZExtInst &CI);
411 Instruction *visitSExt(SExtInst &CI);
412 Instruction *visitFPTrunc(FPTruncInst &CI);
413 Instruction *visitFPExt(CastInst &CI);
414 Instruction *visitFPToUI(FPToUIInst &FI);
415 Instruction *visitFPToSI(FPToSIInst &FI);
416 Instruction *visitUIToFP(CastInst &CI);
417 Instruction *visitSIToFP(CastInst &CI);
418 Instruction *visitPtrToInt(PtrToIntInst &CI);
419 Instruction *visitIntToPtr(IntToPtrInst &CI);
420 Instruction *visitBitCast(BitCastInst &CI);
421 Instruction *visitAddrSpaceCast(AddrSpaceCastInst &CI);
422 Instruction *FoldItoFPtoI(Instruction &FI);
422 Instruction *FoldItoFPtoI(Instruction &FI);
423 Instruction *visitSelectInst(SelectInst &SI);
424 Instruction *visitCallInst(CallInst &CI);
425 Instruction *visitInvokeInst(InvokeInst &II);
426 Instruction *visitCallBrInst(CallBrInst &CBI);
428 Instruction *SliceUpIllegalIntegerPHI(PHINode &PN);
429 Instruction *visitPHINode(PHINode &PN);
430 Instruction *visitGetElementPtrInst(GetElementPtrInst &GEP);
431 Instruction *visitAllocaInst(AllocaInst &AI);
432 Instruction *visitAllocSite(Instruction &FI);
432 Instruction *visitAllocSite(Instruction &FI);
433 Instruction *visitFree(CallInst &FI);
434 Instruction *visitLoadInst(LoadInst &LI);
435 Instruction *visitStoreInst(StoreInst &SI);
436 Instruction *visitAtomicRMWInst(AtomicRMWInst &SI);
437 Instruction *visitBranchInst(BranchInst &BI);
438 Instruction *visitFenceInst(FenceInst &FI);
439 Instruction *visitSwitchInst(SwitchInst &SI);
440 Instruction *visitReturnInst(ReturnInst &RI);
441 Instruction *visitInsertValueInst(InsertValueInst &IV);
442 Instruction *visitInsertElementInst(InsertElementInst &IE);
443 Instruction *visitExtractElementInst(ExtractElementInst &EI);
444 Instruction *visitShuffleVectorInst(ShuffleVectorInst &SVI);
445 Instruction *visitExtractValueInst(ExtractValueInst &EV);
446 Instruction *visitLandingPadInst(LandingPadInst &LI);
447 Instruction *visitVAStartInst(VAStartInst &I);
448 Instruction *visitVACopyInst(VACopyInst &I);
451 Instruction *visitInstruction(Instruction &I) { return nullptr; }
451 Instruction *visitInstruction(Instruction &I) { return nullptr; }
456 bool dominatesAllUses(const Instruction *DI, const Instruction *UI,
456 bool dominatesAllUses(const Instruction *DI, const Instruction *UI,
466 bool replacePointer(Instruction &I, Value *V);
498 bool OptimizeOverflowCheck(Instruction::BinaryOps BinaryOp, bool IsSigned,
500 Instruction &CtxI, Value *&OperationResult,
503 Instruction *visitCallBase(CallBase &Call);
504 Instruction *tryOptimizeCall(CallInst *CI);
506 Instruction *transformCallThroughTrampoline(CallBase &Call,
510 Instruction *simplifyMaskedStore(IntrinsicInst &II);
511 Instruction *simplifyMaskedGather(IntrinsicInst &II);
512 Instruction *simplifyMaskedScatter(IntrinsicInst &II);
526 Instruction *transformZExtICmp(ICmpInst *ICI, ZExtInst &CI,
529 Instruction *transformSExtICmp(ICmpInst *ICI, Instruction &CI);
529 Instruction *transformSExtICmp(ICmpInst *ICI, Instruction &CI);
532 const Instruction &CxtI) const {
538 const Instruction &CxtI) const {
544 const Instruction &CxtI, bool IsSigned) const {
550 const Instruction &CxtI) const {
556 const Instruction &CxtI) const {
562 const Instruction &CxtI, bool IsSigned) const {
568 const Instruction &CxtI) const {
574 const Instruction &CxtI) const {
580 const Instruction &CxtI, bool IsSigned) const {
586 const Value *RHS, const Instruction &CxtI,
589 case Instruction::Add: return willNotOverflowAdd(LHS, RHS, CxtI, IsSigned);
590 case Instruction::Sub: return willNotOverflowSub(LHS, RHS, CxtI, IsSigned);
591 case Instruction::Mul: return willNotOverflowMul(LHS, RHS, CxtI, IsSigned);
597 Instruction *scalarizePHI(ExtractElementInst &EI, PHINode *PN);
598 Instruction *foldCastedBitwiseLogic(BinaryOperator &I);
599 Instruction *narrowBinOp(TruncInst &Trunc);
600 Instruction *narrowMaskedBinOp(BinaryOperator &And);
601 Instruction *narrowMathIfNoOverflow(BinaryOperator &I);
602 Instruction *narrowRotate(TruncInst &Trunc);
603 Instruction *optimizeBitCastFromPhi(CastInst &CI, PHINode *PN);
604 Instruction *matchSAddSubSat(SelectInst &MinMax1);
616 Instruction::CastOps isEliminableCastPair(const CastInst *CI1,
619 Value *foldAndOfICmps(ICmpInst *LHS, ICmpInst *RHS, Instruction &CxtI);
620 Value *foldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS, Instruction &CxtI);
629 bool JoinedByAnd, Instruction &CxtI);
633 Instruction *foldIntrinsicWithOverflowCommon(IntrinsicInst *II);
640 Instruction *InsertNewInstBefore(Instruction *New, Instruction &Old) {
640 Instruction *InsertNewInstBefore(Instruction *New, Instruction &Old) {
640 Instruction *InsertNewInstBefore(Instruction *New, Instruction &Old) {
650 Instruction *InsertNewInstWith(Instruction *New, Instruction &Old) {
650 Instruction *InsertNewInstWith(Instruction *New, Instruction &Old) {
650 Instruction *InsertNewInstWith(Instruction *New, Instruction &Old) {
661 Instruction *replaceInstUsesWith(Instruction &I, Value *V) {
661 Instruction *replaceInstUsesWith(Instruction &I, Value *V) {
682 Instruction *CreateOverflowTuple(IntrinsicInst *II, Value *Result,
692 void CreateNonTerminatorUnreachable(Instruction *InsertAt) {
705 Instruction *eraseInstFromFunction(Instruction &I) {
705 Instruction *eraseInstFromFunction(Instruction &I) {
714 if (auto *Inst = dyn_cast<Instruction>(Operand))
714 if (auto *Inst = dyn_cast<Instruction>(Operand))
724 unsigned Depth, const Instruction *CxtI) const {
729 const Instruction *CxtI) const {
735 const Instruction *CxtI = nullptr) {
740 const Instruction *CxtI = nullptr) const {
745 const Instruction *CxtI = nullptr) const {
751 const Instruction *CxtI) const {
757 const Instruction *CxtI) const {
763 const Instruction *CxtI) const {
769 const Instruction *CxtI) const {
775 const Instruction *CxtI) const {
780 const Instruction *CxtI) const {
785 Instruction::BinaryOps BinaryOp, bool IsSigned,
786 Value *LHS, Value *RHS, Instruction *CxtI) const;
819 Value *tryFactorization(BinaryOperator &, Instruction::BinaryOps, Value *,
834 unsigned Depth, Instruction *CxtI);
835 bool SimplifyDemandedBits(Instruction *I, unsigned Op,
842 Value *SimplifyMultipleUseDemandedBits(Instruction *I,
845 unsigned Depth, Instruction *CxtI);
850 Instruction *Shr, const APInt &ShrOp1, Instruction *Shl,
850 Instruction *Shr, const APInt &ShrOp1, Instruction *Shl,
855 bool SimplifyDemandedInstructionBits(Instruction &Inst);
866 Instruction *foldVectorBinop(BinaryOperator &Inst);
871 Instruction *foldOpIntoPhi(Instruction &I, PHINode *PN);
871 Instruction *foldOpIntoPhi(Instruction &I, PHINode *PN);
877 Instruction *FoldOpIntoSelect(Instruction &Op, SelectInst *SI);
877 Instruction *FoldOpIntoSelect(Instruction &Op, SelectInst *SI);
880 Instruction *foldBinOpIntoSelectOrPhi(BinaryOperator &I);
882 Instruction *foldAddWithConstant(BinaryOperator &Add);
886 Instruction *FoldPHIArgOpIntoPHI(PHINode &PN);
887 Instruction *FoldPHIArgBinOpIntoPHI(PHINode &PN);
888 Instruction *FoldPHIArgGEPIntoPHI(PHINode &PN);
889 Instruction *FoldPHIArgLoadIntoPHI(PHINode &PN);
890 Instruction *FoldPHIArgZextsIntoPHI(PHINode &PN);
895 Instruction *FoldIntegerTypedPHI(PHINode &PN);
899 void PHIArgMergedDebugLoc(Instruction *Inst, PHINode &PN);
901 Instruction *foldGEPICmp(GEPOperator *GEPLHS, Value *RHS,
902 ICmpInst::Predicate Cond, Instruction &I);
903 Instruction *foldAllocaCmp(ICmpInst &ICI, const AllocaInst *Alloca,
905 Instruction *foldCmpLoadFromIndexedGlobal(GetElementPtrInst *GEP,
908 Instruction *foldFCmpIntToFPConst(FCmpInst &I, Instruction *LHSI,
908 Instruction *foldFCmpIntToFPConst(FCmpInst &I, Instruction *LHSI,
910 Instruction *foldICmpAddOpConst(Value *X, const APInt &C,
912 Instruction *foldICmpWithCastOp(ICmpInst &ICI);
914 Instruction *foldICmpUsingKnownBits(ICmpInst &Cmp);
915 Instruction *foldICmpWithDominatingICmp(ICmpInst &Cmp);
916 Instruction *foldICmpWithConstant(ICmpInst &Cmp);
917 Instruction *foldICmpInstWithConstant(ICmpInst &Cmp);
918 Instruction *foldICmpInstWithConstantNotInt(ICmpInst &Cmp);
919 Instruction *foldICmpBinOp(ICmpInst &Cmp, const SimplifyQuery &SQ);
920 Instruction *foldICmpEquality(ICmpInst &Cmp);
921 Instruction *foldIRemByPowerOfTwoToBitTest(ICmpInst &I);
922 Instruction *foldSignBitTest(ICmpInst &I);
923 Instruction *foldICmpWithZero(ICmpInst &Cmp);
927 Instruction *foldICmpSelectConstant(ICmpInst &Cmp, SelectInst *Select,
929 Instruction *foldICmpTruncConstant(ICmpInst &Cmp, TruncInst *Trunc,
931 Instruction *foldICmpAndConstant(ICmpInst &Cmp, BinaryOperator *And,
933 Instruction *foldICmpXorConstant(ICmpInst &Cmp, BinaryOperator *Xor,
935 Instruction *foldICmpOrConstant(ICmpInst &Cmp, BinaryOperator *Or,
937 Instruction *foldICmpMulConstant(ICmpInst &Cmp, BinaryOperator *Mul,
939 Instruction *foldICmpShlConstant(ICmpInst &Cmp, BinaryOperator *Shl,
941 Instruction *foldICmpShrConstant(ICmpInst &Cmp, BinaryOperator *Shr,
943 Instruction *foldICmpSRemConstant(ICmpInst &Cmp, BinaryOperator *UDiv,
945 Instruction *foldICmpUDivConstant(ICmpInst &Cmp, BinaryOperator *UDiv,
947 Instruction *foldICmpDivConstant(ICmpInst &Cmp, BinaryOperator *Div,
949 Instruction *foldICmpSubConstant(ICmpInst &Cmp, BinaryOperator *Sub,
951 Instruction *foldICmpAddConstant(ICmpInst &Cmp, BinaryOperator *Add,
953 Instruction *foldICmpAndConstConst(ICmpInst &Cmp, BinaryOperator *And,
955 Instruction *foldICmpAndShift(ICmpInst &Cmp, BinaryOperator *And,
957 Instruction *foldICmpShrConstConst(ICmpInst &I, Value *ShAmt, const APInt &C1,
959 Instruction *foldICmpShlConstConst(ICmpInst &I, Value *ShAmt, const APInt &C1,
962 Instruction *foldICmpBinOpEqualityWithConstant(ICmpInst &Cmp,
965 Instruction *foldICmpIntrinsicWithConstant(ICmpInst &ICI, IntrinsicInst *II,
967 Instruction *foldICmpEqIntrinsicWithConstant(ICmpInst &ICI, IntrinsicInst *II,
971 Instruction *foldSelectExtConst(SelectInst &Sel);
972 Instruction *foldSelectOpOp(SelectInst &SI, Instruction *TI, Instruction *FI);
972 Instruction *foldSelectOpOp(SelectInst &SI, Instruction *TI, Instruction *FI);
972 Instruction *foldSelectOpOp(SelectInst &SI, Instruction *TI, Instruction *FI);
973 Instruction *foldSelectIntoOp(SelectInst &SI, Value *, Value *);
974 Instruction *foldSPFofSPF(Instruction *Inner, SelectPatternFlavor SPF1,
974 Instruction *foldSPFofSPF(Instruction *Inner, SelectPatternFlavor SPF1,
975 Value *A, Value *B, Instruction &Outer,
977 Instruction *foldSelectInstWithICmp(SelectInst &SI, ICmpInst *ICI);
979 Instruction *OptAndOp(BinaryOperator *Op, ConstantInt *OpRHS,
984 Instruction *PromoteCastOfAllocation(BitCastInst &CI, AllocaInst &AI);
989 Instruction *matchBSwap(BinaryOperator &Or);
991 Instruction *SimplifyAnyMemTransfer(AnyMemTransferInst *MI);
992 Instruction *SimplifyAnyMemSet(AnyMemSetInst *MI);
lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp 43 if (CE->getOpcode() == Instruction::BitCast ||
44 CE->getOpcode() == Instruction::AddrSpaceCast ||
45 CE->getOpcode() == Instruction::GetElementPtr)
60 SmallVectorImpl<Instruction *> &ToDelete) {
71 auto *I = cast<Instruction>(U.getUser());
71 auto *I = cast<Instruction>(U.getUser());
163 SmallVectorImpl<Instruction *> &ToDelete) {
182 static Instruction *simplifyAllocaArraySize(InstCombiner &IC, AllocaInst &AI) {
215 Instruction *GEP = GetElementPtrInst::CreateInBounds(
254 void replacePointer(Instruction &I, Value *V);
257 void findLoadAndReplace(Instruction &I);
258 void replace(Instruction *I);
261 SmallVector<Instruction *, 4> Path;
267 void PointerReplacer::findLoadAndReplace(Instruction &I) {
269 auto *Inst = dyn_cast<Instruction>(&*U);
269 auto *Inst = dyn_cast<Instruction>(&*U);
294 void PointerReplacer::replace(Instruction *I) {
330 void PointerReplacer::replacePointer(Instruction &I, Value *V) {
341 Instruction *InstCombiner::visitAllocaInst(AllocaInst &AI) {
342 if (auto *I = simplifyAllocaArraySize(*this, AI))
365 Instruction *FirstInst = EntryBlock.getFirstNonPHIOrDbg();
402 SmallVector<Instruction *, 4> ToDelete;
420 Instruction *NewI = replaceInstUsesWith(AI, Cast);
536 Instruction *L1;
537 Instruction *L2;
566 static Instruction *combineLoadToOperationType(InstCombiner &IC, LoadInst &LI) {
634 static Instruction *unpackLoadToAggregate(InstCombiner &IC, LoadInst &LI) {
838 Instruction *MemI, unsigned &Idx) {
907 static Instruction *replaceGEPIdxWithZero(InstCombiner &IC, Value *Ptr,
912 Instruction *NewGEPI = GEPI->clone();
949 Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
953 if (Instruction *Res = combineLoadToOperationType(*this, LI))
969 if (Instruction *NewGEPI = replaceGEPIdxWithZero(*this, Op, LI)) {
974 if (Instruction *Res = unpackLoadToAggregate(*this, LI))
1218 llvm::Instruction *NS = IC.Builder.CreateAlignedStore(Val, Ptr, EltAlign);
1268 Instruction *NS = IC.Builder.CreateAlignedStore(Val, Ptr, EltAlign);
1302 if (Instruction *BI = dyn_cast<Instruction>(B))
1302 if (Instruction *BI = dyn_cast<Instruction>(B))
1303 if (cast<Instruction>(A)->isIdenticalToWhenDefined(BI))
1350 Instruction *InstCombiner::visitStoreInst(StoreInst &SI) {
1378 if (Instruction *NewGEPI = replaceGEPIdxWithZero(*this, Ptr, SI)) {
1457 if (Instruction *U = dyn_cast<Instruction>(Val))
1457 if (Instruction *U = dyn_cast<Instruction>(Val))
lib/Transforms/InstCombine/InstCombineMulDivRem.cpp 50 Instruction &CxtI) {
79 if (I->getOpcode() == Instruction::LShr && !I->isExact()) {
84 if (I->getOpcode() == Instruction::Shl && !I->hasNoUnsignedWrap()) {
171 Instruction *InstCombiner::visitMul(BinaryOperator &I) {
179 if (Instruction *X = foldVectorBinop(I))
257 if (Instruction *FoldedMul = foldBinOpIntoSelectOrPhi(I))
303 if (!Div || (Div->getOpcode() != Instruction::UDiv &&
304 Div->getOpcode() != Instruction::SDiv)) {
311 (Div->getOpcode() == Instruction::UDiv ||
312 Div->getOpcode() == Instruction::SDiv)) {
322 auto RemOpc = Div->getOpcode() == Instruction::UDiv ? Instruction::URem
322 auto RemOpc = Div->getOpcode() == Instruction::UDiv ? Instruction::URem
323 : Instruction::SRem;
376 if (Instruction *Ext = narrowMathIfNoOverflow(I))
393 Instruction *InstCombiner::visitFMul(BinaryOperator &I) {
402 if (Instruction *X = foldVectorBinop(I))
405 if (Instruction *FoldedMul = foldBinOpIntoSelectOrPhi(I))
620 for (Instruction::op_iterator I = BBI->op_begin(), E = BBI->op_end();
680 Instruction *InstCombiner::commonIDivTransforms(BinaryOperator &I) {
682 bool IsSigned = I.getOpcode() == Instruction::SDiv;
724 auto *Mul = BinaryOperator::Create(Instruction::Mul, X,
750 auto *Mul = BinaryOperator::Create(Instruction::Mul, X,
760 if (Instruction *FoldedDiv = foldBinOpIntoSelectOrPhi(I))
816 using FoldUDivOperandCb = Instruction *(*)(Value *Op0, Value *Op1,
831 Instruction *FoldResult;
846 static Instruction *foldUDivPow2Cst(Value *Op0, Value *Op1,
859 static Instruction *foldUDivShl(Value *Op0, Value *Op1, const BinaryOperator &I,
919 static Instruction *narrowUDivURem(BinaryOperator &I,
921 Instruction::BinaryOps Opcode = I.getOpcode();
954 Instruction *InstCombiner::visitUDiv(BinaryOperator &I) {
959 if (Instruction *X = foldVectorBinop(I))
963 if (Instruction *Common = commonIDivTransforms(I))
996 if (Instruction *NarrowDiv = narrowUDivURem(I, Builder))
1020 Instruction *Inst;
1048 Instruction *InstCombiner::visitSDiv(BinaryOperator &I) {
1053 if (Instruction *X = foldVectorBinop(I))
1057 if (Instruction *Common = commonIDivTransforms(I))
1103 Instruction *BO = BinaryOperator::CreateSDiv(X, NegC);
1141 static Instruction *foldFDivConstantDivisor(BinaryOperator &I) {
1170 static Instruction *foldFDivConstantDividend(BinaryOperator &I) {
1202 Instruction *InstCombiner::visitFDiv(BinaryOperator &I) {
1208 if (Instruction *X = foldVectorBinop(I))
1211 if (Instruction *R = foldFDivConstantDivisor(I))
1214 if (Instruction *R = foldFDivConstantDividend(I))
1220 if (Instruction *R = FoldOpIntoSelect(I, SI))
1225 if (Instruction *R = FoldOpIntoSelect(I, SI))
1305 Instruction *InstCombiner::commonIRemTransforms(BinaryOperator &I) {
1319 if (Instruction *Op0I = dyn_cast<Instruction>(Op0)) {
1319 if (Instruction *Op0I = dyn_cast<Instruction>(Op0)) {
1321 if (Instruction *R = FoldOpIntoSelect(I, SI))
1326 (I.getOpcode() == Instruction::URem ||
1331 if (Instruction *NV = foldOpIntoPhi(I, PN))
1345 Instruction *InstCombiner::visitURem(BinaryOperator &I) {
1350 if (Instruction *X = foldVectorBinop(I))
1353 if (Instruction *common = commonIRemTransforms(I))
1356 if (Instruction *NarrowRem = narrowUDivURem(I, Builder))
1394 Instruction *InstCombiner::visitSRem(BinaryOperator &I) {
1399 if (Instruction *X = foldVectorBinop(I))
1403 if (Instruction *Common = commonIRemTransforms(I))
1472 Instruction *InstCombiner::visitFRem(BinaryOperator &I) {
1478 if (Instruction *X = foldVectorBinop(I))
lib/Transforms/InstCombine/InstCombinePHI.cpp 32 void InstCombiner::PHIArgMergedDebugLoc(Instruction *Inst, PHINode &PN) {
33 auto *FirstInst = cast<Instruction>(PN.getIncomingValue(0));
33 auto *FirstInst = cast<Instruction>(PN.getIncomingValue(0));
40 auto *I = cast<Instruction>(PN.getIncomingValue(i));
40 auto *I = cast<Instruction>(PN.getIncomingValue(i));
95 Instruction *InstCombiner::FoldIntegerTypedPHI(PHINode &PN) {
144 (DT.dominates(cast<Instruction>(U), PN.getIncomingBlock(i)) ||
145 cast<Instruction>(U)->getParent() == PN.getIncomingBlock(i))) {
224 auto *Inst = dyn_cast<Instruction>(V);
224 auto *Inst = dyn_cast<Instruction>(V);
233 SmallDenseMap<Value *, Instruction *> Casts;
258 Instruction *&CI = Casts[IncomingVal];
262 if (auto *IncomingI = dyn_cast<Instruction>(IncomingVal)) {
262 if (auto *IncomingI = dyn_cast<Instruction>(IncomingVal)) {
283 Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) {
284 Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0));
284 Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0));
295 Instruction *I = dyn_cast<Instruction>(PN.getIncomingValue(i));
295 Instruction *I = dyn_cast<Instruction>(PN.getIncomingValue(i));
344 Instruction *InInst = cast<Instruction>(PN.getIncomingValue(i));
344 Instruction *InInst = cast<Instruction>(PN.getIncomingValue(i));
376 Instruction *InstCombiner::FoldPHIArgGEPIntoPHI(PHINode &PN) {
531 Instruction *InstCombiner::FoldPHIArgLoadIntoPHI(PHINode &PN) {
650 Instruction *InstCombiner::FoldPHIArgZextsIntoPHI(PHINode &Phi) {
653 if (Instruction *TI = Phi.getParent()->getTerminator())
724 Instruction *InstCombiner::FoldPHIArgOpIntoPHI(PHINode &PN) {
727 if (Instruction *TI = PN.getParent()->getTerminator())
731 Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0));
731 Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0));
766 Instruction *I = dyn_cast<Instruction>(PN.getIncomingValue(i));
766 Instruction *I = dyn_cast<Instruction>(PN.getIncomingValue(i));
788 Value *NewInVal = cast<Instruction>(PN.getIncomingValue(i))->getOperand(0);
892 Instruction *Inst; // The trunc instruction.
894 PHIUsageRecord(unsigned pn, unsigned Sh, Instruction *User)
951 Instruction *InstCombiner::SliceUpIllegalIntegerPHI(PHINode &FirstPhi) {
986 Instruction *UserI = cast<Instruction>(U);
986 Instruction *UserI = cast<Instruction>(U);
1002 if (UserI->getOpcode() != Instruction::LShr ||
1102 cast<Instruction>(Res)));
1127 Instruction *InstCombiner::visitPHINode(PHINode &PN) {
1131 if (Instruction *Result = FoldPHIArgZextsIntoPHI(PN))
1136 if (isa<Instruction>(PN.getIncomingValue(0)) &&
1137 isa<Instruction>(PN.getIncomingValue(1)) &&
1138 cast<Instruction>(PN.getIncomingValue(0))->getOpcode() ==
1139 cast<Instruction>(PN.getIncomingValue(1))->getOpcode() &&
1143 if (Instruction *Result = FoldPHIArgOpIntoPHI(PN))
1150 if (Instruction *Result = FoldIntegerTypedPHI(PN))
1153 Instruction *PHIUser = cast<Instruction>(PN.user_back());
1153 Instruction *PHIUser = cast<Instruction>(PN.user_back());
1186 Instruction *CtxI = PN.getIncomingBlock(i)->getTerminator();
1262 if (Instruction *Res = SliceUpIllegalIntegerPHI(PN))
lib/Transforms/InstCombine/InstCombineSelect.cpp 58 static Instruction *foldSelectBinOpIdentity(SelectInst &Sel,
245 case Instruction::Add:
246 case Instruction::Mul:
247 case Instruction::And:
248 case Instruction::Or:
249 case Instruction::Xor:
251 case Instruction::Sub: // Can only fold on the amount subtracted.
252 case Instruction::Shl: // Can only fold on the shift amount.
253 case Instruction::LShr:
254 case Instruction::AShr:
266 case Instruction::Add:
267 case Instruction::Sub:
268 case Instruction::Or:
269 case Instruction::Xor:
270 case Instruction::Shl:
271 case Instruction::LShr:
272 case Instruction::AShr:
274 case Instruction::And:
276 case Instruction::Mul:
282 Instruction *InstCombiner::foldSelectOpOp(SelectInst &SI, Instruction *TI,
282 Instruction *InstCombiner::foldSelectOpOp(SelectInst &SI, Instruction *TI,
283 Instruction *FI) {
318 if (TI->getOpcode() != Instruction::BitCast &&
343 if (TI->getOpcode() != Instruction::FNeg)
424 Instruction *InstCombiner::foldSelectIntoOp(SelectInst &SI, Value *TrueVal,
501 static Instruction *foldSelectICmpAndAnd(Type *SelType, const ICmpInst *Cmp,
565 const auto *Ashr = cast<Instruction>(FalseVal);
565 const auto *Ashr = cast<Instruction>(FalseVal);
567 bool IsExact = Ashr->isExact() && cast<Instruction>(TrueVal)->isExact();
803 static Instruction *foldSelectCtlzToCttz(ICmpInst *ICI, Value *TrueVal,
990 static Instruction *
1029 static Instruction *canonicalizeAbsNabs(SelectInst &Sel, ICmpInst &Cmp,
1157 if (auto *FalseInst = dyn_cast<Instruction>(FalseVal))
1157 if (auto *FalseInst = dyn_cast<Instruction>(FalseVal))
1178 static Instruction *canonicalizeClampLike(SelectInst &Sel0, ICmpInst &Cmp0,
1301 Instruction *MaybeReplacedHigh =
1315 static Instruction *
1383 Instruction *InstCombiner::foldSelectInstWithICmp(SelectInst &SI,
1388 if (Instruction *NewSel = canonicalizeMinMaxWithConstant(SI, *ICI, Builder))
1391 if (Instruction *NewAbs = canonicalizeAbsNabs(SI, *ICI, Builder))
1394 if (Instruction *NewAbs = canonicalizeClampLike(SI, *ICI, Builder))
1397 if (Instruction *NewSel =
1474 if (Instruction *V =
1478 if (Instruction *V = foldSelectCtlzToCttz(ICI, TrueVal, FalseVal, Builder))
1512 const Instruction *I = dyn_cast<Instruction>(V);
1512 const Instruction *I = dyn_cast<Instruction>(V);
1536 Instruction *InstCombiner::foldSPFofSPF(Instruction *Inner,
1536 Instruction *InstCombiner::foldSPFofSPF(Instruction *Inner,
1539 Instruction &Outer,
1665 static Instruction *foldAddSubSelect(SelectInst &SI,
1670 auto *TI = dyn_cast<Instruction>(TrueVal);
1670 auto *TI = dyn_cast<Instruction>(TrueVal);
1671 auto *FI = dyn_cast<Instruction>(FalseVal);
1671 auto *FI = dyn_cast<Instruction>(FalseVal);
1675 Instruction *AddOp = nullptr, *SubOp = nullptr;
1676 if ((TI->getOpcode() == Instruction::Sub &&
1677 FI->getOpcode() == Instruction::Add) ||
1678 (TI->getOpcode() == Instruction::FSub &&
1679 FI->getOpcode() == Instruction::FAdd)) {
1682 } else if ((FI->getOpcode() == Instruction::Sub &&
1683 TI->getOpcode() == Instruction::Add) ||
1684 (FI->getOpcode() == Instruction::FSub &&
1685 TI->getOpcode() == Instruction::FAdd)) {
1704 if (Instruction *NegInst = dyn_cast<Instruction>(NegVal)) {
1704 if (Instruction *NegInst = dyn_cast<Instruction>(NegVal)) {
1721 Instruction *RI =
1735 Instruction *InstCombiner::foldSelectExtConst(SelectInst &Sel) {
1741 Instruction *ExtInst;
1747 if (ExtOpcode != Instruction::ZExt && ExtOpcode != Instruction::SExt)
1747 if (ExtOpcode != Instruction::ZExt && ExtOpcode != Instruction::SExt)
1798 static Instruction *canonicalizeSelectToShuffle(SelectInst &SI) {
1838 static Instruction *canonicalizeScalarSelectOfVecs(
1861 static Instruction *foldSelectCmpBitcasts(SelectInst &Sel,
1928 static Instruction *foldSelectCmpXchg(SelectInst &SI) {
1977 static Instruction *moveAddAfterMinMax(SelectPatternFlavor SPF, Value *X,
2015 Instruction *InstCombiner::matchSAddSubSat(SelectInst &MinMax1) {
2021 Instruction *MinMax2;
2064 if (AddSub->getOpcode() == Instruction::Add)
2066 else if (AddSub->getOpcode() == Instruction::Sub)
2076 return CastInst::Create(Instruction::SExt, Sat, Ty);
2080 static Instruction *factorizeMinMaxTree(SelectPatternFlavor SPF, Value *LHS,
2140 static Instruction *foldSelectRotate(SelectInst &Sel) {
2190 Instruction *InstCombiner::visitSelectInst(SelectInst &SI) {
2216 if (Instruction *I = canonicalizeSelectToShuffle(SI))
2219 if (Instruction *I = canonicalizeScalarSelectOfVecs(SI, Builder))
2352 Instruction *FSub;
2371 Instruction *FNeg;
2396 if (Instruction *Result = foldSelectInstWithICmp(SI, ICI))
2399 if (Instruction *Add = foldAddSubSelect(SI, Builder))
2403 auto *TI = dyn_cast<Instruction>(TrueVal);
2403 auto *TI = dyn_cast<Instruction>(TrueVal);
2404 auto *FI = dyn_cast<Instruction>(FalseVal);
2404 auto *FI = dyn_cast<Instruction>(FalseVal);
2406 if (Instruction *IV = foldSelectOpOp(SI, TI, FI))
2409 if (Instruction *I = foldSelectExtConst(SI))
2414 if (Instruction *FoldI = foldSelectIntoOp(SI, TrueVal, FalseVal))
2418 Instruction::CastOps CastOp;
2424 if (Instruction *R = foldSPFofSPF(cast<Instruction>(LHS), SPF2, LHS2,
2424 if (Instruction *R = foldSPFofSPF(cast<Instruction>(LHS), SPF2, LHS2,
2428 if (Instruction *R = foldSPFofSPF(cast<Instruction>(RHS), SPF2, LHS2,
2428 if (Instruction *R = foldSPFofSPF(cast<Instruction>(RHS), SPF2, LHS2,
2495 if (Instruction *I = moveNotAfterMinMax(LHS, RHS))
2497 if (Instruction *I = moveNotAfterMinMax(RHS, LHS))
2500 if (Instruction *I = moveAddAfterMinMax(SPF, LHS, RHS, Builder))
2503 if (Instruction *I = factorizeMinMaxTree(SPF, LHS, RHS, Builder))
2505 if (Instruction *I = matchSAddSubSat(SI))
2528 if (Instruction *NV = foldOpIntoPhi(SI, PN))
2575 case Instruction::SRem:
2576 case Instruction::URem:
2577 case Instruction::SDiv:
2578 case Instruction::UDiv:
2659 if (Instruction *BitCastSel = foldSelectCmpBitcasts(SI, Builder))
2663 if (Instruction *Select = foldSelectCmpXchg(SI))
2666 if (Instruction *Select = foldSelectBinOpIdentity(SI, TLI))
2669 if (Instruction *Rot = foldSelectRotate(SI))
lib/Transforms/InstCombine/InstCombineShifts.cpp 35 Instruction *Sh0Op0;
44 Instruction *Sh1;
70 Instruction::BinaryOps ShiftOpcode = Sh0->getOpcode();
122 if (ShiftOpcode == Instruction::BinaryOps::Shl) {
132 Instruction *Ret = NewShift;
135 Ret = CastInst::Create(Instruction::Trunc, NewShift, Sh0->getType());
175 static Instruction *
283 return BinaryOperator::Create(Instruction::And, NewShift, NewMask);
286 Instruction *InstCombiner::commonShiftTransforms(BinaryOperator &I) {
304 if (Instruction *R = FoldOpIntoSelect(I, SI))
308 if (Instruction *Res = FoldShiftByConstant(Op0, CUI, I))
311 if (auto *NewShift = cast_or_null<Instruction>(
311 if (auto *NewShift = cast_or_null<Instruction>(
344 Instruction *InnerShift, InstCombiner &IC,
345 Instruction *CxtI) {
356 bool IsInnerShl = InnerShift->getOpcode() == Instruction::Shl;
396 InstCombiner &IC, Instruction *CxtI) {
401 Instruction *I = dyn_cast<Instruction>(V);
401 Instruction *I = dyn_cast<Instruction>(V);
435 case Instruction::And:
436 case Instruction::Or:
437 case Instruction::Xor:
442 case Instruction::Shl:
443 case Instruction::LShr:
446 case Instruction::Select: {
453 case Instruction::PHI: {
471 bool IsInnerShl = InnerShift->getOpcode() == Instruction::Shl;
512 if (auto *AndI = dyn_cast<Instruction>(And)) {
512 if (auto *AndI = dyn_cast<Instruction>(And)) {
547 Instruction *I = cast<Instruction>(V);
547 Instruction *I = cast<Instruction>(V);
552 case Instruction::And:
553 case Instruction::Or:
554 case Instruction::Xor:
562 case Instruction::Shl:
563 case Instruction::LShr:
567 case Instruction::Select:
573 case Instruction::PHI: {
593 case Instruction::Add:
594 return Shift.getOpcode() == Instruction::Shl;
595 case Instruction::Or:
596 case Instruction::Xor:
597 case Instruction::And:
602 Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, Constant *Op1,
604 bool isLeftShift = I.getOpcode() == Instruction::Shl;
612 if (I.getOpcode() != Instruction::AShr &&
630 if (Instruction *FoldedShift = foldBinOpIntoSelectOrPhi(I))
635 Instruction *TrOp = dyn_cast<Instruction>(TI->getOperand(0));
635 Instruction *TrOp = dyn_cast<Instruction>(TI->getOperand(0));
661 if (I.getOpcode() == Instruction::Shl)
685 case Instruction::Add:
686 case Instruction::And:
687 case Instruction::Or:
688 case Instruction::Xor: {
724 case Instruction::Sub: {
782 if (isLeftShift && Op0BO->getOpcode() == Instruction::Sub &&
845 Instruction *InstCombiner::visitShl(BinaryOperator &I) {
852 if (Instruction *X = foldVectorBinop(I))
855 if (Instruction *V = commonShiftTransforms(I))
858 if (Instruction *V = dropRedundantMaskingOfLeftShiftInput(&I, Q, Builder))
967 Instruction *InstCombiner::visitLShr(BinaryOperator &I) {
972 if (Instruction *X = foldVectorBinop(I))
975 if (Instruction *R = commonShiftTransforms(I))
1096 Instruction *
1113 Instruction *MaybeTrunc;
1125 Instruction *HighBitExtract;
1155 Instruction *NewAShr =
1165 Instruction *InstCombiner::visitAShr(BinaryOperator &I) {
1170 if (Instruction *X = foldVectorBinop(I))
1173 if (Instruction *R = commonShiftTransforms(I))
1207 auto *NewShl = BinaryOperator::Create(Instruction::Shl, X, ShiftDiff);
1239 if (Instruction *R = foldVariableSignZeroExtensionOfVariableHighBitExtract(I))
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp 39 static bool ShrinkDemandedConstant(Instruction *I, unsigned OpNo,
64 bool InstCombiner::SimplifyDemandedInstructionBits(Instruction &Inst) {
80 bool InstCombiner::SimplifyDemandedBits(Instruction *I, unsigned OpNo,
118 Instruction *CxtI) {
140 Instruction *I = dyn_cast<Instruction>(V);
140 Instruction *I = dyn_cast<Instruction>(V);
165 case Instruction::And: {
199 case Instruction::Or: {
233 case Instruction::Xor: {
263 Instruction *Or =
277 Instruction *And = BinaryOperator::CreateAnd(I->getOperand(0), AndC);
290 if (Instruction *LHSInst = dyn_cast<Instruction>(I->getOperand(0)))
290 if (Instruction *LHSInst = dyn_cast<Instruction>(I->getOperand(0)))
291 if (LHSInst->getOpcode() == Instruction::And && LHSInst->hasOneUse() &&
301 Instruction *NewAnd = BinaryOperator::CreateAnd(I->getOperand(0), AndC);
306 Instruction *NewXor = BinaryOperator::CreateXor(NewAnd, XorC);
316 case Instruction::Select: {
360 case Instruction::ZExt:
361 case Instruction::Trunc: {
374 case Instruction::BitCast:
395 case Instruction::SExt: {
425 case Instruction::Add:
426 case Instruction::Sub: {
454 if ((I->getOpcode() == Instruction::Add ||
461 Known = KnownBits::computeForAddSub(I->getOpcode() == Instruction::Add,
465 case Instruction::Shl: {
470 if (Instruction *Shr = dyn_cast<Instruction>(I->getOperand(0)))
470 if (Instruction *Shr = dyn_cast<Instruction>(I->getOperand(0)))
496 case Instruction::LShr: {
519 case Instruction::AShr: {
526 Instruction *NewVal = BinaryOperator::CreateLShr(
579 case Instruction::UDiv: {
600 case Instruction::SRem:
644 case Instruction::URem: {
655 case Instruction::Call:
677 Instruction *NewVal;
762 Value *InstCombiner::SimplifyMultipleUseDemandedBits(Instruction *I,
766 Instruction *CxtI) {
778 case Instruction::And: {
806 case Instruction::Or: {
837 case Instruction::Xor: {
904 InstCombiner::simplifyShrShlDemandedBits(Instruction *Shr, const APInt &ShrOp1,
905 Instruction *Shl, const APInt &ShlOp1,
927 bool isLshr = (Shr->getOpcode() == Instruction::LShr);
1163 Instruction *I = dyn_cast<Instruction>(V);
1163 Instruction *I = dyn_cast<Instruction>(V);
1185 case Instruction::GetElementPtr: {
1218 case Instruction::InsertElement: {
1249 case Instruction::ShuffleVector: {
1333 Instruction *New = InsertElementInst::Create(
1355 case Instruction::Select: {
1395 case Instruction::BitCast: {
1455 case Instruction::FPTrunc:
1456 case Instruction::FPExt:
1460 case Instruction::Call: {
lib/Transforms/InstCombine/InstCombineVectorOps.cpp 84 Instruction *InstCombiner::scalarizePHI(ExtractElementInst &EI, PHINode *PN) {
85 SmallVector<Instruction *, 2> Extracts;
90 Instruction *PHIUser = nullptr;
98 PHIUser = cast<Instruction>(U);
140 Instruction *newEI = ExtractElementInst::Create(PHIInVal, Elt, "");
142 Instruction *pos = dyn_cast<Instruction>(PHIInVal);
142 Instruction *pos = dyn_cast<Instruction>(PHIInVal);
162 static Instruction *foldBitcastExtElt(ExtractElementInst &Ext,
257 static APInt findDemandedEltsBySingleUser(Value *V, Instruction *UserInstr) {
264 case Instruction::ExtractElement: {
273 case Instruction::ShuffleVector: {
305 if (Instruction *I = dyn_cast<Instruction>(U.getUser())) {
305 if (Instruction *I = dyn_cast<Instruction>(U.getUser())) {
319 Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
366 if (Instruction *I = foldBitcastExtElt(EI, Builder, DL.isBigEndian()))
372 if (Instruction *ScalarPHI = scalarizePHI(EI, Phi))
395 if (auto *I = dyn_cast<Instruction>(SrcVec)) {
395 if (auto *I = dyn_cast<Instruction>(SrcVec)) {
433 if (CI->hasOneUse() && (CI->getOpcode() != Instruction::BitCast)) {
547 auto *ExtVecOpInst = dyn_cast<Instruction>(ExtVecOp);
547 auto *ExtVecOpInst = dyn_cast<Instruction>(ExtVecOp);
697 Instruction *InstCombiner::visitInsertValueInst(InsertValueInst &I) {
747 static Instruction *foldInsSequenceIntoSplat(InsertElementInst &InsElt) {
816 static Instruction *foldInsEltIntoSplat(InsertElementInst &InsElt) {
850 static Instruction *foldInsEltIntoIdentityShuffle(InsertElementInst &InsElt) {
906 static Instruction *hoistInsEltConst(InsertElementInst &InsElt2,
929 static Instruction *foldConstantInsEltIntoShuffle(InsertElementInst &InsElt) {
930 auto *Inst = dyn_cast<Instruction>(InsElt.getOperand(0));
930 auto *Inst = dyn_cast<Instruction>(InsElt.getOperand(0));
1026 Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
1106 if (Instruction *Shuf = foldConstantInsEltIntoShuffle(IE))
1109 if (Instruction *NewInsElt = hoistInsEltConst(IE, Builder))
1112 if (Instruction *Broadcast = foldInsSequenceIntoSplat(IE))
1115 if (Instruction *Splat = foldInsEltIntoSplat(IE))
1118 if (Instruction *IdentityShuf = foldInsEltIntoIdentityShuffle(IE))
1133 Instruction *I = dyn_cast<Instruction>(V);
1133 Instruction *I = dyn_cast<Instruction>(V);
1143 case Instruction::UDiv:
1144 case Instruction::SDiv:
1145 case Instruction::URem:
1146 case Instruction::SRem:
1153 case Instruction::Add:
1154 case Instruction::FAdd:
1155 case Instruction::Sub:
1156 case Instruction::FSub:
1157 case Instruction::Mul:
1158 case Instruction::FMul:
1159 case Instruction::FDiv:
1160 case Instruction::FRem:
1161 case Instruction::Shl:
1162 case Instruction::LShr:
1163 case Instruction::AShr:
1164 case Instruction::And:
1165 case Instruction::Or:
1166 case Instruction::Xor:
1167 case Instruction::ICmp:
1168 case Instruction::FCmp:
1169 case Instruction::Trunc:
1170 case Instruction::ZExt:
1171 case Instruction::SExt:
1172 case Instruction::FPToUI:
1173 case Instruction::FPToSI:
1174 case Instruction::UIToFP:
1175 case Instruction::SIToFP:
1176 case Instruction::FPTrunc:
1177 case Instruction::FPExt:
1178 case Instruction::GetElementPtr: {
1190 case Instruction::InsertElement: {
1213 static Value *buildNew(Instruction *I, ArrayRef<Value*> NewOps) {
1217 case Instruction::Add:
1218 case Instruction::FAdd:
1219 case Instruction::Sub:
1220 case Instruction::FSub:
1221 case Instruction::Mul:
1222 case Instruction::FMul:
1223 case Instruction::UDiv:
1224 case Instruction::SDiv:
1225 case Instruction::FDiv:
1226 case Instruction::URem:
1227 case Instruction::SRem:
1228 case Instruction::FRem:
1229 case Instruction::Shl:
1230 case Instruction::LShr:
1231 case Instruction::AShr:
1232 case Instruction::And:
1233 case Instruction::Or:
1234 case Instruction::Xor: {
1251 case Instruction::ICmp:
1255 case Instruction::FCmp:
1259 case Instruction::Trunc:
1260 case Instruction::ZExt:
1261 case Instruction::SExt:
1262 case Instruction::FPToUI:
1263 case Instruction::FPToSI:
1264 case Instruction::UIToFP:
1265 case Instruction::SIToFP:
1266 case Instruction::FPTrunc:
1267 case Instruction::FPExt: {
1277 case Instruction::GetElementPtr: {
1313 Instruction *I = cast<Instruction>(V);
1313 Instruction *I = cast<Instruction>(V);
1315 case Instruction::Add:
1316 case Instruction::FAdd:
1317 case Instruction::Sub:
1318 case Instruction::FSub:
1319 case Instruction::Mul:
1320 case Instruction::FMul:
1321 case Instruction::UDiv:
1322 case Instruction::SDiv:
1323 case Instruction::FDiv:
1324 case Instruction::URem:
1325 case Instruction::SRem:
1326 case Instruction::FRem:
1327 case Instruction::Shl:
1328 case Instruction::LShr:
1329 case Instruction::AShr:
1330 case Instruction::And:
1331 case Instruction::Or:
1332 case Instruction::Xor:
1333 case Instruction::ICmp:
1334 case Instruction::FCmp:
1335 case Instruction::Trunc:
1336 case Instruction::ZExt:
1337 case Instruction::SExt:
1338 case Instruction::FPToUI:
1339 case Instruction::FPToSI:
1340 case Instruction::UIToFP:
1341 case Instruction::SIToFP:
1342 case Instruction::FPTrunc:
1343 case Instruction::FPExt:
1344 case Instruction::Select:
1345 case Instruction::GetElementPtr: {
1365 case Instruction::InsertElement: {
1447 case Instruction::Shl: {
1452 return { Instruction::Mul, BO0, ShlOne };
1456 case Instruction::Or: {
1460 return { Instruction::Add, BO0, BO1 };
1469 static Instruction *foldSelectShuffleWith1Binop(ShuffleVectorInst &Shuf) {
1503 (Instruction::isIntDivRem(BOpcode) || Instruction::isShift(BOpcode));
1503 (Instruction::isIntDivRem(BOpcode) || Instruction::isShift(BOpcode));
1510 Instruction *NewBO = BinaryOperator::Create(BOpcode, X, NewC);
1525 static Instruction *canonicalizeInsertSplat(ShuffleVectorInst &Shuf,
1557 static Instruction *foldSelectShuffle(ShuffleVectorInst &Shuf,
1572 if (Instruction *I = foldSelectShuffleWith1Binop(Shuf))
1600 if (Opc0 == Instruction::Shl || Opc1 == Instruction::Shl)
1600 if (Opc0 == Instruction::Shl || Opc1 == Instruction::Shl)
1628 (Instruction::isIntDivRem(BOpc) || Instruction::isShift(BOpc));
1628 (Instruction::isIntDivRem(BOpc) || Instruction::isShift(BOpc));
1664 Instruction *NewBO = ConstantsAreOp1 ? BinaryOperator::Create(BOpc, V, NewC) :
1684 static Instruction *narrowVectorSelect(ShuffleVectorInst &Shuf,
1717 static Instruction *foldIdentityExtractShuffle(ShuffleVectorInst &Shuf) {
1757 static Instruction *foldShuffleWithInsert(ShuffleVectorInst &Shuf) {
1821 static Instruction *foldIdentityPaddedShuffles(ShuffleVectorInst &Shuf) {
1887 Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
1924 if (Instruction *I = canonicalizeInsertSplat(SVI, Builder))
1927 if (Instruction *I = foldSelectShuffle(SVI, Builder, DL))
1930 if (Instruction *I = narrowVectorSelect(SVI, Builder))
1941 if (Instruction *I = foldIdentityExtractShuffle(SVI))
1946 if (Instruction *I = foldShuffleWithInsert(SVI))
1948 if (Instruction *I = foldIdentityPaddedShuffles(SVI))
lib/Transforms/InstCombine/InstructionCombining.cpp 209 Instruction::BinaryOps Opcode = I.getOpcode();
210 if (Opcode != Instruction::Add && Opcode != Instruction::Sub)
210 if (Opcode != Instruction::Add && Opcode != Instruction::Sub)
218 if (Opcode == Instruction::Add)
262 if (CastOpcode != Instruction::ZExt)
314 Instruction::BinaryOps Opcode = I.getOpcode();
441 BinaryOperator *NewBO = (IsNUW && Opcode == Instruction::Add) ?
473 static bool leftDistributesOverRight(Instruction::BinaryOps LOp,
474 Instruction::BinaryOps ROp) {
477 if (LOp == Instruction::And)
478 return ROp == Instruction::Or || ROp == Instruction::Xor;
478 return ROp == Instruction::Or || ROp == Instruction::Xor;
481 if (LOp == Instruction::Or)
482 return ROp == Instruction::And;
486 if (LOp == Instruction::Mul)
487 return ROp == Instruction::Add || ROp == Instruction::Sub;
487 return ROp == Instruction::Add || ROp == Instruction::Sub;
494 static bool rightDistributesOverLeft(Instruction::BinaryOps LOp,
495 Instruction::BinaryOps ROp) {
496 if (Instruction::isCommutative(ROp))
500 return Instruction::isBitwiseLogicOp(LOp) && Instruction::isShift(ROp);
500 return Instruction::isBitwiseLogicOp(LOp) && Instruction::isShift(ROp);
509 static Value *getIdentityValue(Instruction::BinaryOps Opcode, Value *V) {
521 static Instruction::BinaryOps
522 getBinOpsForFactorization(Instruction::BinaryOps TopOpcode, BinaryOperator *Op,
527 if (TopOpcode == Instruction::Add || TopOpcode == Instruction::Sub) {
527 if (TopOpcode == Instruction::Add || TopOpcode == Instruction::Sub) {
532 return Instruction::Mul;
542 Instruction::BinaryOps InnerOpcode,
549 Instruction::BinaryOps TopLevelOpcode = I.getOpcode();
552 bool InnerCommutative = Instruction::isCommutative(InnerOpcode);
617 if (TopLevelOpcode == Instruction::Add &&
618 InnerOpcode == Instruction::Mul) {
650 Instruction::BinaryOps TopLevelOpcode = I.getOpcode();
655 Instruction::BinaryOps LHSOpcode, RHSOpcode;
687 Instruction::BinaryOps InnerOpcode = Op0->getOpcode(); // op'
724 Instruction::BinaryOps InnerOpcode = Op1->getOpcode(); // op'
762 Instruction::BinaryOps Opcode = I.getOpcode();
827 static Value *foldOperationIntoSelectOperand(Instruction &I, Value *SO,
851 auto *FPInst = dyn_cast<Instruction>(RI);
851 auto *FPInst = dyn_cast<Instruction>(RI);
857 Instruction *InstCombiner::FoldOpIntoSelect(Instruction &Op, SelectInst *SI) {
857 Instruction *InstCombiner::FoldOpIntoSelect(Instruction &Op, SelectInst *SI) {
923 auto *FPInst = dyn_cast<Instruction>(RI);
923 auto *FPInst = dyn_cast<Instruction>(RI);
929 Instruction *InstCombiner::foldOpIntoPhi(Instruction &I, PHINode *PN) {
929 Instruction *InstCombiner::foldOpIntoPhi(Instruction &I, PHINode *PN) {
940 Instruction *UI = cast<Instruction>(U);
940 Instruction *UI = cast<Instruction>(U);
966 if (cast<Instruction>(InVal)->getParent() == NonConstBB)
1066 Instruction *User = cast<Instruction>(*UI++);
1066 Instruction *User = cast<Instruction>(*UI++);
1074 Instruction *InstCombiner::foldBinOpIntoSelectOrPhi(BinaryOperator &I) {
1079 if (Instruction *NewSel = FoldOpIntoSelect(I, Sel))
1082 if (Instruction *NewPhi = foldOpIntoPhi(I, PN))
1201 std::pair<Instruction *, unsigned> Parent;
1225 if (BO->getOpcode() == Instruction::Mul) {
1263 if (logScale > 0 && BO->getOpcode() == Instruction::Shl &&
1296 if (Cast->getOpcode() == Instruction::SExt) {
1318 if (Cast->getOpcode() == Instruction::Trunc) {
1371 Instruction *Ancestor = Parent.first;
1383 } else if (Ancestor->getOpcode() == Instruction::Trunc) {
1402 Instruction *InstCombiner::foldVectorBinop(BinaryOperator &Inst) {
1477 Instruction *NewBO = BinaryOperator::Create(Opcode, V1, V2);
1565 Instruction *InstCombiner::narrowMathIfNoOverflow(BinaryOperator &BO) {
1571 if (BO.getOpcode() == Instruction::Sub)
1581 CastInst::CastOps CastOpc = IsSext ? Instruction::SExt : Instruction::ZExt;
1581 CastInst::CastOps CastOpc = IsSext ? Instruction::SExt : Instruction::ZExt;
1598 if (BO.getOpcode() == Instruction::Sub)
1618 Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
1838 Builder.SetInsertPoint(cast<Instruction>(PtrOp));
1944 return CastInst::Create(Instruction::IntToPtr, NewSub, GEPType);
2199 if (Instruction *I = visitBitCast(*BCI)) {
2259 Instruction *AI) {
2272 static bool isAllocSiteRemovable(Instruction *AI,
2275 SmallVector<Instruction*, 4> Worklist;
2279 Instruction *PI = Worklist.pop_back_val();
2281 Instruction *I = cast<Instruction>(U);
2281 Instruction *I = cast<Instruction>(U);
2287 case Instruction::AddrSpaceCast:
2288 case Instruction::BitCast:
2289 case Instruction::GetElementPtr:
2294 case Instruction::ICmp: {
2308 case Instruction::Call:
2339 case Instruction::Store: {
2353 Instruction *InstCombiner::visitAllocSite(Instruction &MI) {
2353 Instruction *InstCombiner::visitAllocSite(Instruction &MI) {
2382 Instruction *I = cast<Instruction>(&*Users[i]);
2382 Instruction *I = cast<Instruction>(&*Users[i]);
2398 Instruction *I = cast<Instruction>(&*Users[i]);
2398 Instruction *I = cast<Instruction>(&*Users[i]);
2445 static Instruction *tryToMoveFreeBeforeNullTest(CallInst &FI,
2461 Instruction *FreeInstrBBTerminator = FreeInstrBB->getTerminator();
2470 for (const Instruction &Inst : *FreeInstrBB) {
2479 Instruction *TI = PredBB->getTerminator();
2501 Instruction &Instr = *It++;
2511 Instruction *InstCombiner::visitFree(CallInst &FI) {
2533 if (Instruction *I = tryToMoveFreeBeforeNullTest(FI, DL))
2539 Instruction *InstCombiner::visitReturnInst(ReturnInst &RI) {
2557 Instruction *InstCombiner::visitBranchInst(BranchInst &BI) {
2592 Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) {
2644 Instruction *InstCombiner::visitExtractValueInst(ExtractValueInst &EV) {
2713 Instruction::BinaryOps BinOp = WO->getBinaryOp();
2749 Instruction *NL = Builder.CreateLoad(EV.getType(), GEP);
2805 Instruction *InstCombiner::visitLandingPadInst(LandingPadInst &LI) {
3118 static bool TryToSinkInstruction(Instruction *I, BasicBlock *DestBlock) {
3208 Instruction *I = Worklist.RemoveOne();
3263 Instruction *UserInst = cast<Instruction>(*I->user_begin());
3263 Instruction *UserInst = cast<Instruction>(*I->user_begin());
3293 if (Instruction *OpI = dyn_cast<Instruction>(U.get()))
3293 if (Instruction *OpI = dyn_cast<Instruction>(U.get()))
3310 if (Instruction *Result = visit(*I)) {
3378 SmallVector<Instruction*, 128> InstrsForInstCombineWorklist;
3389 Instruction *Inst = &*BBI++;
3445 Instruction *TI = BB->getTerminator();
lib/Transforms/Instrumentation/AddressSanitizer.cpp 619 Value *isInterestingMemoryAccess(Instruction *I, bool *IsWrite,
623 void instrumentMop(ObjectSizeOffsetVisitor &ObjSizeVis, Instruction *I,
625 void instrumentPointerComparisonOrSubtraction(Instruction *I);
626 void instrumentAddress(Instruction *OrigIns, Instruction *InsertBefore,
626 void instrumentAddress(Instruction *OrigIns, Instruction *InsertBefore,
629 void instrumentUnusualSizeOrAlignment(Instruction *I,
630 Instruction *InsertBefore, Value *Addr,
636 Instruction *generateCrashCode(Instruction *InsertBefore, Value *Addr,
636 Instruction *generateCrashCode(Instruction *InsertBefore, Value *Addr,
651 bool LooksLikeCodeInBug11395(Instruction *I);
880 SmallVector<Instruction *, 8> RetVec;
973 void unpoisonDynamicAllocasBeforeInst(Instruction *InstBefore,
1079 Instruction *I = CS.getInstruction();
1108 Instruction *ThenTerm, Value *ValueIfFalse);
1343 Value *AddressSanitizer::isInterestingMemoryAccess(Instruction *I,
1444 static bool isInterestingPointerComparison(Instruction *I) {
1458 static bool isInterestingPointerSubtraction(Instruction *I) {
1460 if (BO->getOpcode() != Instruction::Sub)
1480 Instruction *I) {
1491 static void doInstrumentAddress(AddressSanitizer *Pass, Instruction *I,
1492 Instruction *InsertBefore, Value *Addr,
1510 Value *Mask, Instruction *I,
1521 Instruction *InsertBefore = I;
1534 Instruction *ThenTerm = SplitBlockAndInsertIfThen(MaskElem, I, false);
1548 Instruction *I, bool UseCalls,
1607 Instruction *AddressSanitizer::generateCrashCode(Instruction *InsertBefore,
1607 Instruction *AddressSanitizer::generateCrashCode(Instruction *InsertBefore,
1656 void AddressSanitizer::instrumentAddress(Instruction *OrigIns,
1657 Instruction *InsertBefore, Value *Addr,
1687 Instruction *TagCheckTerm =
1705 Instruction *CrashTerm = nullptr;
1710 Instruction *CheckTerm = SplitBlockAndInsertIfThen(
1729 Instruction *Crash = generateCrashCode(CrashTerm, AddrLong, IsWrite,
1739 Instruction *I, Instruction *InsertBefore, Value *Addr, uint32_t TypeSize,
1739 Instruction *I, Instruction *InsertBefore, Value *Addr, uint32_t TypeSize,
2596 for (Instruction &I : F.getEntryBlock()) {
2643 SmallVector<Instruction *, 16> ToInstrument;
2644 SmallVector<Instruction *, 8> NoReturnCalls;
2646 SmallVector<Instruction *, 16> PointerComparisonsOrSubtracts;
2657 for (auto &Inst : BB) {
2750 bool AddressSanitizer::LooksLikeCodeInBug11395(Instruction *I) {
2890 Instruction *CopyInsertPoint = &F.front().front();
2920 Instruction *ThenTerm,
2923 BasicBlock *CondBlock = cast<Instruction>(Cond)->getParent();
2950 IRBuilder<> IRB(dyn_cast<Instruction>(FirstBB.begin()));
2994 Instruction *InsBefore = AllocaVec[0];
3088 Instruction *Term =
3206 Instruction *ThenTerm, *ElseTerm;
lib/Transforms/Instrumentation/BoundsChecking.cpp 151 SmallVector<std::pair<Instruction *, Value *>, 4> TrapInfo;
152 for (Instruction &I : instructions(F)) {
200 Instruction *Inst = Entry.first;
lib/Transforms/Instrumentation/CFGMST.h 121 Instruction *TI = BB->getTerminator();
151 auto *TargetTI = TargetBB->getTerminator();
lib/Transforms/Instrumentation/CGProfile.cpp 51 for (auto &I : BB) {
lib/Transforms/Instrumentation/ControlHeightReduction.cpp 169 typedef DenseMap<Region *, DenseSet<Instruction *>> HoistStopMapTy;
280 bool contains(Instruction *I) const {
295 Instruction *BranchInsertPoint;
397 Instruction *BranchOrSelect,
495 static bool isHoistableInstructionType(Instruction *I) {
504 static bool isHoistable(Instruction *I, DominatorTree &DT) {
522 if (auto *I = dyn_cast<Instruction>(V)) {
522 if (auto *I = dyn_cast<Instruction>(V)) {
555 checkHoistValue(Value *V, Instruction *InsertPoint, DominatorTree &DT,
556 DenseSet<Instruction *> &Unhoistables,
557 DenseSet<Instruction *> *HoistStops,
558 DenseMap<Instruction *, bool> &Visited) {
560 if (auto *I = dyn_cast<Instruction>(V)) {
560 if (auto *I = dyn_cast<Instruction>(V)) {
582 DenseSet<Instruction *> OpsHoistStops;
710 static Instruction* getBranchInsertPoint(RegInfo &RI) {
715 Instruction *HoistPoint = EntryBB->getTerminator();
728 DenseSet<Instruction *> EntryBlockSelectSet;
734 for (Instruction &I : *EntryBB) {
825 for (Instruction &I : *BB) {
895 Instruction *InsertPoint = getBranchInsertPoint(RI);
900 DenseSet<Instruction *> Unhoistables;
912 DenseMap<Instruction *, bool> Visited;
933 DenseMap<Instruction *, bool> Visited;
966 DenseMap<Instruction *, bool> Visited;
974 DenseMap<Instruction *, bool> Visited;
1059 static bool shouldSplit(Instruction *InsertPoint,
1063 DenseSet<Instruction *> &Unhoistables) {
1077 DenseMap<Instruction *, bool> Visited;
1123 DenseSet<Instruction *> &Output) {
1136 DenseSet<Instruction *> Unhoistables;
1160 Instruction *PrevInsertPoint = nullptr;
1164 SmallVector<Instruction *, 8> SplitsInsertPoints;
1167 Instruction *InsertPoint = getBranchInsertPoint(RI);
1245 Instruction *SplitInsertPoint = SplitsInsertPoints[I];
1247 DenseSet<Instruction *> SplitUnhoistables;
1388 DenseSet<Instruction *> Unhoistables;
1397 Instruction *InsertPoint = OutermostScope->BranchInsertPoint;
1400 DenseSet<Instruction *> HoistStops;
1408 DenseMap<Instruction *, bool> Visited;
1420 DenseMap<Instruction *, bool> Visited;
1449 static void hoistValue(Value *V, Instruction *HoistPoint, Region *R,
1451 DenseSet<Instruction *> &HoistedSet,
1456 DenseSet<Instruction *> &HoistStops = IT->second;
1457 if (auto *I = dyn_cast<Instruction>(V)) {
1457 if (auto *I = dyn_cast<Instruction>(V)) {
1497 static void hoistScopeConditions(CHRScope *Scope, Instruction *HoistPoint,
1500 DenseSet<Instruction *> HoistedSet;
1524 Instruction *ExcludedUser,
1590 for (Instruction &I : *BB) {
1591 SmallVector<Instruction *, 8> Users;
1593 if (auto *UI = dyn_cast<Instruction>(U)) {
1593 if (auto *UI = dyn_cast<Instruction>(U)) {
1624 for (Instruction *UI : Users) {
1671 if (auto *I = dyn_cast<Instruction>(V)) {
1671 if (auto *I = dyn_cast<Instruction>(V)) {
1685 if (auto *I = dyn_cast<Instruction>(V)) {
1685 if (auto *I = dyn_cast<Instruction>(V)) {
1791 for (Instruction &I : *NewBlocks[i])
1952 Instruction *BranchOrSelect,
lib/Transforms/Instrumentation/DataFlowSanitizer.cpp 359 Value *getShadowAddress(Value *Addr, Instruction *Pos);
396 DenseSet<Instruction *> SkipInsts;
417 Value *getArgTLS(unsigned Index, Instruction *Pos);
420 void setShadow(Instruction *I, Value *Shadow);
421 Value *combineShadows(Value *V1, Value *V2, Instruction *Pos);
422 Value *combineOperandShadows(Instruction *Inst);
424 Instruction *Pos);
426 Instruction *Pos);
439 void visitOperandShadowInst(Instruction &I);
938 Instruction *Inst = &i->front();
943 Instruction *Next = Inst->getNextNode();
976 Instruction *Pos;
977 if (Instruction *I = dyn_cast<Instruction>(V))
977 if (Instruction *I = dyn_cast<Instruction>(V))
1017 Value *DFSanFunction::getArgTLS(unsigned Idx, Instruction *Pos) {
1024 if (!isa<Argument>(V) && !isa<Instruction>(V))
1034 Instruction *ArgTLSPos =
1036 : cast<Instruction>(ArgTLSPtr)->getNextNode();
1060 void DFSanFunction::setShadow(Instruction *I, Value *Shadow) {
1066 Value *DataFlowSanitizer::getShadowAddress(Value *Addr, Instruction *Pos) {
1084 Value *DFSanFunction::combineShadows(Value *V1, Value *V2, Instruction *Pos) {
1165 Value *DFSanFunction::combineOperandShadows(Instruction *Inst) {
1176 void DFSanVisitor::visitOperandShadowInst(Instruction &I) {
1184 Instruction *Pos) {
1328 Value *Shadow, Instruction *Pos) {
1681 Instruction *Next = nullptr;
lib/Transforms/Instrumentation/GCOVProfiling.cpp 596 for (auto &I : BB) {
632 SmallVector<Instruction *, 2> ForkAndExecs;
635 for (auto &I : instructions(F)) {
720 Instruction *TI = BB.getTerminator();
729 for (auto &I : BB) {
789 Instruction *TI = BB.getTerminator();
833 Instruction *TI = BB.getTerminator();
lib/Transforms/Instrumentation/HWAddressSanitizer.cpp 206 void untagPointerOperand(Instruction *I, Value *Addr);
211 Instruction *InsertBefore);
213 bool instrumentMemAccess(Instruction *I);
214 Value *isInterestingMemoryAccess(Instruction *I, bool *IsWrite,
225 SmallVectorImpl<Instruction *> &RetVec, Value *StackTag);
227 bool instrumentLandingPads(SmallVectorImpl<Instruction *> &RetVec);
506 Value *HWAddressSanitizer::isInterestingMemoryAccess(Instruction *I,
564 static unsigned getPointerOperandIndex(Instruction *I) {
583 void HWAddressSanitizer::untagPointerOperand(Instruction *I, Value *Addr) {
612 Instruction *InsertBefore) {
644 Instruction *CheckTerm =
651 Instruction *CheckFailTerm =
719 bool HWAddressSanitizer::instrumentMemAccess(Instruction *I) {
937 Instruction *ThreadLong = IRB.CreateLoad(IntptrTy, SlotPtr);
944 ThreadLongEqZero, cast<Instruction>(ThreadLongEqZero)->getNextNode(),
1030 SmallVectorImpl<Instruction *> &LandingPadVec) {
1031 for (auto *LP : LandingPadVec) {
1044 SmallVectorImpl<Instruction *> &RetVec, Value *StackTag) {
1112 SmallVector<Instruction*, 16> ToInstrument;
1114 SmallVector<Instruction*, 8> RetVec;
1115 SmallVector<Instruction*, 8> LandingPadVec;
1118 for (auto &Inst : BB) {
1165 Instruction *InsertPt = &*F.getEntryBlock().begin();
1212 for (auto &Inst : BB)
1231 Instruction *I = &*II++;
lib/Transforms/Instrumentation/IndirectCallPromotion.cpp 196 Instruction *Inst, const ArrayRef<InstrProfValueData> &ValueDataRef,
201 uint32_t tryToPromote(Instruction *Inst,
221 Instruction *Inst, const ArrayRef<InstrProfValueData> &ValueDataRef,
296 Instruction *llvm::pgo::promoteIndirectCall(Instruction *Inst,
296 Instruction *llvm::pgo::promoteIndirectCall(Instruction *Inst,
309 Instruction *NewInst =
333 Instruction *Inst, const std::vector<PromotionCandidate> &Candidates,
lib/Transforms/Instrumentation/InstrProfiling.cpp 182 Instruction *L, Instruction *S, SSAUpdater &SSA, Value *Init,
182 Instruction *L, Instruction *S, SSAUpdater &SSA, Value *Init,
184 ArrayRef<Instruction *> InsertPts,
197 Instruction *InsertPos = InsertPts[i];
226 Instruction *Store;
228 ArrayRef<Instruction *> InsertPts;
367 SmallVector<Instruction *, 8> InsertPts;
402 static InstrProfIncrementInst *castToIncrementInst(Instruction *Instr) {
456 auto *CounterLoad = LoadStore.first;
457 auto *CounterStore = LoadStore.second;
652 PromotionCandidates.emplace_back(cast<Instruction>(Load), Store);
lib/Transforms/Instrumentation/MemorySanitizer.cpp 1039 Instruction *OrigIns;
1041 ShadowOriginAndInsertPoint(Value *S, Value *O, Instruction *I)
1150 Instruction *CheckTerm = SplitBlockAndInsertIfThen(
1203 void materializeOneCheck(Instruction *OrigIns, Value *Shadow, Value *Origin,
1232 Instruction *CheckTerm = SplitBlockAndInsertIfThen(
1244 Instruction *OrigIns = ShadowData.OrigIns;
1579 if (Instruction *I = dyn_cast<Instruction>(V)) {
1579 if (Instruction *I = dyn_cast<Instruction>(V)) {
1674 Value *getShadow(Instruction *I, int i) {
1685 if (Instruction *I = dyn_cast<Instruction>(V)) {
1685 if (Instruction *I = dyn_cast<Instruction>(V)) {
1695 Value *getOrigin(Instruction *I, int i) {
1703 void insertShadowCheck(Value *Shadow, Value *Origin, Instruction *OrigIns) {
1719 void insertShadowCheck(Value *Val, Instruction *OrigIns) {
1727 Shadow = dyn_cast_or_null<Instruction>(getShadow(Val));
1729 Origin = dyn_cast_or_null<Instruction>(getOrigin(Val));
1770 void visit(Instruction &I) {
1823 void handleCASOrRMW(Instruction &I) {
2048 void Done(Instruction *I) {
2065 void setOriginForNaryOp(Instruction &I) {
2069 for (Instruction::op_iterator OI = I.op_begin(); OI != I.op_end(); ++OI)
2116 void handleShadowOr(Instruction &I) {
2119 for (Instruction::op_iterator OI = I.op_begin(); OI != I.op_end(); ++OI)
2188 void handleIntegerDiv(Instruction &I) {
3254 Instruction &I = *CS.getInstruction();
3481 void instrumentAlloca(AllocaInst &I, Instruction *InsPoint = nullptr) {
3603 void dumpInst(Instruction &I) {
3627 void instrumentAsmArgument(Value *Operand, Instruction &I, IRBuilder<> &IRB,
3676 void visitAsmInstruction(Instruction &I) {
3718 void visitInstruction(Instruction &I) {
lib/Transforms/Instrumentation/PGOInstrumentation.cpp 260 static std::string getBranchCondString(Instruction *TI) {
615 const Instruction *TI = BB.getTerminator();
773 Instruction *TI = SrcBB->getTerminator();
1293 Instruction *TI = BB.getTerminator();
1340 Instruction *TI = BB.getTerminator();
1696 void llvm::setProfMetadata(Module *M, Instruction *TI,
1744 void setIrrLoopHeaderMetadata(Module *M, Instruction *TI, uint64_t Count) {
lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp 375 Instruction *NewInst = MI->clone();
lib/Transforms/Instrumentation/PoisonChecking.cpp 105 static void generatePoisonChecksForBinOp(Instruction &I,
115 case Instruction::Add: {
128 case Instruction::Sub: {
141 case Instruction::Mul: {
154 case Instruction::UDiv: {
163 case Instruction::SDiv: {
172 case Instruction::AShr:
173 case Instruction::LShr:
174 case Instruction::Shl: {
185 static Value* generatePoisonChecks(Instruction &I) {
195 case Instruction::ExtractElement: {
207 case Instruction::InsertElement: {
274 for (Instruction &I : BB) {
277 IRBuilder<> B(cast<Instruction>(&I));
lib/Transforms/Instrumentation/SanitizerCoverage.cpp 196 ArrayRef<Instruction *> IndirCalls);
197 void InjectTraceForCmp(Function &F, ArrayRef<Instruction *> CmpTraceTargets);
203 ArrayRef<Instruction *> SwitchTraceTargets);
219 void SetNoSanitizeMetadata(Instruction *I) {
593 SmallVector<Instruction *, 8> IndirCalls;
595 SmallVector<Instruction *, 8> CmpTraceTargets;
596 SmallVector<Instruction *, 8> SwitchTraceTargets;
607 for (auto &Inst : BB) {
622 if (BO->getOpcode() == Instruction::SDiv ||
623 BO->getOpcode() == Instruction::UDiv)
726 Function &F, ArrayRef<Instruction *> IndirCalls) {
745 Function &, ArrayRef<Instruction *> SwitchTraceTargets) {
813 Function &, ArrayRef<Instruction *> CmpTraceTargets) {
lib/Transforms/Instrumentation/ThreadSanitizer.cpp 99 bool instrumentLoadOrStore(Instruction *I, const DataLayout &DL);
100 bool instrumentAtomic(Instruction *I, const DataLayout &DL);
101 bool instrumentMemIntrinsic(Instruction *I);
102 void chooseInstructionsToInstrument(SmallVectorImpl<Instruction *> &Local,
103 SmallVectorImpl<Instruction *> &All,
299 static bool isVtableAccess(Instruction *I) {
372 SmallVectorImpl<Instruction *> &Local, SmallVectorImpl<Instruction *> &All,
372 SmallVectorImpl<Instruction *> &Local, SmallVectorImpl<Instruction *> &All,
376 for (Instruction *I : reverse(Local)) {
413 static bool isAtomic(Instruction *I) {
444 SmallVector<Instruction*, 8> AllLoadsAndStores;
445 SmallVector<Instruction*, 8> LocalLoadsAndStores;
446 SmallVector<Instruction*, 8> AtomicAccesses;
447 SmallVector<Instruction*, 8> MemIntrinCalls;
455 for (auto &Inst : BB) {
518 bool ThreadSanitizer::instrumentLoadOrStore(Instruction *I,
600 bool ThreadSanitizer::instrumentMemIntrinsic(Instruction *I) {
628 bool ThreadSanitizer::instrumentAtomic(Instruction *I, const DataLayout &DL) {
lib/Transforms/Instrumentation/ValueProfileCollector.h 57 Instruction *InsertPt; // Insert the VP lib call before this instr.
58 Instruction *AnnotatedInst; // Where metadata is attached.
lib/Transforms/Instrumentation/ValueProfilePlugins.inc 44 Instruction *InsertPt = &MI;
45 Instruction *AnnotatedInst = &MI;
60 std::vector<Instruction *> Result = findIndirectCalls(F);
61 for (Instruction *I : Result) {
63 Instruction *InsertPt = I;
64 Instruction *AnnotatedInst = I;
lib/Transforms/ObjCARC/DependencyAnalysis.cpp 34 bool llvm::objcarc::CanAlterRefCount(const Instruction *Inst, const Value *Ptr,
67 bool llvm::objcarc::CanDecrementRefCount(const Instruction *Inst,
81 bool llvm::objcarc::CanUse(const Instruction *Inst, const Value *Ptr,
131 llvm::objcarc::Depends(DependenceKind Flavor, Instruction *Inst,
221 BasicBlock *StartBB, Instruction *StartInst,
222 SmallPtrSetImpl<Instruction *> &DependingInsts,
251 Instruction *Inst = &*--LocalStartPos;
lib/Transforms/ObjCARC/DependencyAnalysis.h 55 BasicBlock *StartBB, Instruction *StartInst,
56 SmallPtrSetImpl<Instruction *> &DependingInstructions,
61 Depends(DependenceKind Flavor, Instruction *Inst, const Value *Arg,
66 bool CanUse(const Instruction *Inst, const Value *Ptr, ProvenanceAnalysis &PA,
71 bool CanAlterRefCount(const Instruction *Inst, const Value *Ptr,
76 bool CanDecrementRefCount(const Instruction *Inst, const Value *Ptr,
79 static inline bool CanDecrementRefCount(const Instruction *Inst,
lib/Transforms/ObjCARC/ObjCARC.h 51 static inline void EraseInstruction(Instruction *CI) {
73 static inline const Instruction *getreturnRVOperand(const Instruction &Inst,
73 static inline const Instruction *getreturnRVOperand(const Instruction &Inst,
lib/Transforms/ObjCARC/ObjCARCAPElim.cpp 75 for (const Instruction &I : BB)
93 Instruction *Push = nullptr;
95 Instruction *Inst = &*I++;
lib/Transforms/ObjCARC/ObjCARCContract.cpp 82 Function &F, Instruction *Inst, inst_iterator &Iter,
88 bool optimizeRetainCall(Function &F, Instruction *Retain);
91 contractAutorelease(Function &F, Instruction *Autorelease,
93 SmallPtrSetImpl<Instruction *> &DependingInstructions,
97 Instruction *Release, inst_iterator &Iter,
119 bool ObjCARCContract::optimizeRetainCall(Function &F, Instruction *Retain) {
121 const Instruction *Call = CS.getInstruction();
155 Function &F, Instruction *Autorelease, ARCInstKind Class,
156 SmallPtrSetImpl<Instruction *> &DependingInstructions,
207 Instruction *Release,
228 Instruction *Inst = &*I;
292 static Instruction *
294 Instruction *Release,
300 Instruction *Inst = &*I;
309 Instruction *Retain = &*I;
321 const Twine &NameStr, Instruction *InsertBefore,
327 Instruction *EHPad = CV.front()->getFirstNonPHI();
337 Instruction *InsertBefore,
371 Instruction *Release, inst_iterator &Iter,
396 Instruction *Retain =
446 Function &F, Instruction *Inst, inst_iterator &Iter,
578 SmallPtrSet<Instruction *, 4> DependingInstructions;
599 Instruction *Inst = &*I++;
617 if (!isa<Instruction>(Arg) && !isa<Argument>(Arg))
634 if (Inst->getParent() == cast<Instruction>(U.getUser())->getParent() &&
648 Instruction *Replacement = Inst;
684 cast<Instruction>(U.getUser()));
lib/Transforms/ObjCARC/ObjCARCExpand.cpp 97 Instruction *Inst = &*I;
lib/Transforms/ObjCARC/ObjCARCOpts.cpp 504 bool OptimizeRetainRVCall(Function &F, Instruction *RetainRV);
505 void OptimizeAutoreleaseRVCall(Function &F, Instruction *AutoreleaseRV,
512 bool VisitInstructionBottomUp(Instruction *Inst, BasicBlock *BB,
518 bool VisitInstructionTopDown(Instruction *Inst,
531 SmallVectorImpl<Instruction *> &DeadInsts, Module *M);
537 Instruction * Retain,
538 SmallVectorImpl<Instruction *> &DeadInsts,
595 ObjCARCOpt::OptimizeRetainRVCall(Function &F, Instruction *RetainRV) {
599 if (const Instruction *Call = CS.getInstruction()) {
672 Instruction *AutoreleaseRV,
719 Instruction *
734 Instruction *EHPad = CV.front()->getFirstNonPHI();
757 Instruction *Inst = &*I++;
938 SmallVector<std::pair<Instruction *, const Value *>, 4> Worklist;
941 std::pair<Instruction *, const Value *> Pair = Worklist.pop_back_val();
965 SmallPtrSet<Instruction *, 4> DependingInstructions;
1012 Instruction *InsertPos = &PN->getIncomingBlock(i)->back();
1196 Instruction *Inst, BasicBlock *BB, BlotMapVector<Value *, RRInfo> &Retains,
1296 Instruction *Inst = &*std::prev(I);
1330 ObjCARCOpt::VisitInstructionTopDown(Instruction *Inst,
1430 for (Instruction &Inst : *BB) {
1468 Instruction *EntryTI = EntryBB->getTerminator();
1569 SmallVectorImpl<Instruction *> &DeadInsts,
1577 for (Instruction *InsertPt : ReleasesToMove.ReverseInsertPts) {
1590 for (Instruction *InsertPt : RetainsToMove.ReverseInsertPts) {
1609 for (Instruction *OrigRetain : RetainsToMove.Calls) {
1614 for (Instruction *OrigRelease : ReleasesToMove.Calls) {
1625 Instruction *Retain,
1626 SmallVectorImpl<Instruction *> &DeadInsts, RRInfo &RetainsToMove,
1644 for (SmallVector<Instruction *, 4> NewRetains{Retain};;) {
1645 SmallVector<Instruction *, 4> NewReleases;
1646 for (Instruction *NewRetain : NewRetains) {
1652 for (Instruction *NewRetainRelease : NewRetainRRI.Calls) {
1696 for (Instruction *RIP : NewRetainReleaseRRI.ReverseInsertPts) {
1718 for (Instruction *NewRelease : NewReleases) {
1724 for (Instruction *NewReleaseRetain : NewReleaseRRI.Calls) {
1753 for (Instruction *RIP : NewReleaseRetainRRI.ReverseInsertPts) {
1827 SmallVector<Instruction *, 8> DeadInsts;
1836 Instruction *Retain = cast<Instruction>(V);
1836 Instruction *Retain = cast<Instruction>(V);
1889 Instruction *Inst = &*I++;
1913 Instruction *EarlierInst = &*std::prev(J);
1996 Instruction *Inst = &*I++;
2005 const Instruction *UserInst = cast<Instruction>(U);
2005 const Instruction *UserInst = cast<Instruction>(U);
2070 HasSafePathToPredecessorCall(const Value *Arg, Instruction *Retain,
2071 SmallPtrSetImpl<Instruction *> &DepInsts,
2095 Instruction *Autorelease,
2096 SmallPtrSetImpl<Instruction *> &DepInsts,
2121 SmallPtrSetImpl<Instruction *> &DepInsts,
2155 SmallPtrSet<Instruction *, 4> DependingInstructions;
2216 Instruction *Inst = &*I++;
lib/Transforms/ObjCARC/PtrState.cpp 118 for (Instruction *Inst : Other.ReverseInsertPts)
177 bool BottomUpPtrState::InitBottomUp(ARCMDKindCache &Cache, Instruction *I) {
228 bool BottomUpPtrState::HandlePotentialAlterRefCount(Instruction *Inst,
256 void BottomUpPtrState::HandlePotentialUse(BasicBlock *BB, Instruction *Inst,
298 } else if (const auto *Call = getreturnRVOperand(*Inst, Class)) {
326 bool TopDownPtrState::InitTopDown(ARCInstKind Kind, Instruction *I) {
352 Instruction *Release) {
380 bool TopDownPtrState::HandlePotentialAlterRefCount(Instruction *Inst,
415 void TopDownPtrState::HandlePotentialUse(Instruction *Inst, const Value *Ptr,
lib/Transforms/ObjCARC/PtrState.h 80 SmallPtrSet<Instruction *, 2> Calls;
84 SmallPtrSet<Instruction *, 2> ReverseInsertPts;
157 void InsertCall(Instruction *I) { RRI.Calls.insert(I); }
159 void InsertReverseInsertPt(Instruction *I) { RRI.ReverseInsertPts.insert(I); }
173 bool InitBottomUp(ARCMDKindCache &Cache, Instruction *I);
183 void HandlePotentialUse(BasicBlock *BB, Instruction *Inst, const Value *Ptr,
185 bool HandlePotentialAlterRefCount(Instruction *Inst, const Value *Ptr,
194 bool InitTopDown(ARCInstKind Kind, Instruction *I);
199 bool MatchWithRelease(ARCMDKindCache &Cache, Instruction *Release);
201 void HandlePotentialUse(Instruction *Inst, const Value *Ptr,
204 bool HandlePotentialAlterRefCount(Instruction *Inst, const Value *Ptr,
lib/Transforms/Scalar/ADCE.cpp 106 Instruction *Terminator = nullptr;
128 DenseMap<Instruction *, InstInfoType> InstInfo;
129 bool isLive(Instruction *I) { return InstInfo[I].Live; }
133 SmallVector<Instruction *, 128> Worklist;
151 bool isAlwaysLive(Instruction &I);
154 bool isInstrumentsConstant(Instruction &I);
160 void markLive(Instruction *I);
209 static bool isUnconditionalBranch(Instruction *Term) {
235 for (Instruction &I : *BBInfo.second.BB)
244 for (Instruction &I : instructions(F))
280 Instruction *Term = BB->getTerminator();
325 bool AggressiveDeadCodeElimination::isAlwaysLive(Instruction &I) {
343 bool AggressiveDeadCodeElimination::isInstrumentsConstant(Instruction &I) {
359 Instruction *LiveInst = Worklist.pop_back_val();
363 if (Instruction *Inst = dyn_cast<Instruction>(OI))
363 if (Instruction *Inst = dyn_cast<Instruction>(OI))
377 void AggressiveDeadCodeElimination::markLive(Instruction *I) {
535 for (Instruction &I : instructions(F)) {
553 for (Instruction *&I : Worklist) {
650 Instruction *PredTerm = BB->getTerminator();
lib/Transforms/Scalar/AlignmentFromAssumptions.cpp 222 if (!CmpBO || CmpBO->getOpcode() != Instruction::And)
305 SmallPtrSet<Instruction *, 32> Visited;
306 SmallVector<Instruction*, 16> WorkList;
311 if (Instruction *K = dyn_cast<Instruction>(J))
311 if (Instruction *K = dyn_cast<Instruction>(J))
317 Instruction *J = WorkList.pop_back_val();
364 Instruction *K = cast<Instruction>(UJ);
364 Instruction *K = cast<Instruction>(UJ);
lib/Transforms/Scalar/BDCE.cpp 39 static void clearAssumptionsOfUsers(Instruction *I, DemandedBits &DB) {
44 SmallPtrSet<Instruction *, 16> Visited;
45 SmallVector<Instruction *, 16> WorkList;
49 auto *J = dyn_cast<Instruction>(JU);
49 auto *J = dyn_cast<Instruction>(JU);
68 Instruction *J = WorkList.pop_back_val();
80 auto *K = dyn_cast<Instruction>(KU);
80 auto *K = dyn_cast<Instruction>(KU);
89 SmallVector<Instruction*, 128> Worklist;
91 for (Instruction &I : instructions(F)) {
116 if (!isa<Instruction>(U) && !isa<Argument>(U))
135 for (Instruction *&I : Worklist) {
lib/Transforms/Scalar/CallSiteSplitting.cpp 191 Instruction *Instr = CS.getInstruction();
212 for (auto &InstBeforeCall :
223 static Instruction *cloneInstForMustTail(Instruction *I, Instruction *Before,
223 static Instruction *cloneInstForMustTail(Instruction *I, Instruction *Before,
223 static Instruction *cloneInstForMustTail(Instruction *I, Instruction *Before,
225 Instruction *Copy = I->clone();
241 static void copyMustTailReturn(BasicBlock *SplitBB, Instruction *CI,
242 Instruction *NewCI) {
253 Instruction *TI = SplitBB->getTerminator();
308 Instruction *Instr = CS.getInstruction();
335 Instruction *NewCI =
380 auto *OriginalBegin = &*TailBB->begin();
396 Instruction *CurrentI = &*I++;
406 cast<Instruction>(Mapping[CurrentI])->getParent());
420 Instruction *Instr = CS.getInstruction();
425 for (auto &BI : *Parent) {
522 Instruction *I = &*II++;
lib/Transforms/Scalar/ConstantHoisting.cpp 169 Instruction *ConstantHoistingPass::findMatInsertPt(Instruction *Inst,
169 Instruction *ConstantHoistingPass::findMatInsertPt(Instruction *Inst,
175 if (auto CastInst = dyn_cast<Instruction>(Opnd))
308 SetVector<Instruction *> ConstantHoistingPass::findConstantInsertionPoint(
313 SetVector<Instruction *> InsertPts;
346 Instruction &FirstInst = (*BBs.begin())->front();
358 ConstCandMapType &ConstCandMap, Instruction *Inst, unsigned Idx,
393 ConstCandMapType &ConstCandMap, Instruction *Inst, unsigned Idx,
418 int Cost = TTI->getIntImmCost(Instruction::Add, 1, Offset, PtrIntTy);
435 ConstCandMapType &ConstCandMap, Instruction *Inst, unsigned Idx) {
445 if (auto CastInst = dyn_cast<Instruction>(Opnd)) {
481 ConstCandMapType &ConstCandMap, Instruction *Inst) {
503 for (Instruction &Inst : BB)
664 auto *UI = U.Inst;
704 static bool updateOperand(Instruction *Inst, unsigned Idx, Instruction *Mat) {
704 static bool updateOperand(Instruction *Inst, unsigned Idx, Instruction *Mat) {
728 void ConstantHoistingPass::emitBaseConstants(Instruction *Base,
732 Instruction *Mat = Base;
739 Instruction *InsertionPt = findMatInsertPt(ConstUser.Inst,
751 Mat = BinaryOperator::Create(Instruction::Add, Base, Offset,
772 if (auto CastInst = dyn_cast<Instruction>(Opnd)) {
776 Instruction *&ClonedCastInst = ClonedCastMap[CastInst];
803 Instruction *ConstExprInst = ConstExpr->getAsInstruction();
831 SetVector<Instruction *> IPSet = findConstantInsertionPoint(ConstInfo);
839 for (Instruction *IP : IPSet) {
866 Instruction *Base = nullptr;
lib/Transforms/Scalar/ConstantProp.cpp 72 SmallPtrSet<Instruction *, 16> WorkList;
76 SmallVector<Instruction *, 16> WorkListVec;
77 for (Instruction &I : instructions(&F)) {
88 SmallVector<Instruction*, 16> NewWorkListVec;
89 for (auto *I : WorkListVec) {
101 if (WorkList.insert(cast<Instruction>(U)).second)
102 NewWorkListVec.push_back(cast<Instruction>(U));
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp 182 if (auto *CommonInst = dyn_cast<Instruction>(CommonValue))
182 if (auto *CommonInst = dyn_cast<Instruction>(CommonValue))
203 if (auto *CommonInst = dyn_cast<Instruction>(CommonValue))
203 if (auto *CommonInst = dyn_cast<Instruction>(CommonValue))
281 static bool processMemAccess(Instruction *I, LazyValueInfo *LVI) {
313 auto *I = dyn_cast<Instruction>(Op0);
313 auto *I = dyn_cast<Instruction>(Op0);
344 if (isa<Instruction>(Cond) && cast<Instruction>(Cond)->getParent() == BB)
344 if (isa<Instruction>(Cond) && cast<Instruction>(Cond)->getParent() == BB)
444 static void setDeducedOverflowingFlags(Value *V, Instruction::BinaryOps Opcode,
448 case Instruction::Add:
453 case Instruction::Sub:
458 case Instruction::Mul:
463 case Instruction::Shl:
472 auto *Inst = dyn_cast<Instruction>(V);
472 auto *Inst = dyn_cast<Instruction>(V);
496 Instruction::BinaryOps Opcode = WO->getBinaryOp();
519 Instruction::BinaryOps Opcode = SI->getBinaryOp();
651 if (BinOp->getOpcode() == Instruction::UDiv)
756 Instruction::BinaryOps Opcode = BinOp->getOpcode();
806 static Constant *getConstantAt(Value *V, Instruction *At, LazyValueInfo *LVI) {
840 Instruction *II = &*BI++;
842 case Instruction::Select:
845 case Instruction::PHI:
848 case Instruction::ICmp:
849 case Instruction::FCmp:
852 case Instruction::Load:
853 case Instruction::Store:
856 case Instruction::Call:
857 case Instruction::Invoke:
860 case Instruction::SRem:
863 case Instruction::SDiv:
866 case Instruction::UDiv:
867 case Instruction::URem:
870 case Instruction::AShr:
873 case Instruction::SExt:
876 case Instruction::Add:
877 case Instruction::Sub:
878 case Instruction::Mul:
879 case Instruction::Shl:
882 case Instruction::And:
888 Instruction *Term = BB->getTerminator();
890 case Instruction::Switch:
893 case Instruction::Ret: {
lib/Transforms/Scalar/DCE.cpp 55 Instruction *Inst = &*DI++;
83 static bool DCEInstruction(Instruction *I,
84 SmallSetVector<Instruction *, 16> &WorkList,
104 if (Instruction *OpI = dyn_cast<Instruction>(OpV))
104 if (Instruction *OpI = dyn_cast<Instruction>(OpV))
118 SmallSetVector<Instruction *, 16> WorkList;
123 Instruction *I = &*FI;
133 Instruction *I = WorkList.pop_back_val();
lib/Transforms/Scalar/DeadStoreElimination.cpp 92 using InstOverlapIntervalsTy = DenseMap<Instruction *, OverlapIntervalsTy>;
99 deleteDeadInstruction(Instruction *I, BasicBlock::iterator *BBI,
103 SmallVector<Instruction*, 32> NowDeadInsts;
114 Instruction *DeadInst = NowDeadInsts.pop_back_val();
132 if (Instruction *OpI = dyn_cast<Instruction>(Op))
132 if (Instruction *OpI = dyn_cast<Instruction>(Op))
151 static bool hasAnalyzableMemoryWrite(Instruction *I,
189 static MemoryLocation getLocForWrite(Instruction *Inst) {
221 static MemoryLocation getLocForRead(Instruction *Inst,
234 static bool isRemovable(Instruction *I) {
270 static bool isShortenableAtTheEnd(Instruction *I) {
295 static bool isShortenableAtTheBeginning(Instruction *I) {
302 static Value *getStoredPointerOperand(Instruction *I) {
347 Instruction *DepWrite,
539 static bool isPossibleSelfRead(Instruction *Inst,
541 Instruction *DepWrite,
585 static bool memoryIsNotModifiedBetween(Instruction *FirstI,
586 Instruction *SecondI,
620 Instruction *I = &*BI;
645 Instruction *PredTI = Pred->getTerminator();
669 Instruction *InstPt = BB->getTerminator();
675 Instruction *Dependency = Dep.getInst();
760 for (Instruction &I : Entry) {
797 Instruction *Dead = &*BBI;
904 static bool tryToShorten(Instruction *EarlierWrite, int64_t &EarlierOffset,
959 static bool tryToShortenEnd(Instruction *EarlierWrite,
980 static bool tryToShortenBegin(Instruction *EarlierWrite,
1007 Instruction *EarlierWrite = OI.first;
1026 static bool eliminateNoopStore(Instruction *Inst, BasicBlock::iterator &BBI,
1056 Instruction *UnderlyingPointer =
1057 dyn_cast<Instruction>(GetUnderlyingObject(SI->getPointerOperand(), DL));
1080 Instruction *LastThrowing = nullptr;
1096 Instruction *Inst = &*BBI++;
1143 Instruction *DepWrite = InstDep.getInst();
lib/Transforms/Scalar/DivRemPairs.cpp 42 Instruction *Value;
50 static llvm::Optional<ExpandedMatch> matchExpandedRem(Instruction &I) {
56 Instruction *Div;
66 M.Key.SignedOp = Div->getOpcode() == Instruction::SDiv;
77 AssertingVH<Instruction> DivInst;
81 AssertingVH<Instruction> RemInst;
83 DivRemPairWorklistEntry(Instruction *DivInst_, Instruction *RemInst_)
83 DivRemPairWorklistEntry(Instruction *DivInst_, Instruction *RemInst_)
97 bool isSigned() const { return DivInst->getOpcode() == Instruction::SDiv; }
105 case Instruction::SRem:
106 case Instruction::URem:
123 DenseMap<DivRemMapKey, Instruction *> DivMap;
126 MapVector<DivRemMapKey, Instruction *> RemMap;
128 for (auto &I : BB) {
129 if (I.getOpcode() == Instruction::SDiv)
131 else if (I.getOpcode() == Instruction::UDiv)
133 else if (I.getOpcode() == Instruction::SRem)
135 else if (I.getOpcode() == Instruction::URem)
150 Instruction *DivInst = DivMap[RemPair.first];
156 Instruction *RemInst = RemPair.second;
205 Instruction *RealRem = E.isSigned() ? BinaryOperator::CreateSRem(X, Y)
211 Instruction *OrigRemInst = RemInst;
265 Instruction *Mul = BinaryOperator::CreateMul(DivInst, Y);
266 Instruction *Sub = BinaryOperator::CreateSub(X, Mul);
306 Instruction *OrigRemInst = RemInst;
lib/Transforms/Scalar/EarlyCSE.cpp 96 Instruction *Inst;
98 SimpleValue(Instruction *I) : Inst(I) {
103 return Inst == DenseMapInfo<Instruction *>::getEmptyKey() ||
104 Inst == DenseMapInfo<Instruction *>::getTombstoneKey();
107 static bool canHandle(Instruction *Inst) {
126 return DenseMapInfo<Instruction *>::getEmptyKey();
130 return DenseMapInfo<Instruction *>::getTombstoneKey();
166 Instruction *Inst = Val.Inst;
266 Instruction *LHSI = LHS.Inst, *RHSI = RHS.Inst;
372 Instruction *Inst;
374 CallValue(Instruction *I) : Inst(I) {
379 return Inst == DenseMapInfo<Instruction *>::getEmptyKey() ||
380 Inst == DenseMapInfo<Instruction *>::getTombstoneKey();
383 static bool canHandle(Instruction *Inst) {
401 return DenseMapInfo<Instruction *>::getEmptyKey();
405 return DenseMapInfo<Instruction *>::getTombstoneKey();
415 Instruction *Inst = Val.Inst;
423 Instruction *LHSI = LHS.Inst, *RHSI = RHS.Inst;
482 Instruction *DefInst = nullptr;
488 LoadValue(Instruction *Inst, unsigned Generation, unsigned MatchingId,
519 ScopedHashTable<CallValue, std::pair<Instruction *, unsigned>>;
604 ParseMemoryInst(Instruction *Inst, const TargetTransformInfo &TTI)
693 Instruction *Inst;
698 bool handleBranchCondition(Instruction *CondInst, const BranchInst *BI,
713 bool isOperatingOnInvariantMemAt(Instruction *I, unsigned GenAt);
716 Instruction *EarlierInst, Instruction *LaterInst);
716 Instruction *EarlierInst, Instruction *LaterInst);
718 void removeMSSA(Instruction *Inst) {
753 Instruction *EarlierInst,
754 Instruction *LaterInst) {
790 bool EarlyCSE::isOperatingOnInvariantMemAt(Instruction *I, unsigned GenAt) {
811 bool EarlyCSE::handleBranchCondition(Instruction *CondInst,
829 (BI->getSuccessor(0) == BB) ? Instruction::And : Instruction::Or;
829 (BI->getSuccessor(0) == BB) ? Instruction::And : Instruction::Or;
832 SmallVector<Instruction *, 4> WorkList;
833 SmallPtrSet<Instruction *, 4> Visited;
836 Instruction *Curr = WorkList.pop_back_val();
855 if (Instruction *OPI = dyn_cast<Instruction>(Op))
855 if (Instruction *OPI = dyn_cast<Instruction>(Op))
885 auto *CondInst = dyn_cast<Instruction>(BI->getCondition());
885 auto *CondInst = dyn_cast<Instruction>(BI->getCondition());
895 Instruction *LastStore = nullptr;
900 Instruction *Inst = &*I++;
923 auto *CondI =
924 dyn_cast<Instruction>(cast<CallInst>(Inst)->getArgOperand(0));
966 if (auto *CondI =
967 dyn_cast<Instruction>(cast<CallInst>(Inst)->getArgOperand(0))) {
1033 if (auto *I = dyn_cast<Instruction>(V))
1033 if (auto *I = dyn_cast<Instruction>(V))
1127 std::pair<Instruction *, unsigned> InVal = AvailableCalls.lookup(Inst);
lib/Transforms/Scalar/Float2Int.cpp 110 static Instruction::BinaryOps mapBinOpcode(unsigned Opcode) {
113 case Instruction::FAdd: return Instruction::Add;
113 case Instruction::FAdd: return Instruction::Add;
114 case Instruction::FSub: return Instruction::Sub;
114 case Instruction::FSub: return Instruction::Sub;
115 case Instruction::FMul: return Instruction::Mul;
115 case Instruction::FMul: return Instruction::Mul;
122 SmallPtrSet<Instruction*,8> &Roots) {
129 for (Instruction &I : BB) {
134 case Instruction::FPToUI:
135 case Instruction::FPToSI:
138 case Instruction::FCmp:
149 void Float2IntPass::seen(Instruction *I, ConstantRange R) {
185 void Float2IntPass::walkBackwards(const SmallPtrSetImpl<Instruction*> &Roots) {
186 std::deque<Instruction*> Worklist(Roots.begin(), Roots.end());
188 Instruction *I = Worklist.back();
202 case Instruction::UIToFP:
203 case Instruction::SIToFP: {
213 case Instruction::FNeg:
214 case Instruction::FAdd:
215 case Instruction::FSub:
216 case Instruction::FMul:
217 case Instruction::FPToUI:
218 case Instruction::FPToSI:
219 case Instruction::FCmp:
225 if (Instruction *OI = dyn_cast<Instruction>(O)) {
225 if (Instruction *OI = dyn_cast<Instruction>(O)) {
245 Instruction *I = It.first;
250 case Instruction::UIToFP:
251 case Instruction::SIToFP:
254 case Instruction::FNeg:
263 case Instruction::FAdd:
264 case Instruction::FSub:
265 case Instruction::FMul:
277 case Instruction::FPToUI:
278 case Instruction::FPToSI:
288 case Instruction::FCmp:
299 if (Instruction *OI = dyn_cast<Instruction>(O)) {
299 if (Instruction *OI = dyn_cast<Instruction>(O)) {
364 Instruction *I = *MI;
379 Instruction *UI = dyn_cast<Instruction>(U);
379 Instruction *UI = dyn_cast<Instruction>(U);
435 Value *Float2IntPass::convert(Instruction *I, Type *ToTy) {
443 if (I->getOpcode() == Instruction::UIToFP ||
444 I->getOpcode() == Instruction::SIToFP) {
446 } else if (Instruction *VI = dyn_cast<Instruction>(V)) {
446 } else if (Instruction *VI = dyn_cast<Instruction>(V)) {
466 case Instruction::FPToUI:
470 case Instruction::FPToSI:
474 case Instruction::FCmp: {
481 case Instruction::UIToFP:
485 case Instruction::SIToFP:
489 case Instruction::FNeg:
493 case Instruction::FAdd:
494 case Instruction::FSub:
495 case Instruction::FMul:
lib/Transforms/Scalar/GVN.cpp 232 Value *MaterializeAdjustedValue(LoadInst *LI, Instruction *InsertPt,
272 GVN::Expression GVN::ValueTable::createExpr(Instruction *I) {
276 for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end();
348 for (Instruction::op_iterator OI = EI->op_begin(), OE = EI->op_end();
486 if (!isa<Instruction>(V)) {
491 Instruction* I = cast<Instruction>(V);
491 Instruction* I = cast<Instruction>(V);
494 case Instruction::Call:
496 case Instruction::FNeg:
497 case Instruction::Add:
498 case Instruction::FAdd:
499 case Instruction::Sub:
500 case Instruction::FSub:
501 case Instruction::Mul:
502 case Instruction::FMul:
503 case Instruction::UDiv:
504 case Instruction::SDiv:
505 case Instruction::FDiv:
506 case Instruction::URem:
507 case Instruction::SRem:
508 case Instruction::FRem:
509 case Instruction::Shl:
510 case Instruction::LShr:
511 case Instruction::AShr:
512 case Instruction::And:
513 case Instruction::Or:
514 case Instruction::Xor:
515 case Instruction::ICmp:
516 case Instruction::FCmp:
517 case Instruction::Trunc:
518 case Instruction::ZExt:
519 case Instruction::SExt:
520 case Instruction::FPToUI:
521 case Instruction::FPToSI:
522 case Instruction::UIToFP:
523 case Instruction::SIToFP:
524 case Instruction::FPTrunc:
525 case Instruction::FPExt:
526 case Instruction::PtrToInt:
527 case Instruction::IntToPtr:
528 case Instruction::AddrSpaceCast:
529 case Instruction::BitCast:
530 case Instruction::Select:
531 case Instruction::ExtractElement:
532 case Instruction::InsertElement:
533 case Instruction::ShuffleVector:
534 case Instruction::InsertValue:
535 case Instruction::GetElementPtr:
538 case Instruction::ExtractValue:
541 case Instruction::PHI:
771 Instruction *InsertPt,
819 static bool isLifetimeStart(const Instruction *Inst) {
840 DT->dominates(cast<Instruction>(U), LI)) {
866 Instruction *DepInst = DepInfo.getInst();
1161 SmallVector<Instruction*, 8> NewInsts;
1226 for (Instruction *I : NewInsts) {
1281 if (Instruction *I = dyn_cast<Instruction>(V))
1281 if (Instruction *I = dyn_cast<Instruction>(V))
1341 if (Instruction *I = dyn_cast<Instruction>(OI->get()))
1341 if (Instruction *I = dyn_cast<Instruction>(OI->get()))
1369 if (Instruction *I = dyn_cast<Instruction>(V))
1369 if (Instruction *I = dyn_cast<Instruction>(V))
1392 if (isa<Instruction>(U) &&
1393 cast<Instruction>(U)->getParent() == BB)
1467 if (!isa<Instruction>(CmpLHS) && isa<Instruction>(CmpRHS))
1467 if (!isa<Instruction>(CmpLHS) && isa<Instruction>(CmpRHS))
1470 (isa<Instruction>(CmpLHS) && isa<Instruction>(CmpRHS))) {
1470 (isa<Instruction>(CmpLHS) && isa<Instruction>(CmpRHS))) {
1509 static void patchAndReplaceAllUsesWith(Instruction *I, Value *Repl) {
1666 if ((i > 1 && Exp.opcode == Instruction::InsertValue) ||
1667 (i > 0 && Exp.opcode == Instruction::ExtractValue))
1677 if (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp)
1677 if (Opcode == Instruction::ICmp || Opcode == Instruction::FCmp)
1685 if (Exp.opcode == Instruction::Call && NewNum != Num)
1756 bool GVN::replaceOperandsForInBlockEquality(Instruction *Instr) const {
1808 (isa<Instruction>(LHS) && isa<Instruction>(RHS))) {
1808 (isa<Instruction>(LHS) && isa<Instruction>(RHS))) {
1827 if (RootDominatesEnd && !isa<Instruction>(RHS))
1911 if (NotCmp && isa<Instruction>(NotCmp)) {
1940 bool GVN::processInstruction(Instruction *I) {
2175 for (auto *I : InstrsToErase) {
2196 bool GVN::performScalarPREInsertion(Instruction *Instr, BasicBlock *Pred,
2243 bool GVN::performScalarPRE(Instruction *CurInst) {
2304 if (auto *Inst = dyn_cast<Instruction>(U.get()))
2304 if (auto *Inst = dyn_cast<Instruction>(U.get()))
2336 Instruction *PREInstr = nullptr;
2436 Instruction *CurInst = &*BI++;
2464 std::pair<Instruction *, unsigned> Edge = toSplit.pop_back_val();
2501 void GVN::verifyRemoved(const Instruction *Inst) const {
2643 for (Instruction &Inst : *BB) {
lib/Transforms/Scalar/GVNHoist.cpp 118 using SmallVecInsn = SmallVector<Instruction *, 4>;
119 using SmallVecImplInsn = SmallVectorImpl<Instruction *>;
130 using VNtoInsns = DenseMap<VNType, SmallVector<Instruction *, 4>>;
149 Instruction *I;
159 DenseMap<BasicBlock *, SmallVector<std::pair<VNType, Instruction *>, 2>>;
171 void insert(Instruction *I, GVN::ValueTable &VN) {
243 static void combineKnownMetadata(Instruction *ReplInst, Instruction *I) {
243 static void combineKnownMetadata(Instruction *ReplInst, Instruction *I) {
375 bool firstInBB(const Instruction *I1, const Instruction *I2) {
375 bool firstInBB(const Instruction *I1, const Instruction *I2) {
384 bool hasMemoryUse(const Instruction *NewPt, MemoryDef *Def,
390 Instruction *OldPt = Def->getMemoryInst();
397 Instruction *Insn = MU->getMemoryInst();
444 bool hasEHOrLoadsOnPath(const Instruction *NewPt, MemoryDef *Def,
517 bool safeToHoistLdSt(const Instruction *NewPt, const Instruction *OldPt,
517 bool safeToHoistLdSt(const Instruction *NewPt, const Instruction *OldPt,
579 bool valueAnticipable(CHIArgs C, Instruction *TI) const {
600 Instruction *Insn = CHI.I;
614 using RenameStackType = DenseMap<VNType, SmallVector<Instruction *, 2>>;
622 for (std::pair<VNType, Instruction *> &VI : reverse(it1->second)) {
817 bool allOperandsAvailable(const Instruction *I,
820 if (const auto *Inst = dyn_cast<Instruction>(&Op))
820 if (const auto *Inst = dyn_cast<Instruction>(&Op))
828 bool allGepOperandsAvailable(const Instruction *I,
831 if (const auto *Inst = dyn_cast<Instruction>(&Op))
831 if (const auto *Inst = dyn_cast<Instruction>(&Op))
848 void makeGepsAvailable(Instruction *Repl, BasicBlock *HoistPt,
854 Instruction *ClonedGep = Gep->clone();
856 if (Instruction *Op = dyn_cast<Instruction>(Gep->getOperand(i))) {
856 if (Instruction *Op = dyn_cast<Instruction>(Gep->getOperand(i))) {
876 for (const Instruction *OtherInst : InstructionsToHoist) {
890 void updateAlignment(Instruction *I, Instruction *Repl) {
890 void updateAlignment(Instruction *I, Instruction *Repl) {
914 for (Instruction *I : Candidates) {
974 bool makeGepOperandsAvailable(Instruction *Repl, BasicBlock *HoistPt,
978 Instruction *Val = nullptr;
983 Val = dyn_cast<Instruction>(St->getValueOperand());
1014 Instruction *Repl = nullptr;
1015 for (Instruction *I : InstructionsToHoist)
1051 Instruction *Last = DestBB->getTerminator();
1087 for (Instruction &I1 : *BB) {
lib/Transforms/Scalar/GVNSink.cpp 100 static bool isMemoryInst(const Instruction *I) {
121 SmallVector<Instruction *, 4> Insts;
148 ArrayRef<Instruction *> operator*() const { return Insts; }
173 SmallVector<Instruction *, 4> NewInsts;
174 for (auto *Inst : Insts) {
266 ModelledPHI(ArrayRef<Instruction *> Insts, unsigned OpNum, const BArray &B) {
268 for (auto *I : Insts)
354 InstructionUseExpr(Instruction *I, ArrayRecycler<Value *> &R,
394 InstructionUseExpr *createExpr(Instruction *I) {
428 if (!isa<Instruction>(V)) {
433 Instruction *I = cast<Instruction>(V);
433 Instruction *I = cast<Instruction>(V);
436 case Instruction::Load:
439 case Instruction::Store:
442 case Instruction::Call:
443 case Instruction::Invoke:
444 case Instruction::FNeg:
445 case Instruction::Add:
446 case Instruction::FAdd:
447 case Instruction::Sub:
448 case Instruction::FSub:
449 case Instruction::Mul:
450 case Instruction::FMul:
451 case Instruction::UDiv:
452 case Instruction::SDiv:
453 case Instruction::FDiv:
454 case Instruction::URem:
455 case Instruction::SRem:
456 case Instruction::FRem:
457 case Instruction::Shl:
458 case Instruction::LShr:
459 case Instruction::AShr:
460 case Instruction::And:
461 case Instruction::Or:
462 case Instruction::Xor:
463 case Instruction::ICmp:
464 case Instruction::FCmp:
465 case Instruction::Trunc:
466 case Instruction::ZExt:
467 case Instruction::SExt:
468 case Instruction::FPToUI:
469 case Instruction::FPToSI:
470 case Instruction::UIToFP:
471 case Instruction::SIToFP:
472 case Instruction::FPTrunc:
473 case Instruction::FPExt:
474 case Instruction::PtrToInt:
475 case Instruction::IntToPtr:
476 case Instruction::BitCast:
477 case Instruction::Select:
478 case Instruction::ExtractElement:
479 case Instruction::InsertElement:
480 case Instruction::ShuffleVector:
481 case Instruction::InsertValue:
482 case Instruction::GetElementPtr:
537 uint32_t getMemoryUseOrder(Instruction *Inst) {
578 bool isInstructionBlacklisted(Instruction *I) {
639 for (auto *I : Insts) {
662 SmallVector<Instruction *, 4> NewInsts;
663 for (auto *I : Insts) {
669 for (auto *I : NewInsts)
716 Instruction *I0 = NewInsts[0];
766 auto *T = B->getTerminator();
834 SmallVector<Instruction *, 4> Insts;
837 Instruction *I0 = Insts.front();
854 for (auto *I : Insts)
866 for (auto *I : Insts)
872 for (auto *I : Insts)
878 for (auto *I : Insts)
lib/Transforms/Scalar/GuardWidening.cpp 94 static Value *getCondition(Instruction *I) {
109 static void setCondition(Instruction *I, Value *NewCond) {
120 static void eliminateGuard(Instruction *GuardInst) {
138 SmallVector<Instruction *, 16> EliminatedGuardsAndBranches;
142 DenseSet<Instruction *> WidenedGuards;
149 Instruction *Instr, const df_iterator<DomTreeNode *> &DFSI,
176 WideningScore computeWideningScore(Instruction *DominatedInstr,
177 Instruction *DominatingGuard,
181 bool isAvailableAt(const Value *V, const Instruction *InsertPos) const {
182 SmallPtrSet<const Instruction *, 8> Visited;
186 bool isAvailableAt(const Value *V, const Instruction *InsertPos,
187 SmallPtrSetImpl<const Instruction *> &Visited) const;
191 void makeAvailableAt(Value *V, Instruction *InsertPos) const;
200 bool widenCondCommon(Value *Cond0, Value *Cond1, Instruction *InsertPt,
271 void widenGuard(Instruction *ToWiden, Value *NewCondition,
301 static bool isSupportedGuardInstruction(const Instruction *Insn) {
310 DenseMap<BasicBlock *, SmallVector<Instruction *, 8>> GuardsInBlock;
327 for (auto &I : *BB)
329 CurrentList.push_back(cast<Instruction>(&I));
331 for (auto *II : CurrentList)
347 for (auto *I : EliminatedGuardsAndBranches)
363 Instruction *Instr, const df_iterator<DomTreeNode *> &DFSI,
372 Instruction *BestSoFar = nullptr;
392 for (auto &I : *CurBB) {
405 for (auto *Candidate : make_range(I, E)) {
439 GuardWideningImpl::computeWideningScore(Instruction *DominatedInstr,
440 Instruction *DominatingGuard,
498 const Value *V, const Instruction *Loc,
499 SmallPtrSetImpl<const Instruction *> &Visited) const {
500 auto *Inst = dyn_cast<Instruction>(V);
519 void GuardWideningImpl::makeAvailableAt(Value *V, Instruction *Loc) const {
520 auto *Inst = dyn_cast<Instruction>(V);
520 auto *Inst = dyn_cast<Instruction>(V);
534 Instruction *InsertPt, Value *&Result,
661 auto *BaseInst = dyn_cast<Instruction>(Check.getBase());
lib/Transforms/Scalar/IndVarSimplify.cpp 160 bool hasHardUserWithinLoop(const Loop *L, const Instruction *I) const;
237 static Instruction *getInsertPointForUses(Instruction *User, Value *Def,
237 static Instruction *getInsertPointForUses(Instruction *User, Value *Def,
243 Instruction *InsertPt = nullptr;
266 auto *DefI = dyn_cast<Instruction>(Def);
266 auto *DefI = dyn_cast<Instruction>(Def);
321 if (Incr == nullptr || Incr->getOpcode() != Instruction::FAdd) return false;
334 Instruction *U1 = cast<Instruction>(*IncrUse++);
334 Instruction *U1 = cast<Instruction>(*IncrUse++);
336 Instruction *U2 = cast<Instruction>(*IncrUse++);
336 Instruction *U2 = cast<Instruction>(*IncrUse++);
551 bool IndVarSimplify::hasHardUserWithinLoop(const Loop *L, const Instruction *I) const {
552 SmallPtrSet<const Instruction *, 8> Visited;
553 SmallVector<const Instruction *, 8> WorkList;
557 const Instruction *Curr = WorkList.pop_back_val();
566 auto *UI = cast<Instruction>(U);
625 if (!isa<Instruction>(InVal))
633 Instruction *Inst = cast<Instruction>(InVal);
633 Instruction *Inst = cast<Instruction>(InVal);
689 if (auto *ExitInsn = dyn_cast<Instruction>(ExitVal))
689 if (auto *ExitInsn = dyn_cast<Instruction>(ExitVal))
718 Instruction *Inst = cast<Instruction>(PN->getIncomingValue(Phi.Ith));
718 Instruction *Inst = cast<Instruction>(PN->getIncomingValue(Phi.Ith));
775 auto *TermInst = IncomingBB->getTerminator();
853 Instruction *I;
854 if (!found && (I = dyn_cast<Instruction>(Incoming)))
896 bool IsSigned = Cast->getOpcode() == Instruction::SExt;
897 if (!IsSigned && Cast->getOpcode() != Instruction::ZExt)
920 TTI->getArithmeticInstrCost(Instruction::Add, Ty) >
921 TTI->getArithmeticInstrCost(Instruction::Add,
946 Instruction *NarrowDef = nullptr;
947 Instruction *NarrowUse = nullptr;
948 Instruction *WideDef = nullptr;
955 NarrowIVDefUse(Instruction *ND, Instruction *NU, Instruction *WD,
955 NarrowIVDefUse(Instruction *ND, Instruction *NU, Instruction *WD,
955 NarrowIVDefUse(Instruction *ND, Instruction *NU, Instruction *WD,
982 Instruction *WideInc = nullptr;
986 SmallPtrSet<Instruction *,16> Widened;
995 DenseMap<AssertingVH<Instruction>, ExtendKind> ExtendKindMap;
997 using DefUserPair = std::pair<AssertingVH<Value>, AssertingVH<Instruction>>;
1006 Instruction *UseI) {
1015 void calculatePostIncRange(Instruction *NarrowDef, Instruction *NarrowUser);
1015 void calculatePostIncRange(Instruction *NarrowDef, Instruction *NarrowUser);
1017 void updatePostIncRangeInfo(Value *Def, Instruction *UseI, ConstantRange R) {
1041 Instruction *Use);
1043 Instruction *cloneIVUser(NarrowIVDefUse DU, const SCEVAddRecExpr *WideAR);
1044 Instruction *cloneArithmeticIVUser(NarrowIVDefUse DU,
1046 Instruction *cloneBitwiseIVUser(NarrowIVDefUse DU);
1048 ExtendKind getExtendKind(Instruction *I);
1059 Instruction *widenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter);
1065 void pushNarrowIVUsers(Instruction *NarrowDef, Instruction *WideDef);
1065 void pushNarrowIVUsers(Instruction *NarrowDef, Instruction *WideDef);
1071 bool IsSigned, Instruction *Use) {
1087 Instruction *WidenIV::cloneIVUser(NarrowIVDefUse DU,
1093 case Instruction::Add:
1094 case Instruction::Mul:
1095 case Instruction::UDiv:
1096 case Instruction::Sub:
1099 case Instruction::And:
1100 case Instruction::Or:
1101 case Instruction::Xor:
1102 case Instruction::Shl:
1103 case Instruction::LShr:
1104 case Instruction::AShr:
1109 Instruction *WidenIV::cloneBitwiseIVUser(NarrowIVDefUse DU) {
1110 Instruction *NarrowUse = DU.NarrowUse;
1111 Instruction *NarrowDef = DU.NarrowDef;
1112 Instruction *WideDef = DU.WideDef;
1139 Instruction *WidenIV::cloneArithmeticIVUser(NarrowIVDefUse DU,
1141 Instruction *NarrowUse = DU.NarrowUse;
1142 Instruction *NarrowDef = DU.NarrowDef;
1143 Instruction *WideDef = DU.WideDef;
1185 case Instruction::Add:
1189 case Instruction::Mul:
1193 case Instruction::UDiv:
1197 case Instruction::Sub:
1231 WidenIV::ExtendKind WidenIV::getExtendKind(Instruction *I) {
1239 if (OpCode == Instruction::Add)
1241 if (OpCode == Instruction::Sub)
1243 if (OpCode == Instruction::Mul)
1258 if (OpCode != Instruction::Add && OpCode != Instruction::Sub &&
1258 if (OpCode != Instruction::Add && OpCode != Instruction::Sub &&
1259 OpCode != Instruction::Mul)
1345 auto *InsertPt = getInsertPointForUses(DU.NarrowUse, DU.NarrowDef, DT, LI);
1387 auto *InsertPt = getInsertPointForUses(DU.NarrowUse, DU.NarrowDef, DT, LI);
1415 Instruction *NarrowUse = DU.NarrowUse;
1416 Instruction *NarrowDef = DU.NarrowDef;
1417 Instruction *WideDef = DU.WideDef;
1422 if (OpCode != Instruction::Add && OpCode != Instruction::Sub &&
1422 if (OpCode != Instruction::Add && OpCode != Instruction::Sub &&
1423 OpCode != Instruction::Mul)
1447 auto *I = dyn_cast<Instruction>(NarrowUse->getOperand(ExtendOperIdx));
1447 auto *I = dyn_cast<Instruction>(NarrowUse->getOperand(ExtendOperIdx));
1448 if (I && I->getOpcode() != Instruction::Load)
1485 Instruction *NarrowUse = DU.NarrowUse;
1486 Instruction *NarrowDef = DU.NarrowDef;
1487 Instruction *WideDef = DU.WideDef;
1543 Instruction *WidenIV::widenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter) {
1661 Instruction *WideUse = nullptr;
1693 void WidenIV::pushNarrowIVUsers(Instruction *NarrowDef, Instruction *WideDef) {
1693 void WidenIV::pushNarrowIVUsers(Instruction *NarrowDef, Instruction *WideDef) {
1699 Instruction *NarrowUser = cast<Instruction>(U);
1699 Instruction *NarrowUser = cast<Instruction>(U);
1769 Instruction *InsertPt = &L->getHeader()->front();
1778 cast<Instruction>(WidePhi->getIncomingValueForBlock(LatchBlock));
1782 auto *OrigInc =
1783 cast<Instruction>(OrigPhi->getIncomingValueForBlock(LatchBlock));
1801 Instruction *WideUse = widenIVUse(DU, Rewriter);
1820 void WidenIV::calculatePostIncRange(Instruction *NarrowDef,
1821 Instruction *NarrowUser) {
1855 for (Instruction &I : make_range(Ctx->getIterator().getReverse(),
1875 auto *TI = BB->getTerminator();
1900 SmallPtrSet<Instruction *, 16> Visited;
1901 SmallVector<Instruction *, 6> Worklist;
1906 Instruction *NarrowDef = Worklist.pop_back_val();
1909 auto *NarrowUser = cast<Instruction>(U.getUser());
1909 auto *NarrowUser = cast<Instruction>(U.getUser());
2021 Instruction *IncI = dyn_cast<Instruction>(IncV);
2021 Instruction *IncI = dyn_cast<Instruction>(IncV);
2026 case Instruction::Add:
2027 case Instruction::Sub:
2029 case Instruction::GetElementPtr:
2044 if (IncI->getOpcode() == Instruction::GetElementPtr)
2125 static bool mustExecuteUBIfPoisonOnPathTo(Instruction *Root,
2126 Instruction *OnPathTo,
2136 SmallVector<const Instruction*, 16> Worklist;
2139 const Instruction *I = Worklist.pop_back_val();
2152 Worklist.push_back(cast<Instruction>(User));
2173 Instruction *I = dyn_cast<Instruction>(V);
2173 Instruction *I = dyn_cast<Instruction>(V);
2427 Instruction * const IncVar =
2428 cast<Instruction>(IndVar->getIncomingValueForBlock(L->getLoopLatch()));
2490 if (auto *Cond = dyn_cast<Instruction>(BI->getCondition()))
2490 if (auto *Cond = dyn_cast<Instruction>(BI->getCondition()))
2610 Instruction *User = cast<Instruction>(U.getUser());
2610 Instruction *User = cast<Instruction>(U.getUser());
2628 Instruction *ToMove = &*I;
2921 for (auto &I : *BB)
3097 if (Instruction *Inst =
3098 dyn_cast_or_null<Instruction>(DeadInsts.pop_back_val()))
lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp 1158 for (Instruction &I : *ClonedBB)
1409 Instruction *InsertPt = OriginalPreheader->getTerminator();
1834 Instruction *ExprInsertPt = Preheader->getTerminator();
lib/Transforms/Scalar/InferAddressSpaces.cpp 226 case Instruction::PHI:
229 case Instruction::BitCast:
230 case Instruction::AddrSpaceCast:
231 case Instruction::GetElementPtr:
233 case Instruction::Select:
246 case Instruction::PHI: {
251 case Instruction::BitCast:
252 case Instruction::AddrSpaceCast:
253 case Instruction::GetElementPtr:
255 case Instruction::Select:
356 for (Instruction &I : instructions(F)) {
442 Instruction *I, unsigned NewAddrSpace,
448 if (I->getOpcode() == Instruction::AddrSpaceCast) {
470 case Instruction::BitCast:
472 case Instruction::PHI: {
483 case Instruction::GetElementPtr: {
491 case Instruction::Select:
509 if (CE->getOpcode() == Instruction::AddrSpaceCast) {
518 if (CE->getOpcode() == Instruction::BitCast) {
524 if (CE->getOpcode() == Instruction::Select) {
567 if (CE->getOpcode() == Instruction::GetElementPtr) {
591 if (Instruction *I = dyn_cast<Instruction>(V)) {
591 if (Instruction *I = dyn_cast<Instruction>(V)) {
594 if (Instruction *NewI = dyn_cast<Instruction>(NewV)) {
594 if (Instruction *NewI = dyn_cast<Instruction>(NewV)) {
703 if (Op.getOpcode() == Instruction::Select) {
761 if (auto *I = dyn_cast<Instruction>(Inst))
761 if (auto *I = dyn_cast<Instruction>(Inst))
850 if (Op->getOpcode() == Instruction::AddrSpaceCast)
853 if (Op->getOpcode() == Instruction::IntToPtr &&
901 SmallVector<Instruction *, 16> DeadInstructions;
954 if (isa<Instruction>(CurUser)) {
991 NewV = CastInst::Create(Instruction::BitCast, NewV,
1001 if (Instruction *Inst = dyn_cast<Instruction>(V)) {
1001 if (Instruction *Inst = dyn_cast<Instruction>(V)) {
1018 if (Instruction *I = dyn_cast<Instruction>(V))
1018 if (Instruction *I = dyn_cast<Instruction>(V))
1023 for (Instruction *I : DeadInstructions)
lib/Transforms/Scalar/InstSimplifyPass.cpp 32 SmallPtrSet<const Instruction *, 8> S1, S2, *ToSimplify = &S1, *Next = &S2;
42 SmallVector<Instruction *, 8> DeadInstsInBB;
43 for (Instruction &I : BB) {
58 Next->insert(cast<Instruction>(U));
lib/Transforms/Scalar/JumpThreading.cpp 451 static void ReplaceFoldableUses(Instruction *Cond, Value *ToVal) {
458 for (Instruction &I : reverse(*BB)) {
477 Instruction *StopAt,
597 Instruction *CxtI) {
615 Instruction *I = dyn_cast<Instruction>(V);
615 Instruction *I = dyn_cast<Instruction>(V);
691 if (I->getOpcode() == Instruction::Or ||
692 I->getOpcode() == Instruction::And) {
704 if (I->getOpcode() == Instruction::Or)
730 if (I->getOpcode() == Instruction::Xor &&
802 auto LHSInst = dyn_cast<Instruction>(LHS);
827 if (!isa<Instruction>(CmpLHS) ||
828 cast<Instruction>(CmpLHS)->getParent() != BB) {
859 if (!isa<Instruction>(AddLHS) ||
860 cast<Instruction>(AddLHS)->getParent() != BB) {
870 AddLHS, P, BB, CxtI ? CxtI : cast<Instruction>(CmpLHS));
965 Instruction *BBTerm = BB->getTerminator();
1006 const Instruction *TI = SinglePred->getTerminator();
1062 Instruction *Terminator = BB->getTerminator();
1080 if (Instruction *I = dyn_cast<Instruction>(Condition)) {
1080 if (Instruction *I = dyn_cast<Instruction>(Condition)) {
1098 Instruction *BBTerm = BB->getTerminator();
1127 Instruction *CondInst = dyn_cast<Instruction>(Condition);
1127 Instruction *CondInst = dyn_cast<Instruction>(Condition);
1230 if (CondInst->getOpcode() == Instruction::Xor &&
1283 if (Instruction *OpInst = dyn_cast<Instruction>(Op))
1283 if (Instruction *OpInst = dyn_cast<Instruction>(Op))
1576 Instruction *TI = BB->getTerminator();
1594 Instruction *CxtI) {
1693 Instruction *Term = BB->getTerminator();
1700 if (auto *CondInst = dyn_cast<Instruction>(Cond)) {
1700 if (auto *CondInst = dyn_cast<Instruction>(Cond)) {
1906 DenseMap<Instruction*, Value*> &ValueMap) {
1913 if (Instruction *Inst = dyn_cast<Instruction>(IV)) {
1913 if (Instruction *Inst = dyn_cast<Instruction>(IV)) {
1914 DenseMap<Instruction*, Value*>::iterator I = ValueMap.find(Inst);
1983 DenseMap<Instruction*, Value*> ValueMapping;
2010 Instruction *New = BI->clone();
2017 if (Instruction *Inst = dyn_cast<Instruction>(New->getOperand(i))) {
2017 if (Instruction *Inst = dyn_cast<Instruction>(New->getOperand(i))) {
2018 DenseMap<Instruction*, Value*>::iterator I = ValueMapping.find(Inst);
2036 Instruction *PredTerm = PredBB->getTerminator();
2055 for (Instruction &I : *BB) {
2060 Instruction *User = cast<Instruction>(U.getUser());
2060 Instruction *User = cast<Instruction>(U.getUser());
2145 const Instruction *TI = BB->getTerminator();
2318 DenseMap<Instruction*, Value*> ValueMapping;
2326 Instruction *New = BI->clone();
2330 if (Instruction *Inst = dyn_cast<Instruction>(New->getOperand(i))) {
2330 if (Instruction *Inst = dyn_cast<Instruction>(New->getOperand(i))) {
2331 DenseMap<Instruction*, Value*>::iterator I = ValueMapping.find(Inst);
2375 for (Instruction &I : *BB) {
2379 Instruction *User = cast<Instruction>(U.getUser());
2379 Instruction *User = cast<Instruction>(U.getUser());
2607 Instruction *Term =
2676 for (auto &I : *BB)
2717 Instruction *AfterGuard = Guard->getNextNode();
2737 SmallVector<Instruction *, 4> ToRemove;
2742 Instruction *InsertionPoint = &*BB->getFirstInsertionPt();
2745 for (auto *Inst : reverse(ToRemove)) {
lib/Transforms/Scalar/LICM.cpp 135 static bool isNotUsedOrFreeInLoop(const Instruction &I, const Loop *CurLoop,
138 static void hoist(Instruction &I, const DominatorTree *DT, const Loop *CurLoop,
141 static bool sink(Instruction &I, LoopInfo *LI, DominatorTree *DT,
144 static bool isSafeToExecuteUnconditionally(Instruction &Inst,
149 const Instruction *CtxI = nullptr);
156 static Instruction *CloneInstructionInExitBlock(
157 Instruction &I, BasicBlock &ExitBlock, PHINode &PN, const LoopInfo *LI,
160 static void eraseInstruction(Instruction &I, ICFLoopSafetyInfo &SafetyInfo,
163 static void moveInstructionBefore(Instruction &I, Instruction &Dest,
163 static void moveInstructionBefore(Instruction &I, Instruction &Dest,
415 SmallVector<Instruction *, 8> InsertPts;
523 Instruction &I = *--II;
812 SmallVector<Instruction *, 16> HoistedInstructions;
827 Instruction &I = *II++;
866 if (I.getOpcode() == Instruction::FDiv &&
939 Instruction *HoistPoint = nullptr;
941 for (Instruction *I : reverse(HoistedInstructions)) {
1033 bool isHoistableAndSinkableInst(Instruction &I) {
1063 bool isOnlyMemoryAccess(const Instruction *I, const Loop *L,
1080 bool llvm::canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
1191 auto *UniqueI = Begin->getUniqueInstruction();
1215 auto *UniqueI = AS.getUniqueInstruction();
1289 static bool isTriviallyReplaceablePHI(const PHINode &PN, const Instruction &I) {
1298 static bool isFreeInLoop(const Instruction &I, const Loop *CurLoop,
1309 const Instruction *UI = cast<Instruction>(U);
1309 const Instruction *UI = cast<Instruction>(U);
1326 static bool isNotUsedOrFreeInLoop(const Instruction &I, const Loop *CurLoop,
1332 const Instruction *UI = cast<Instruction>(U);
1332 const Instruction *UI = cast<Instruction>(U);
1358 static Instruction *CloneInstructionInExitBlock(
1359 Instruction &I, BasicBlock &ExitBlock, PHINode &PN, const LoopInfo *LI,
1361 Instruction *New;
1382 Instruction *EHPad = BBColor->getFirstNonPHI();
1419 if (Instruction *OInst = dyn_cast<Instruction>(*OI))
1419 if (Instruction *OInst = dyn_cast<Instruction>(*OI))
1432 static void eraseInstruction(Instruction &I, ICFLoopSafetyInfo &SafetyInfo,
1442 static void moveInstructionBefore(Instruction &I, Instruction &Dest,
1442 static void moveInstructionBefore(Instruction &I, Instruction &Dest,
1454 static Instruction *sinkThroughTriviallyReplaceablePHI(
1455 PHINode *TPN, Instruction *I, LoopInfo *LI,
1456 SmallDenseMap<BasicBlock *, Instruction *, 32> &SunkCopies,
1462 Instruction *New;
1562 static bool sink(Instruction &I, LoopInfo *LI, DominatorTree *DT,
1579 SmallPtrSet<Instruction *, 8> VisitedUsers;
1581 auto *User = cast<Instruction>(*UI);
1581 auto *User = cast<Instruction>(*UI);
1635 SmallDenseMap<BasicBlock *, Instruction *, 32> SunkCopies;
1642 auto *User = cast<Instruction>(UI);
1642 auto *User = cast<Instruction>(UI);
1651 Instruction *New = sinkThroughTriviallyReplaceablePHI(
1663 static void hoist(Instruction &I, const DominatorTree *DT, const Loop *CurLoop,
1706 static bool isSafeToExecuteUnconditionally(Instruction &Inst,
1711 const Instruction *CtxI) {
1737 SmallVectorImpl<Instruction *> &LoopInsertPts;
1750 if (Instruction *I = dyn_cast<Instruction>(V))
1750 if (Instruction *I = dyn_cast<Instruction>(V))
1765 LoopPromoter(Value *SP, ArrayRef<const Instruction *> Insts, SSAUpdater &S,
1779 bool isInstInList(Instruction *I,
1780 const SmallVectorImpl<Instruction *> &) const override {
1799 Instruction *InsertPos = LoopInsertPts[i];
1829 void instructionDeleted(Instruction *I) const override {
1923 SmallVector<Instruction *, 64> LoopUses;
1962 Instruction *UI = dyn_cast<Instruction>(U);
1962 Instruction *UI = dyn_cast<Instruction>(U);
2266 for (Instruction &I : *BB) {
lib/Transforms/Scalar/LoopDataPrefetch.cpp 227 for (auto &I : *BB)
250 SmallVector<std::pair<Instruction *, const SCEVAddRecExpr *>, 16> PrefLoads;
252 for (auto &I : *BB) {
254 Instruction *MemI;
lib/Transforms/Scalar/LoopDeletion.cpp 68 if (Instruction *I = dyn_cast<Instruction>(incoming))
68 if (Instruction *I = dyn_cast<Instruction>(incoming))
lib/Transforms/Scalar/LoopDistribute.cpp 128 using InstructionSet = SmallPtrSet<Instruction *, 8>;
131 InstPartition(Instruction *I, Loop *L, bool DepCycle = false)
140 void add(Instruction *I) { Set.insert(I); }
168 SmallVector<Instruction *, 8> Worklist(Set.begin(), Set.end());
170 Instruction *I = Worklist.pop_back_val();
173 auto *I = dyn_cast<Instruction>(V);
173 auto *I = dyn_cast<Instruction>(V);
216 SmallVector<Instruction *, 8> Unused;
219 for (auto &Inst : *Block)
221 Instruction *NewInst = &Inst;
223 NewInst = cast<Instruction>(VMap[NewInst]);
232 for (auto *Inst : reverse(Unused)) {
242 for (auto *I : Set)
279 using InstToPartitionIdT = DenseMap<Instruction *, int>;
290 void addToCyclicPartition(Instruction *Inst) {
303 void addToNewNonCyclicPartition(Instruction *Inst) {
327 for (auto *Inst : *Partition)
352 using LoadToPartitionT = DenseMap<Instruction *, InstPartition *>;
368 for (Instruction *Inst : *PartI)
419 for (Instruction *Inst : Partition) {
519 for (Instruction *Inst : Instructions) {
622 Instruction *Inst;
625 Entry(Instruction *Inst) : Inst(Inst) {}
634 const SmallVectorImpl<Instruction *> &Instructions,
720 Instruction *I = InstDep.Inst;
739 for (auto *Inst : DefsUsedOutside)
lib/Transforms/Scalar/LoopFuse.cpp 145 SmallVector<Instruction *, 16> MemReads;
147 SmallVector<Instruction *, 16> MemWrites;
186 for (Instruction &I : *BB) {
877 bool accessDiffIsPositive(const Loop &L0, const Loop &L1, Instruction &I0,
878 Instruction &I1, bool EqualIsInvalid) {
932 const FusionCandidate &FC1, Instruction &I0,
933 Instruction &I1, bool AnyDep,
985 for (Instruction *WriteL0 : FC0.MemWrites) {
986 for (Instruction *WriteL1 : FC1.MemWrites)
993 for (Instruction *ReadL1 : FC1.MemReads)
1002 for (Instruction *WriteL1 : FC1.MemWrites) {
1003 for (Instruction *WriteL0 : FC0.MemWrites)
1010 for (Instruction *ReadL0 : FC0.MemReads)
1022 for (Instruction &I : *BB)
1024 if (Instruction *Def = dyn_cast<Instruction>(Op))
1024 if (Instruction *Def = dyn_cast<Instruction>(Op))
1069 dyn_cast<Instruction>(FC0.GuardBranch->getCondition()))
1071 dyn_cast<Instruction>(FC1.GuardBranch->getCondition()))
1091 if (auto *CmpInst = dyn_cast<Instruction>(FC.GuardBranch->getCondition())) {
1091 if (auto *CmpInst = dyn_cast<Instruction>(FC.GuardBranch->getCondition())) {
1228 Instruction *L1HeaderIP = &FC1.Header->front();
1470 Instruction *L1HeaderIP = &FC1.Header->front();
lib/Transforms/Scalar/LoopIdiomRecognize.cpp 205 Instruction *TheStore,
206 SmallPtrSetImpl<Instruction *> &Stores,
246 void transformLoopToPopcount(BasicBlock *PreCondBB, Instruction *CntInst,
250 Instruction *CntInst, PHINode *CntPhi,
251 Value *Var, Instruction *DefX,
341 static void deleteDeadInstruction(Instruction *I) {
581 for (Instruction &I : *BB) {
643 Instruction *Inst = &*I++;
765 SmallPtrSet<Instruction *, 8> AdjacentStores;
846 SmallPtrSet<Instruction *, 1> MSIs;
861 SmallPtrSetImpl<Instruction *> &IgnoredStores) {
881 for (Instruction &I : **BI)
942 Value *StoredVal, Instruction *TheStore,
943 SmallPtrSetImpl<Instruction *> &Stores, const SCEVAddRecExpr *Ev,
1046 for (auto *I : Stores)
1099 SmallPtrSet<Instruction *, 1> Stores;
1251 static PHINode *getRecurrenceVar(Value *VarX, Instruction *DefX,
1285 Instruction *&CntInst, PHINode *&CntPhi,
1290 Instruction *DefX2, *CountInst;
1303 DefX2 = dyn_cast<Instruction>(T);
1310 if (!DefX2 || DefX2->getOpcode() != Instruction::And)
1326 !((SubOneOp->getOpcode() == Instruction::Sub && Dec->isOne()) ||
1327 (SubOneOp->getOpcode() == Instruction::Add &&
1344 Instruction *Inst = &*Iter;
1345 if (Inst->getOpcode() != Instruction::Add)
1359 if ((cast<Instruction>(U))->getParent() != LoopEntry) {
1421 Instruction *&CntInst, PHINode *&CntPhi,
1422 Instruction *&DefX) {
1434 DefX = dyn_cast<Instruction>(T);
1441 IntrinID = DefX->getOpcode() == Instruction::Shl ? Intrinsic::cttz :
1457 if (DefX->getOpcode() == Instruction::AShr && !isKnownNonNegative(InitX, DL))
1469 Instruction *Inst = &*Iter;
1470 if (Inst->getOpcode() != Instruction::Add)
1501 Instruction *DefX = nullptr;
1503 Instruction *CntInst = nullptr;
1514 if (!CurLoop->contains(cast<Instruction>(U))) {
1520 if (!CurLoop->contains(cast<Instruction>(U))) {
1624 Instruction *CntInst;
1693 Intrinsic::ID IntrinID, BasicBlock *Preheader, Instruction *CntInst,
1694 PHINode *CntPhi, Value *InitX, Instruction *DefX, const DebugLoc &DL,
1707 if (DefX->getOpcode() == Instruction::AShr)
1710 else if (DefX->getOpcode() == Instruction::LShr)
1713 else if (DefX->getOpcode() == Instruction::Shl) // cttz
1758 Instruction *TcDec = cast<Instruction>(
1758 Instruction *TcDec = cast<Instruction>(
1784 Instruction *CntInst,
1803 (cast<Instruction>(NewCount))->setDebugLoc(DL);
1813 (cast<Instruction>(NewCount))->setDebugLoc(DL);
1865 Instruction *TcDec = cast<Instruction>(
1865 Instruction *TcDec = cast<Instruction>(
2002 const auto *I =
2003 dyn_cast<Instruction>(PHI.getIncomingValueForBlock(LoopBB));
2017 for (Instruction &I : *LoopBB) {
2613 if (const auto *I = dyn_cast<Instruction>(Load->getPointerOperand()))
2613 if (const auto *I = dyn_cast<Instruction>(Load->getPointerOperand()))
lib/Transforms/Scalar/LoopInstSimplify.cpp 62 SmallPtrSet<const Instruction *, 8> S1, S2, *ToSimplify = &S1, *Next = &S2;
70 SmallVector<Instruction *, 8> DeadInsts;
86 for (Instruction &I : *BB) {
110 auto *UserI = cast<Instruction>(U.getUser());
110 auto *UserI = cast<Instruction>(U.getUser());
137 if (Instruction *SimpleI = dyn_cast_or_null<Instruction>(V))
137 if (Instruction *SimpleI = dyn_cast_or_null<Instruction>(V))
lib/Transforms/Scalar/LoopInterchange.cpp 94 for (Instruction &I : *BB) {
95 if (!isa<Instruction>(I))
117 Instruction *Src = cast<Instruction>(*I);
117 Instruction *Src = cast<Instruction>(*I);
118 Instruction *Dst = cast<Instruction>(*J);
118 Instruction *Dst = cast<Instruction>(*J);
634 Instruction *I = dyn_cast<Instruction>(Val);
634 Instruction *I = dyn_cast<Instruction>(Val);
724 Instruction *Ins = dyn_cast<Instruction>(PHI.getIncomingValue(0));
724 Instruction *Ins = dyn_cast<Instruction>(PHI.getIncomingValue(0));
858 Instruction *InnerIndexVarInc = nullptr;
861 dyn_cast<Instruction>(InnerInductionVar->getIncomingValue(1));
864 dyn_cast<Instruction>(InnerInductionVar->getIncomingValue(0));
884 for (const Instruction &I :
939 Instruction *IncomingI = dyn_cast<Instruction>(PHI.getIncomingValue(i));
939 Instruction *IncomingI = dyn_cast<Instruction>(PHI.getIncomingValue(i));
977 for (Instruction &I : BB->instructionsWithoutDebug())
1033 for (Instruction &Ins : *BB) {
1223 Instruction *InnerIndexVar;
1235 InnerIndexVar = dyn_cast<Instruction>(InductionPHI->getIncomingValue(1));
1237 InnerIndexVar = dyn_cast<Instruction>(InductionPHI->getIncomingValue(0));
1251 SmallSetVector<Instruction *, 4> WorkList;
1257 Instruction *NewI = WorkList[i]->clone();
1265 Instruction *UserI = cast<Instruction>(U.getUser());
1265 Instruction *UserI = cast<Instruction>(U.getUser());
1273 Instruction *OpI = dyn_cast<Instruction>(Op);
1273 Instruction *OpI = dyn_cast<Instruction>(Op);
1284 Instruction *CondI = dyn_cast<Instruction>(
1284 Instruction *CondI = dyn_cast<Instruction>(
1290 WorkList.insert(cast<Instruction>(InnerIndexVar));
1310 static void moveBBContents(BasicBlock *FromBB, Instruction *InsertBefore) {
1356 auto IncI = cast<Instruction>(P.getIncomingValueForBlock(InnerLatch));
1407 auto I = dyn_cast<Instruction>(P.getIncomingValue(0));
lib/Transforms/Scalar/LoopLoadElimination.cpp 187 SmallPtrSet<Instruction *, 4> LoadsWithUnknownDepedence;
190 Instruction *Source = Dep.getSource(LAI);
191 Instruction *Destination = Dep.getDestination(LAI);
232 unsigned getInstrIndex(Instruction *Inst) {
585 DenseMap<Instruction *, unsigned> InstOrder;
lib/Transforms/Scalar/LoopPredication.cpp 267 Instruction *findInsertPt(Instruction *User, ArrayRef<Value*> Ops);
267 Instruction *findInsertPt(Instruction *User, ArrayRef<Value*> Ops);
272 Instruction *findInsertPt(Instruction *User, ArrayRef<const SCEV*> Ops);
272 Instruction *findInsertPt(Instruction *User, ArrayRef<const SCEV*> Ops);
279 Value *expandCheck(SCEVExpander &Expander, Instruction *Guard,
284 Instruction *Guard);
288 Instruction *Guard);
292 Instruction *Guard);
294 SCEVExpander &Expander, Instruction *Guard);
390 Instruction *Guard,
494 Instruction *LoopPredication::findInsertPt(Instruction *Use,
494 Instruction *LoopPredication::findInsertPt(Instruction *Use,
502 Instruction *LoopPredication::findInsertPt(Instruction *Use,
502 Instruction *LoopPredication::findInsertPt(Instruction *Use,
553 SCEVExpander &Expander, Instruction *Guard) {
602 SCEVExpander &Expander, Instruction *Guard) {
665 Instruction *Guard) {
730 Instruction *Guard) {
920 auto *LatchTerm = LatchBlock->getTerminator();
998 for (auto &I : *BB)
lib/Transforms/Scalar/LoopRerollPass.cpp 186 using SmallInstructionVector = SmallVector<Instruction *, 16>;
187 using SmallInstructionSet = SmallPtrSet<Instruction *, 16>;
190 DenseMap<Instruction *, int64_t> IVToIncMap;
194 Instruction *LoopControlIV;
200 SimpleLoopReduction(Instruction *P, Loop *L) : Instructions(1, P) {
209 Instruction *getPHI() const {
214 Instruction *getReducedValue() const {
219 Instruction *get(size_t i) const {
224 Instruction *operator [] (size_t i) const { return get(i); }
286 for (Instruction *J : PossibleReds[i]) {
297 bool isPairInSame(Instruction *J1, Instruction *J2) {
297 bool isPairInSame(Instruction *J1, Instruction *J2) {
298 DenseMap<Instruction *, int>::iterator J1I = PossibleRedIdx.find(J1);
300 DenseMap<Instruction *, int>::iterator J2I = PossibleRedIdx.find(J2);
311 void recordPair(Instruction *J1, Instruction *J2, unsigned i) {
311 void recordPair(Instruction *J1, Instruction *J2, unsigned i) {
336 DenseMap<Instruction *, int> PossibleRedIdx;
337 DenseMap<Instruction *, int> PossibleRedIter;
368 Instruction *BaseInst;
378 DAGRootTracker(LoopReroll *Parent, Loop *L, Instruction *IV,
382 DenseMap<Instruction *, int64_t> &IncrMap,
383 Instruction *LoopCtrlIV)
400 using UsesTy = MapVector<Instruction *, BitVector>;
402 void findRootsRecursive(Instruction *IVU,
404 bool findRootsBase(Instruction *IVU, SmallInstructionSet SubsumedInsts);
405 bool collectPossibleRoots(Instruction *Base,
406 std::map<int64_t,Instruction*> &Roots);
414 void collectInLoopUserSet(Instruction *Root,
422 bool isBaseInst(Instruction *I);
423 bool isRootInst(Instruction *I);
424 bool instrDependsOn(Instruction *I,
441 Instruction *IV;
463 DenseMap<Instruction *, int64_t> &IVToIncMap;
465 Instruction *LoopControlIV;
469 bool isCompareUsedByBranch(Instruction *I) {
470 auto *TI = I->getParent()->getTerminator();
476 bool isLoopControlIV(Loop *L, Instruction *IV);
480 bool reroll(Instruction *IV, Loop *L, BasicBlock *Header,
500 static bool hasUsesOutsideLoop(Instruction *I, Loop *L) {
502 if (!L->contains(cast<Instruction>(U)))
514 bool LoopReroll::isLoopControlIV(Loop *L, Instruction *IV) {
521 bool IsCompInst = isCompareUsedByBranch(cast<Instruction>(User));
541 if (BO->getOpcode() == Instruction::Add) {
551 Instruction *UUser = dyn_cast<Instruction>(UU);
551 Instruction *UUser = dyn_cast<Instruction>(UU);
556 UUser = dyn_cast<Instruction>(*(UUser->user_begin()));
615 Instruction *C = Instructions.front();
620 C = cast<Instruction>(*C->user_begin());
641 if (L->contains(cast<Instruction>(U)))
642 if (cast<Instruction>(U) != Instructions.front())
684 Instruction *Root, const SmallInstructionSet &Exclude,
689 Instruction *I = Queue.pop_back_val();
695 Instruction *User = cast<Instruction>(U.getUser());
695 Instruction *User = cast<Instruction>(U.getUser());
710 if (Instruction *Op = dyn_cast<Instruction>(*OI))
710 if (Instruction *Op = dyn_cast<Instruction>(*OI))
725 for (Instruction *Root : Roots)
729 static bool isUnorderedLoadStore(Instruction *I) {
743 if (Instruction *I = dyn_cast<Instruction>(IVU)) {
743 if (Instruction *I = dyn_cast<Instruction>(IVU)) {
746 case Instruction::Add:
747 case Instruction::Sub:
748 case Instruction::Mul:
749 case Instruction::Shl:
750 case Instruction::AShr:
751 case Instruction::LShr:
752 case Instruction::GetElementPtr:
753 case Instruction::Trunc:
754 case Instruction::ZExt:
755 case Instruction::SExt:
762 static bool isLoopIncrement(User *U, Instruction *IV) {
765 if ((BO && BO->getOpcode() != Instruction::Add) ||
778 collectPossibleRoots(Instruction *Base, std::map<int64_t,Instruction*> &Roots) {
778 collectPossibleRoots(Instruction *Base, std::map<int64_t,Instruction*> &Roots) {
785 LoopIncs.push_back(cast<Instruction>(I));
791 if (BO->getOpcode() == Instruction::Add ||
792 BO->getOpcode() == Instruction::Or)
800 if (Instruction *II = dyn_cast<Instruction>(I)) {
800 if (Instruction *II = dyn_cast<Instruction>(I)) {
815 Roots[V] = cast<Instruction>(I);
854 findRootsRecursive(Instruction *I, SmallInstructionSet SubsumedInsts) {
866 Instruction *I = cast<Instruction>(V);
866 Instruction *I = cast<Instruction>(V);
914 findRootsBase(Instruction *IVU, SmallInstructionSet SubsumedInsts) {
920 std::map<int64_t, Instruction*> V;
972 LoopIncs.push_back(cast<Instruction>(IVU));
1013 for (auto &I : *L->getHeader()) {
1026 DenseSet<Instruction*> VBase;
1028 for (auto *I : VBase) {
1033 for (auto *Root : DRS.Roots) {
1034 DenseSet<Instruction*> V;
1043 for (auto *I : V) {
1050 for (auto *I : DRS.SubsumedInsts) {
1064 DenseSet<Instruction*> V;
1066 for (auto *I : V) {
1087 bool LoopReroll::DAGRootTracker::isBaseInst(Instruction *I) {
1095 bool LoopReroll::DAGRootTracker::isRootInst(Instruction *I) {
1105 bool LoopReroll::DAGRootTracker::instrDependsOn(Instruction *I,
1116 static bool isIgnorableInst(const Instruction *I) {
1161 for (auto *I : PossibleRedPHISet) {
1170 Instruction *IVUser = dyn_cast<Instruction>(U);
1170 Instruction *IVUser = dyn_cast<Instruction>(U);
1174 Instruction *UUser = dyn_cast<Instruction>(UU);
1174 Instruction *UUser = dyn_cast<Instruction>(UU);
1179 UUser = dyn_cast<Instruction>(*(UUser->user_begin()));
1184 Instruction *BI = dyn_cast<BranchInst>(*UUser->user_begin());
1225 Instruction *BaseInst = BaseIt->first;
1226 Instruction *RootInst = RootIt->first;
1283 Instruction *I = LastRootIt->first;
1355 if (Instruction *Op2I = dyn_cast<Instruction>(Op2))
1355 if (Instruction *Op2I = dyn_cast<Instruction>(Op2))
1486 Instruction *Inst = DRS.BaseInst;
1510 for (Instruction *J : PossibleReds[i]) {
1563 Users.push_back(cast<Instruction>(U));
1566 for (Instruction *User : Users)
1615 bool LoopReroll::reroll(Instruction *IV, Loop *L, BasicBlock *Header,
1687 for (Instruction *PossibleIV : PossibleIVs)
lib/Transforms/Scalar/LoopSimplifyCFG.cpp 57 Instruction *TI = BB->getTerminator();
365 SmallVector<Instruction *, 4> DeadPhis;
370 for (Instruction *PN : DeadPhis) {
511 Instruction *Term = BB->getTerminator();
lib/Transforms/Scalar/LoopSink.cpp 174 static bool sinkInstruction(Loop &L, Instruction &I,
182 Instruction *UI = cast<Instruction>(U.getUser());
182 Instruction *UI = cast<Instruction>(U.getUser());
229 Instruction *IC = I.clone();
234 return cast<Instruction>(U.getUser())->getParent() == N;
298 Instruction *I = &*II++;
lib/Transforms/Scalar/LoopStrengthReduce.cpp 798 Instruction *Inst, Value *OperandVal) {
838 Instruction *Inst, Value *OperandVal) {
945 Instruction *UI = dyn_cast<Instruction>(UR);
945 Instruction *UI = dyn_cast<Instruction>(UR);
946 if (UI && UI->getOpcode() == Instruction::Mul &&
972 Instruction *I = dyn_cast_or_null<Instruction>(V);
972 Instruction *I = dyn_cast_or_null<Instruction>(V);
978 if (Instruction *U = dyn_cast<Instruction>(O)) {
978 if (Instruction *U = dyn_cast<Instruction>(O)) {
1077 Instruction *UserInst = nullptr;
1213 Instruction *Fixup = nullptr);
1632 Instruction *Fixup/*= nullptr*/) {
1856 Instruction *UserInst;
1860 IVInc(Instruction *U, Value *O, const SCEV *E)
1892 Instruction *tailUserInst() const { return Incs.back().UserInst; }
1904 SmallPtrSet<Instruction*, 4> FarUsers;
1905 SmallPtrSet<Instruction*, 4> NearUsers;
1925 Instruction *IVIncInsertPos = nullptr;
1960 void ChainInstruction(Instruction *UserInst, Instruction *IVOper,
1960 void ChainInstruction(Instruction *UserInst, Instruction *IVOper,
2034 const SmallVectorImpl<Instruction *> &Inputs) const;
2079 Instruction *ShadowUse = CandidateUI->getUser();
2145 if (Incr->getOpcode() != Instruction::Add
2146 && Incr->getOpcode() != Instruction::Sub)
2170 BinaryOperator::Create(Incr->getOpcode() == Instruction::Add ?
2171 Instruction::FAdd : Instruction::FSub,
2171 Instruction::FAdd : Instruction::FSub,
2348 Instruction *Cmp = cast<Instruction>(Sel->getOperand(0));
2348 Instruction *Cmp = cast<Instruction>(Sel->getOperand(0));
2359 SmallPtrSet<Instruction *, 4> PostIncs;
2505 for (Instruction *Inst : PostIncs) {
2721 if (Instruction *Oper = dyn_cast<Instruction>(*OI)) {
2721 if (Instruction *Oper = dyn_cast<Instruction>(*OI)) {
2833 isProfitableChain(IVChain &Chain, SmallPtrSetImpl<Instruction*> &Users,
2904 void LSRInstance::ChainInstruction(Instruction *UserInst, Instruction *IVOper,
2904 void LSRInstance::ChainInstruction(Instruction *UserInst, Instruction *IVOper,
2974 SmallPtrSet<Instruction*,4> &NearUsers = ChainUsersVec[ChainIdx].NearUsers;
2988 Instruction *OtherUse = dyn_cast<Instruction>(U);
2988 Instruction *OtherUse = dyn_cast<Instruction>(U);
3051 for (Instruction &I : *BB) {
3068 SmallPtrSet<Instruction*, 4> UniqueOperands;
3072 Instruction *IVOpInst = cast<Instruction>(*IVOpIter);
3072 Instruction *IVOpInst = cast<Instruction>(*IVOpIter);
3084 Instruction *IncV =
3085 dyn_cast<Instruction>(PN.getIncomingValueForBlock(L->getLoopLatch()));
3118 static bool canFoldIVIncExpr(const SCEV *IncExpr, Instruction *UserInst,
3177 Instruction *InsertPt = Inc.UserInst;
3222 Instruction *PostIncV = dyn_cast<Instruction>(
3222 Instruction *PostIncV = dyn_cast<Instruction>(
3245 Instruction *UserInst = U.getUser();
3409 if (const Instruction *Inst = dyn_cast<Instruction>(V)) {
3409 if (const Instruction *Inst = dyn_cast<Instruction>(V)) {
3416 const Instruction *UserInst = dyn_cast<Instruction>(U.getUser());
3416 const Instruction *UserInst = dyn_cast<Instruction>(U.getUser());
5007 const SmallVectorImpl<Instruction *> &Inputs)
5009 Instruction *Tentative = &*IP;
5012 Instruction *BetterPos = nullptr;
5018 for (Instruction *Inst : Inputs) {
5070 SmallVector<Instruction *, 4> Inputs;
5071 if (Instruction *I = dyn_cast<Instruction>(LF.OperandValToReplace))
5071 if (Instruction *I = dyn_cast<Instruction>(LF.OperandValToReplace))
5074 if (Instruction *I =
5075 dyn_cast<Instruction>(cast<ICmpInst>(LF.UserInst)->getOperand(1)))
5275 Instruction *Cast =
5434 Instruction *Cast =
5523 auto *FirstNonPHI = PN->getParent()->getFirstNonPHI();
lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp 258 for (Instruction &I : *BB) {
lib/Transforms/Scalar/LoopUnrollPass.cpp 280 Instruction *I;
288 using PtrInfo = DenseMapInfo<Instruction *>;
289 using PairInfo = DenseMapInfo<std::pair<Instruction *, int>>;
378 SmallVector<Instruction *, 16> CostWorklist;
381 SmallVector<Instruction *, 4> PHIUsedList;
391 Instruction *I = CostWorklist.pop_back_val();
420 if (auto *OpI = dyn_cast<Instruction>(
420 if (auto *OpI = dyn_cast<Instruction>(
441 auto *OpI = dyn_cast<Instruction>(Op);
441 auto *OpI = dyn_cast<Instruction>(Op);
478 for (Instruction &I : *L->getHeader()) {
514 for (Instruction &I : *BB) {
562 Instruction *TI = BB->getTerminator();
620 for (Instruction &I : *ExitBB) {
626 if (auto *OpI = dyn_cast<Instruction>(Op))
626 if (auto *OpI = dyn_cast<Instruction>(Op))
lib/Transforms/Scalar/LoopUnswitch.cpp 248 Instruction *TI = nullptr);
250 BasicBlock *ExitBlock, Instruction *TI);
252 Instruction *TI);
260 BranchInst *OldBranch, Instruction *TI);
262 void SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L);
266 Value *SimplifyInstructionWithNotEqual(Instruction *Inst, Value *Invariant,
449 if (BO->getOpcode() == Instruction::And ||
450 BO->getOpcode() == Instruction::Or) {
455 NewChain = BO->getOpcode() == Instruction::And ? OC_OpChainAnd :
459 NewChain = BO->getOpcode() == Instruction::Or ? OC_OpChainOr :
463 NewChain = BO->getOpcode() == Instruction::And ? OC_OpChainAnd :
683 for (auto &I : *BB) {
716 Instruction *TI = (*I)->getTerminator();
858 for (Instruction &I : *BB)
881 Instruction *TI) {
936 Instruction *TI) {
1001 Instruction *TI) {
1059 Instruction *CurrentTerm = CurrentBB->getTerminator();
1089 for (Instruction &I : *CurrentBB)
1234 Loop *L, Instruction *TI) {
1343 for (Instruction &I : *NewBlocks[i]) {
1406 static void RemoveFromWorklist(Instruction *I,
1407 std::vector<Instruction*> &Worklist) {
1415 static void ReplaceUsesOfWith(Instruction *I, Value *V,
1416 std::vector<Instruction *> &Worklist, Loop *L,
1422 if (Instruction *Use = dyn_cast<Instruction>(I->getOperand(i)))
1422 if (Instruction *Use = dyn_cast<Instruction>(I->getOperand(i)))
1427 Worklist.push_back(cast<Instruction>(U));
1456 std::vector<Instruction*> Worklist;
1471 Instruction *UI = dyn_cast<Instruction>(U);
1471 Instruction *UI = dyn_cast<Instruction>(U);
1477 for (Instruction *UI : Worklist)
1488 Instruction *UI = dyn_cast<Instruction>(U);
1488 Instruction *UI = dyn_cast<Instruction>(U);
1581 void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist, Loop *L) {
1584 Instruction *I = Worklist.back();
1593 if (Instruction *Use = dyn_cast<Instruction>(I->getOperand(i)))
1593 if (Instruction *Use = dyn_cast<Instruction>(I->getOperand(i)))
1632 if (Instruction *Use = dyn_cast<Instruction>(PN->getOperand(It)))
1632 if (Instruction *Use = dyn_cast<Instruction>(PN->getOperand(It)))
1635 Worklist.push_back(cast<Instruction>(U));
1654 Value *LoopUnswitch::SimplifyInstructionWithNotEqual(Instruction *Inst,
lib/Transforms/Scalar/LoopVersioningLICM.cpp 208 bool instructionSafeForVersioning(Instruction *I);
329 bool LoopVersioningLICM::instructionSafeForVersioning(Instruction *I) {
393 for (auto &Inst : *Block) {
537 Instruction *I = VerLoop->getLoopLatch()->getTerminator();
547 for (auto &Inst : *Block) {
lib/Transforms/Scalar/LowerAtomic.cpp 120 Instruction *Inst = &*DI++;
lib/Transforms/Scalar/LowerConstantIntrinsics.cpp 49 static bool replaceConditionalBranchesOnConstant(Instruction *II,
52 SmallSetVector<Instruction *, 8> Worklist;
92 for (Instruction &I: *BB) {
lib/Transforms/Scalar/LowerExpectIntrinsic.cpp 117 SmallVector<Instruction *, 4> Operations;
132 if (!BinOp || BinOp->getOpcode() != Instruction::Xor)
148 case Instruction::Xor:
151 case Instruction::ZExt:
154 case Instruction::SExt:
338 Instruction *Inst = &*BI++;
lib/Transforms/Scalar/LowerGuardIntrinsic.cpp 51 for (auto &I : instructions(F))
lib/Transforms/Scalar/LowerWidenableCondition.cpp 52 for (auto &I : instructions(F))
lib/Transforms/Scalar/MakeGuardsExplicit.cpp 88 for (auto &I : instructions(F))
lib/Transforms/Scalar/MemCpyOptimizer.cpp 97 SmallVector<Instruction*, 16> TheStores;
113 for (Instruction *SI : TheStores)
165 void addInst(int64_t OffsetFromFirst, Instruction *Inst) {
185 unsigned Alignment, Instruction *Inst);
194 unsigned Alignment, Instruction *Inst) {
304 Instruction *MemCpyOptPass::tryMergingIntoMemset(Instruction *StartInst,
304 Instruction *MemCpyOptPass::tryMergingIntoMemset(Instruction *StartInst,
377 Instruction *AMemSet = nullptr;
409 for (Instruction *SI : Range.TheStores) {
444 static bool moveUp(AliasAnalysis &AA, StoreInst *SI, Instruction *P,
453 DenseSet<Instruction*> Args;
454 if (auto *Ptr = dyn_cast<Instruction>(SI->getPointerOperand()))
454 if (auto *Ptr = dyn_cast<Instruction>(SI->getPointerOperand()))
459 SmallVector<Instruction*, 8> ToLift;
470 auto *C = &*I;
516 if (auto *A = dyn_cast<Instruction>(C->getOperand(k))) {
516 if (auto *A = dyn_cast<Instruction>(C->getOperand(k))) {
526 for (auto *I : llvm::reverse(ToLift)) {
562 Instruction *P = SI;
563 for (auto &I : make_range(++LI->getIterator(), SI->getIterator())) {
592 Instruction *M;
673 if (Instruction *I = tryMergingIntoMemset(SI, SI->getPointerOperand(),
711 if (Instruction *I = tryMergingIntoMemset(MSI, MSI->getDest(),
722 bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpy, Value *cpyDest,
854 if (Instruction *cpyDestInst = dyn_cast<Instruction>(cpyDest))
854 if (Instruction *cpyDestInst = dyn_cast<Instruction>(cpyDest))
1069 static bool hasUndefContents(Instruction *I, ConstantInt *Size) {
1349 Instruction *I = &*BI++;
lib/Transforms/Scalar/MergeICmps.cpp 69 static bool isSimpleLoadOrStore(const Instruction *I) {
224 bool canSinkBCECmpInst(const Instruction *, DenseSet<Instruction *> &,
224 bool canSinkBCECmpInst(const Instruction *, DenseSet<Instruction *> &,
247 bool BCECmpBlock::canSinkBCECmpInst(const Instruction *Inst,
248 DenseSet<Instruction *> &BlockInsts,
273 DenseSet<Instruction *> BlockInsts(
275 llvm::SmallVector<Instruction *, 4> OtherInsts;
276 for (Instruction &Inst : *BB) {
287 for (Instruction *Inst : reverse(OtherInsts)) {
293 DenseSet<Instruction *> BlockInsts(
295 for (Instruction &Inst : *BB) {
307 DenseSet<Instruction *> BlockInsts(
313 for (const Instruction &Inst : *BB) {
lib/Transforms/Scalar/MergedLoadStoreMotion.cpp 119 bool isStoreSinkBarrierInRange(const Instruction &Start,
120 const Instruction &End, MemoryLocation Loc);
171 bool MergedLoadStoreMotion::isStoreSinkBarrierInRange(const Instruction &Start,
172 const Instruction &End,
174 for (const Instruction &Inst :
190 for (Instruction &Inst : reverse(*BB1)) {
230 auto *A0 = dyn_cast<Instruction>(S0->getPointerOperand());
230 auto *A0 = dyn_cast<Instruction>(S0->getPointerOperand());
231 auto *A1 = dyn_cast<Instruction>(S1->getPointerOperand());
231 auto *A1 = dyn_cast<Instruction>(S1->getPointerOperand());
245 auto *A0 = dyn_cast<Instruction>(S0->getPointerOperand());
245 auto *A0 = dyn_cast<Instruction>(S0->getPointerOperand());
246 auto *A1 = dyn_cast<Instruction>(S1->getPointerOperand());
246 auto *A1 = dyn_cast<Instruction>(S1->getPointerOperand());
258 Instruction *ANew = A0->clone();
309 Instruction *I = &*RBI;
lib/Transforms/Scalar/NaryReassociate.cpp 216 static bool isPotentiallyNaryReassociable(Instruction *I) {
218 case Instruction::Add:
219 case Instruction::GetElementPtr:
220 case Instruction::Mul:
238 if (Instruction *NewI = tryReassociate(&*I)) {
285 Instruction *NaryReassociatePass::tryReassociate(Instruction *I) {
285 Instruction *NaryReassociatePass::tryReassociate(Instruction *I) {
287 case Instruction::Add:
288 case Instruction::Mul:
290 case Instruction::GetElementPtr:
306 Instruction *NaryReassociatePass::tryReassociateGEP(GetElementPtrInst *GEP) {
436 Instruction *NaryReassociatePass::tryReassociateBinaryOp(BinaryOperator *I) {
441 if (auto *NewI = tryReassociateBinaryOp(LHS, RHS, I))
443 if (auto *NewI = tryReassociateBinaryOp(RHS, LHS, I))
448 Instruction *NaryReassociatePass::tryReassociateBinaryOp(Value *LHS, Value *RHS,
459 if (auto *NewI =
464 if (auto *NewI =
472 Instruction *NaryReassociatePass::tryReassociatedBinaryOp(const SCEV *LHSExpr,
477 auto *LHS = findClosestMatchingDominator(LHSExpr, I);
481 Instruction *NewI = nullptr;
483 case Instruction::Add:
486 case Instruction::Mul:
499 case Instruction::Add:
501 case Instruction::Mul:
513 case Instruction::Add:
515 case Instruction::Mul:
523 Instruction *
525 Instruction *Dominatee) {
540 Instruction *CandidateInstruction = cast<Instruction>(Candidate);
540 Instruction *CandidateInstruction = cast<Instruction>(Candidate);
lib/Transforms/Scalar/NewGVN.cpp 190 void Start(const Instruction *Start) {
204 void FindSCC(const Instruction *I) {
209 if (auto *InstOp = dyn_cast<Instruction>(Op)) {
209 if (auto *InstOp = dyn_cast<Instruction>(Op)) {
531 SmallPtrSet<const Instruction *, 8> PHINodeUses;
551 DenseMap<const Expression *, SmallPtrSet<Instruction *, 2>>
555 DenseMap<const Instruction *, MemoryUseOrDef *> TempToMemory;
561 DenseSet<Instruction *> AllTempInstructions;
576 mutable DenseMap<const Value *, SmallPtrSet<Instruction *, 2>>
605 mutable DenseMap<const Instruction *, InstCycleState> InstCycleState;
654 SmallPtrSet<Instruction *, 8> InstructionsToErase;
668 const Expression *createExpression(Instruction *) const;
670 Instruction *) const;
676 PHIExpression *createPHIExpression(ArrayRef<ValPair>, const Instruction *,
683 const UnknownExpression *createUnknownExpression(Instruction *) const;
691 createAggregateValueExpression(Instruction *) const;
692 bool setBasicExpressionInfo(Instruction *, BasicExpression *) const;
722 const Expression *makePossiblePHIOfOps(Instruction *,
724 Value *findLeaderForInst(Instruction *ValueOp,
726 MemoryAccess *MemAccess, Instruction *OrigInst,
730 SmallVectorImpl<Instruction *> &Worklist);
733 void addPhiOfOps(PHINode *Op, BasicBlock *BB, Instruction *ExistingValue);
734 void removePhiOfOps(Instruction *I, PHINode *PHITemp);
738 void valueNumberInstruction(Instruction *);
741 const Expression *checkSimplificationResults(Expression *, Instruction *,
746 Instruction *,
748 const Expression *performSymbolicLoadEvaluation(Instruction *) const;
749 const Expression *performSymbolicStoreEvaluation(Instruction *) const;
750 const Expression *performSymbolicCallEvaluation(Instruction *) const;
753 Instruction *I,
755 const Expression *performSymbolicAggrValueEvaluation(Instruction *) const;
756 const Expression *performSymbolicCmpEvaluation(Instruction *) const;
757 const Expression *performSymbolicPredicateInfoEvaluation(Instruction *) const;
760 bool someEquivalentDominates(const Instruction *, const Instruction *) const;
760 bool someEquivalentDominates(const Instruction *, const Instruction *) const;
763 void performCongruenceFinding(Instruction *, const Expression *);
764 void moveValueToNewCongruenceClass(Instruction *, const Expression *,
766 void moveMemoryToNewCongruenceClass(Instruction *, MemoryAccess *,
781 void processOutgoingEdges(Instruction *, BasicBlock *);
789 SmallPtrSetImpl<Instruction *> &) const;
794 void replaceInstruction(Instruction *, Value *);
795 void markInstructionForDeletion(Instruction *);
797 Value *findPHIOfOpsLeader(const Expression *, const Instruction *,
801 void handleNewInstruction(Instruction *) {}
811 void markPredicateUsersTouched(Instruction *);
815 void addPredicateUsers(const PredicateBase *, Instruction *) const;
833 MemoryUseOrDef *getMemoryAccess(const Instruction *) const;
860 bool isCycleFree(const Instruction *) const;
905 MemoryUseOrDef *NewGVN::getMemoryAccess(const Instruction *I) const {
917 if (auto *I = dyn_cast<Instruction>(V)) {
917 if (auto *I = dyn_cast<Instruction>(V)) {
982 const Instruction *I,
991 E->setOpcode(Instruction::PHI);
1017 bool NewGVN::setBasicExpressionInfo(Instruction *I, BasicExpression *E) const {
1039 Instruction *I) const {
1045 if (Instruction::isCommutative(Opcode)) {
1066 Instruction *I,
1123 const Expression *NewGVN::createExpression(Instruction *I) const {
1201 NewGVN::createAggregateValueExpression(Instruction *I) const {
1244 const UnknownExpression *NewGVN::createUnknownExpression(Instruction *I) const {
1260 bool NewGVN::someEquivalentDominates(const Instruction *Inst,
1261 const Instruction *U) const {
1283 if (DT->dominates(cast<Instruction>(CC->getLeader()), U))
1286 DT->dominates(cast<Instruction>(CC->getNextLeader().first), U))
1290 DT->dominates(cast<Instruction>(Member), U);
1363 const Expression *NewGVN::performSymbolicStoreEvaluation(Instruction *I) const {
1416 LoadInst *LI, Instruction *DepInst,
1490 const Expression *NewGVN::performSymbolicLoadEvaluation(Instruction *I) const {
1508 Instruction *DefiningInst = MD->getMemoryInst();
1533 NewGVN::performSymbolicPredicateInfoEvaluation(Instruction *I) const {
1628 const Expression *NewGVN::performSymbolicCallEvaluation(Instruction *I) const {
1708 bool NewGVN::isCycleFree(const Instruction *I) const {
1739 Instruction *I,
1800 if (auto *AllSameInst = dyn_cast<Instruction>(AllSameValue))
1800 if (auto *AllSameInst = dyn_cast<Instruction>(AllSameValue))
1807 if (isa<Instruction>(AllSameValue) &&
1820 NewGVN::performSymbolicAggrValueEvaluation(Instruction *I) const {
1834 const Expression *NewGVN::performSymbolicCmpEvaluation(Instruction *I) const {
1967 auto *I = cast<Instruction>(V);
1967 auto *I = cast<Instruction>(V);
1969 case Instruction::ExtractValue:
1970 case Instruction::InsertValue:
1973 case Instruction::PHI: {
1982 case Instruction::Call:
1985 case Instruction::Store:
1988 case Instruction::Load:
1991 case Instruction::BitCast:
1992 case Instruction::AddrSpaceCast:
1995 case Instruction::ICmp:
1996 case Instruction::FCmp:
1999 case Instruction::FNeg:
2000 case Instruction::Add:
2001 case Instruction::FAdd:
2002 case Instruction::Sub:
2003 case Instruction::FSub:
2004 case Instruction::Mul:
2005 case Instruction::FMul:
2006 case Instruction::UDiv:
2007 case Instruction::SDiv:
2008 case Instruction::FDiv:
2009 case Instruction::URem:
2010 case Instruction::SRem:
2011 case Instruction::FRem:
2012 case Instruction::Shl:
2013 case Instruction::LShr:
2014 case Instruction::AShr:
2015 case Instruction::And:
2016 case Instruction::Or:
2017 case Instruction::Xor:
2018 case Instruction::Trunc:
2019 case Instruction::ZExt:
2020 case Instruction::SExt:
2021 case Instruction::FPToUI:
2022 case Instruction::FPToSI:
2023 case Instruction::UIToFP:
2024 case Instruction::SIToFP:
2025 case Instruction::FPTrunc:
2026 case Instruction::FPExt:
2027 case Instruction::PtrToInt:
2028 case Instruction::IntToPtr:
2029 case Instruction::Select:
2030 case Instruction::ExtractElement:
2031 case Instruction::InsertElement:
2032 case Instruction::ShuffleVector:
2033 case Instruction::GetElementPtr:
2067 if (isa<Instruction>(To))
2098 void NewGVN::addPredicateUsers(const PredicateBase *PB, Instruction *I) const {
2110 void NewGVN::markPredicateUsersTouched(Instruction *I) {
2124 if (auto *I = dyn_cast<Instruction>(M))
2124 if (auto *I = dyn_cast<Instruction>(M))
2199 void NewGVN::moveMemoryToNewCongruenceClass(Instruction *I,
2239 void NewGVN::moveValueToNewCongruenceClass(Instruction *I, const Expression *E,
2332 void NewGVN::performCongruenceFinding(Instruction *I, const Expression *E) {
2470 void NewGVN::processOutgoingEdges(Instruction *TI, BasicBlock *B) {
2477 if (auto *I = dyn_cast<Instruction>(Cond)) {
2477 if (auto *I = dyn_cast<Instruction>(Cond)) {
2549 void NewGVN::removePhiOfOps(Instruction *I, PHINode *PHITemp) {
2563 Instruction *ExistingValue) {
2571 if (auto *UI = dyn_cast<Instruction>(U))
2571 if (auto *UI = dyn_cast<Instruction>(U))
2575 static bool okayForPHIOfOps(const Instruction *I) {
2585 SmallVectorImpl<Instruction *> &Worklist) {
2587 if (!isa<Instruction>(V))
2605 auto *OrigI = cast<Instruction>(V);
2605 auto *OrigI = cast<Instruction>(V);
2607 if (!isa<Instruction>(Op))
2620 Worklist.push_back(cast<Instruction>(Op));
2634 SmallVector<Instruction *, 4> Worklist;
2638 auto *I = Worklist.pop_back_val();
2651 Value *NewGVN::findLeaderForInst(Instruction *TransInst,
2653 MemoryAccess *MemAccess, Instruction *OrigInst,
2687 NewGVN::makePossiblePHIOfOps(Instruction *I,
2760 Instruction *ValueOp = I->clone();
2897 for (auto &I : *BB) {
2900 if (auto *UInst = dyn_cast<Instruction>(U))
2900 if (auto *UInst = dyn_cast<Instruction>(U))
2929 SmallVector<Instruction *, 8> TempInst(AllTempInstructions.begin(),
2935 for (auto *I : TempInst) {
2940 auto *I = TempInst.back();
2985 for (auto &I : *B) {
3078 void NewGVN::valueNumberInstruction(Instruction *I) {
3206 if (auto *I = dyn_cast<Instruction>(&*U)) {
3206 if (auto *I = dyn_cast<Instruction>(&*U)) {
3271 if (auto *I = dyn_cast<Instruction>(KV.first))
3271 if (auto *I = dyn_cast<Instruction>(KV.first))
3284 if (auto *I = dyn_cast<Instruction>(KV.first))
3284 if (auto *I = dyn_cast<Instruction>(KV.first))
3392 } else if (auto *I = dyn_cast<Instruction>(V)) {
3392 } else if (auto *I = dyn_cast<Instruction>(V)) {
3472 for (Instruction *ToErase : InstructionsToErase) {
3562 SmallPtrSetImpl<Instruction *> &ProbablyDead) const {
3589 Instruction *Def = cast<Instruction>(D);
3589 Instruction *Def = cast<Instruction>(D);
3607 if (auto *I = dyn_cast<Instruction>(U.getUser())) {
3607 if (auto *I = dyn_cast<Instruction>(U.getUser())) {
3665 if (auto *I = dyn_cast<Instruction>(D))
3665 if (auto *I = dyn_cast<Instruction>(D))
3674 static void patchAndReplaceAllUsesWith(Instruction *I, Value *Repl) {
3690 Instruction &Inst = *I++;
3706 void NewGVN::markInstructionForDeletion(Instruction *I) {
3711 void NewGVN::replaceInstruction(Instruction *I, Value *V) {
3773 const Instruction *OrigInst,
3791 auto *MemberInst = dyn_cast<Instruction>(Member);
3791 auto *MemberInst = dyn_cast<Instruction>(Member);
3878 SmallPtrSet<Instruction *, 8> ProbablyDead;
3886 markInstructionForDeletion(cast<Instruction>(M));
3907 if (Member == Leader || !isa<Instruction>(Member) ||
3914 auto *I = cast<Instruction>(Member);
3914 auto *I = cast<Instruction>(Member);
3944 auto *DefInst = dyn_cast_or_null<Instruction>(Def);
3944 auto *DefInst = dyn_cast_or_null<Instruction>(Def);
4013 isa<Instruction>(Def) && !FromStore)
4014 markInstructionForDeletion(cast<Instruction>(Def));
4029 Instruction *InstUse = cast<Instruction>(U->getUser());
4029 Instruction *InstUse = cast<Instruction>(U->getUser());
4033 ProbablyDead.insert(cast<Instruction>(U->get()));
4059 auto *ReplacedInst = cast<Instruction>(U->get());
4059 auto *ReplacedInst = cast<Instruction>(U->get());
4068 if (LeaderUseCount == 0 && isa<Instruction>(DominatingLeader))
4069 ProbablyDead.erase(cast<Instruction>(DominatingLeader));
4085 for (auto *I : ProbablyDead)
4092 if (!isa<Instruction>(Member) ||
4093 !InstructionsToErase.count(cast<Instruction>(Member)))
4105 Instruction *Member = cast<Instruction>(VD.Def.getPointer());
4105 Instruction *Member = cast<Instruction>(VD.Def.getPointer());
4119 Instruction *Leader = cast<Instruction>(EliminationStack.back());
4119 Instruction *Leader = cast<Instruction>(EliminationStack.back());
lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp 65 Instruction *LibCall = Call->clone();
lib/Transforms/Scalar/PlaceSafepoints.cpp 106 std::vector<Instruction *> PollLocations;
179 InsertSafepointPoll(Instruction *InsertBefore,
216 for (Instruction &I : *Current) {
265 static void scanOneBB(Instruction *Start, Instruction *End,
265 static void scanOneBB(Instruction *Start, Instruction *End,
292 static void scanInlinedCode(Instruction *Start, Instruction *End,
292 static void scanInlinedCode(Instruction *Start, Instruction *End,
348 Instruction *Term = Pred->getTerminator();
383 static Instruction *findLocationForEntrySafepoint(Function &F,
412 Instruction *Cursor = nullptr;
498 SmallVector<Instruction *, 16> PollsNeeded;
534 for (Instruction *Term : PollLocations) {
576 if (Instruction *Location = findLocationForEntrySafepoint(F, DT)) {
587 for (Instruction *PollLocation : PollsNeeded) {
620 InsertSafepointPoll(Instruction *InsertBefore,
lib/Transforms/Scalar/Reassociate.cpp 75 static void PrintOps(Instruction *I, const SmallVectorImpl<ValueEntry> &Ops) {
77 dbgs() << Instruction::getOpcodeName(I->getOpcode()) << " "
120 Instruction *I = dyn_cast<Instruction>(V);
120 Instruction *I = dyn_cast<Instruction>(V);
123 if (I && (I->getOpcode() == Instruction::Or ||
124 I->getOpcode() == Instruction::And)) {
134 isOr = (I->getOpcode() == Instruction::Or);
148 auto *I = dyn_cast<Instruction>(V);
148 auto *I = dyn_cast<Instruction>(V);
157 auto *I = dyn_cast<Instruction>(V);
157 auto *I = dyn_cast<Instruction>(V);
183 for (Instruction &I : *BB)
190 Instruction *I = dyn_cast<Instruction>(V);
190 Instruction *I = dyn_cast<Instruction>(V);
220 void ReassociatePass::canonicalizeOperands(Instruction *I) {
233 Instruction *InsertBefore, Value *FlagsOp) {
245 Instruction *InsertBefore, Value *FlagsOp) {
257 Instruction *InsertBefore, Value *FlagsOp) {
268 static BinaryOperator *LowerNegateToMultiply(Instruction *Neg) {
321 if (Instruction::isIdempotent(Opcode)) {
328 if (Instruction::isNilpotent(Opcode)) {
334 if (Opcode == Instruction::Add || Opcode == Instruction::FAdd) {
334 if (Opcode == Instruction::Add || Opcode == Instruction::FAdd) {
451 static bool LinearizeExprTree(Instruction *I,
471 SmallVector<std::pair<Instruction*, APInt>, 8> Worklist; // (Op, Weight)
498 std::pair<Instruction*, APInt> P = Worklist.pop_back_val();
581 if (Instruction *Tmp = dyn_cast<Instruction>(Op))
581 if (Instruction *Tmp = dyn_cast<Instruction>(Op))
582 if ((Opcode == Instruction::Mul && match(Tmp, m_Neg(m_Value()))) ||
583 (Opcode == Instruction::FMul && match(Tmp, m_FNeg(m_Value())))) {
815 static Value *NegateValue(Value *V, Instruction *BI,
831 isReassociableOp(V, Instruction::Add, Instruction::FAdd)) {
831 isReassociableOp(V, Instruction::Add, Instruction::FAdd)) {
835 if (I->getOpcode() == Instruction::Add) {
864 Instruction *TheNeg = cast<Instruction>(U);
864 Instruction *TheNeg = cast<Instruction>(U);
873 if (Instruction *InstInput = dyn_cast<Instruction>(V)) {
873 if (Instruction *InstInput = dyn_cast<Instruction>(V)) {
904 if (TheNeg->getOpcode() == Instruction::Sub) {
922 static bool ShouldBreakUpSubtract(Instruction *Sub) {
934 if (isReassociableOp(V0, Instruction::Add, Instruction::FAdd) ||
934 if (isReassociableOp(V0, Instruction::Add, Instruction::FAdd) ||
935 isReassociableOp(V0, Instruction::Sub, Instruction::FSub))
935 isReassociableOp(V0, Instruction::Sub, Instruction::FSub))
938 if (isReassociableOp(V1, Instruction::Add, Instruction::FAdd) ||
938 if (isReassociableOp(V1, Instruction::Add, Instruction::FAdd) ||
939 isReassociableOp(V1, Instruction::Sub, Instruction::FSub))
939 isReassociableOp(V1, Instruction::Sub, Instruction::FSub))
943 (isReassociableOp(VB, Instruction::Add, Instruction::FAdd) ||
943 (isReassociableOp(VB, Instruction::Add, Instruction::FAdd) ||
944 isReassociableOp(VB, Instruction::Sub, Instruction::FSub)))
944 isReassociableOp(VB, Instruction::Sub, Instruction::FSub)))
952 static BinaryOperator *BreakUpSubtract(Instruction *Sub,
975 static BinaryOperator *ConvertShiftToMul(Instruction *Shl) {
1009 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op))
1009 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op))
1010 if (Instruction *I2 = dyn_cast<Instruction>(X))
1010 if (Instruction *I2 = dyn_cast<Instruction>(X))
1018 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op))
1018 if (Instruction *I1 = dyn_cast<Instruction>(Ops[j].Op))
1019 if (Instruction *I2 = dyn_cast<Instruction>(X))
1019 if (Instruction *I2 = dyn_cast<Instruction>(X))
1028 static Value *EmitAddTreeOfValues(Instruction *I,
1042 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul);
1042 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul);
1117 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul);
1117 BinaryOperator *BO = isReassociableOp(V, Instruction::Mul, Instruction::FMul);
1142 if (Opcode == Instruction::And) // ...&X&~X = 0
1145 if (Opcode == Instruction::Or) // ...|X|~X = -1
1154 if (Opcode == Instruction::And || Opcode == Instruction::Or) {
1154 if (Opcode == Instruction::And || Opcode == Instruction::Or) {
1181 static Value *createAndInstr(Instruction *InsertBefore, Value *Opnd,
1189 Instruction *I = BinaryOperator::CreateAnd(
1202 bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1,
1223 if (Instruction *T = dyn_cast<Instruction>(Opnd1->getValue()))
1223 if (Instruction *T = dyn_cast<Instruction>(Opnd1->getValue()))
1236 bool ReassociatePass::CombineXorOpnd(Instruction *I, XorOpnd *Opnd1,
1300 if (Instruction *T = dyn_cast<Instruction>(Opnd1->getValue()))
1300 if (Instruction *T = dyn_cast<Instruction>(Opnd1->getValue()))
1302 if (Instruction *T = dyn_cast<Instruction>(Opnd2->getValue()))
1302 if (Instruction *T = dyn_cast<Instruction>(Opnd2->getValue()))
1311 Value *ReassociatePass::OptimizeXor(Instruction *I,
1313 if (Value *V = OptimizeAndOrXor(Instruction::Xor, Ops))
1434 Value *ReassociatePass::OptimizeAdd(Instruction *I,
1462 Instruction *Mul = CreateMul(TheOp, C, "factor", I, I);
1533 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul);
1533 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul);
1596 Instruction *DummyInst =
1605 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul);
1605 isReassociableOp(Ops[i].Op, Instruction::Mul, Instruction::FMul);
1634 if (Instruction *VI = dyn_cast<Instruction>(V))
1634 if (Instruction *VI = dyn_cast<Instruction>(V))
1638 Instruction *V2 = CreateMul(V, MaxOccVal, "reass.mul", I, I);
1770 if (Instruction *MI = dyn_cast<Instruction>(M))
1770 if (Instruction *MI = dyn_cast<Instruction>(M))
1863 case Instruction::And:
1864 case Instruction::Or:
1869 case Instruction::Xor:
1874 case Instruction::Add:
1875 case Instruction::FAdd:
1880 case Instruction::Mul:
1881 case Instruction::FMul:
1894 void ReassociatePass::RecursivelyEraseDeadInsts(Instruction *I,
1903 if (Instruction *OpInst = dyn_cast<Instruction>(Op))
1903 if (Instruction *OpInst = dyn_cast<Instruction>(Op))
1909 void ReassociatePass::EraseInst(Instruction *I) {
1919 SmallPtrSet<Instruction *, 8> Visited; // Detect self-referential nodes.
1921 if (Instruction *Op = dyn_cast<Instruction>(Ops[i])) {
1921 if (Instruction *Op = dyn_cast<Instruction>(Ops[i])) {
1945 SmallVectorImpl<Instruction *> &Candidates) {
1948 Instruction *I;
1956 case Instruction::FMul:
1968 case Instruction::FDiv:
1990 Instruction *ReassociatePass::canonicalizeNegFPConstantsForOp(Instruction *I,
1990 Instruction *ReassociatePass::canonicalizeNegFPConstantsForOp(Instruction *I,
1991 Instruction *Op,
1998 SmallVector<Instruction *, 4> Candidates;
2006 bool IsFSub = I->getOpcode() == Instruction::FSub;
2011 for (Instruction *Negatible : Candidates) {
2042 return dyn_cast<Instruction>(NewInst);
2053 Instruction *ReassociatePass::canonicalizeNegFPConstants(Instruction *I) {
2053 Instruction *ReassociatePass::canonicalizeNegFPConstants(Instruction *I) {
2056 Instruction *Op;
2058 if (Instruction *R = canonicalizeNegFPConstantsForOp(I, Op, X))
2061 if (Instruction *R = canonicalizeNegFPConstantsForOp(I, Op, X))
2064 if (Instruction *R = canonicalizeNegFPConstantsForOp(I, Op, X))
2071 void ReassociatePass::OptimizeInst(Instruction *I) {
2076 if (I->getOpcode() == Instruction::Shl && isa<ConstantInt>(I->getOperand(1)))
2079 if (isReassociableOp(I->getOperand(0), Instruction::Mul) ||
2081 (isReassociableOp(I->user_back(), Instruction::Mul) ||
2082 isReassociableOp(I->user_back(), Instruction::Add)))) {
2083 Instruction *NI = ConvertShiftToMul(I);
2096 if (Instruction *Res = canonicalizeNegFPConstants(I))
2114 if (I->getOpcode() == Instruction::Sub) {
2116 Instruction *NI = BreakUpSubtract(I, RedoInsts);
2123 if (isReassociableOp(I->getOperand(1), Instruction::Mul) &&
2125 !isReassociableOp(I->user_back(), Instruction::Mul))) {
2126 Instruction *NI = LowerNegateToMultiply(I);
2138 } else if (I->getOpcode() == Instruction::FNeg ||
2139 I->getOpcode() == Instruction::FSub) {
2141 Instruction *NI = BreakUpSubtract(I, RedoInsts);
2150 if (isReassociableOp(Op, Instruction::FMul) &&
2152 !isReassociableOp(I->user_back(), Instruction::FMul))) {
2155 Instruction *NI = LowerNegateToMultiply(I);
2186 if (BO->hasOneUse() && BO->getOpcode() == Instruction::Add &&
2187 cast<Instruction>(BO->user_back())->getOpcode() == Instruction::Sub)
2187 cast<Instruction>(BO->user_back())->getOpcode() == Instruction::Sub)
2189 if (BO->hasOneUse() && BO->getOpcode() == Instruction::FAdd &&
2190 cast<Instruction>(BO->user_back())->getOpcode() == Instruction::FSub)
2190 cast<Instruction>(BO->user_back())->getOpcode() == Instruction::FSub)
2229 if (Instruction *VI = dyn_cast<Instruction>(V))
2229 if (Instruction *VI = dyn_cast<Instruction>(V))
2242 if (I->getOpcode() == Instruction::Mul &&
2243 cast<Instruction>(I->user_back())->getOpcode() == Instruction::Add &&
2243 cast<Instruction>(I->user_back())->getOpcode() == Instruction::Add &&
2248 } else if (I->getOpcode() == Instruction::FMul &&
2249 cast<Instruction>(I->user_back())->getOpcode() ==
2250 Instruction::FAdd &&
2268 if (Instruction *OI = dyn_cast<Instruction>(Ops[0].Op))
2268 if (Instruction *OI = dyn_cast<Instruction>(Ops[0].Op))
2284 unsigned Idx = I->getOpcode() - Instruction::BinaryOpsBegin;
2328 for (Instruction &I : *BI) {
2343 Instruction *OpI = dyn_cast<Instruction>(Op);
2343 Instruction *OpI = dyn_cast<Instruction>(Op);
2359 unsigned BinaryIdx = I.getOpcode() - Instruction::BinaryOpsBegin;
2429 Instruction *I = ToRedo.pop_back_val();
2439 Instruction *I = RedoInsts.front();
lib/Transforms/Scalar/Reg2Mem.cpp 49 bool valueEscapes(const Instruction *Inst) const {
52 const Instruction *UI = cast<Instruction>(U);
52 const Instruction *UI = cast<Instruction>(U);
91 std::list<Instruction*> WorkList;
103 for (Instruction *ilb : WorkList)
117 for (Instruction *ilb : WorkList)
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp 262 MapVector<AssertingVH<Instruction>, AssertingVH<Value>>;
273 Instruction *StatepointToken;
277 Instruction *UnwindToken;
306 static void findLiveSetAtInst(Instruction *inst, GCPtrLivenessData &Data,
644 if (isa<Instruction>(V) &&
645 cast<Instruction>(V)->getMetadata("is_base_value")) {
931 Instruction *I = cast<Instruction>(Pair.first);
931 Instruction *I = cast<Instruction>(Pair.first);
993 Instruction *BaseInst = MakeBaseInstPlaceholder(I);
1028 Instruction *BDV = cast<Instruction>(Pair.first);
1028 Instruction *BDV = cast<Instruction>(Pair.first);
1271 Instruction *StatepointToken,
1333 AssertingVH<Instruction> Old;
1334 AssertingVH<Instruction> New;
1340 static DeferredReplacement createRAUW(Instruction *Old, Instruction *New) {
1340 static DeferredReplacement createRAUW(Instruction *Old, Instruction *New) {
1350 static DeferredReplacement createDelete(Instruction *ToErase) {
1356 static DeferredReplacement createDeoptimizeReplacement(Instruction *Old) {
1370 Instruction *OldI = Old;
1371 Instruction *NewI = New;
1487 Instruction *Token = nullptr;
1540 Instruction *ExceptionalToken = UnwindBlock->getLandingPadInst();
1654 Store->insertAfter(cast<Instruction>(CastedRelocatedValue));
1669 Instruction *RematerializedValue = RematerializedValuePair.first;
1693 for (Instruction &I : F.getEntryBlock())
1793 InsertClobbersAt(cast<Instruction>(Statepoint)->getNextNode());
1806 SmallVector<Instruction *, 20> Uses;
1816 Uses.push_back(cast<Instruction>(U));
1824 for (Instruction *Use : Uses) {
1846 if (Instruction *Inst = dyn_cast<Instruction>(Def)) {
1846 if (Instruction *Inst = dyn_cast<Instruction>(Def)) {
1860 Store->insertAfter(cast<Instruction>(Alloca));
1872 for (auto &I : F.getEntryBlock())
1933 SmallVectorImpl<Instruction*> &ChainToBase,
1958 chainToBasePointerCost(SmallVectorImpl<Instruction*> &Chain,
1962 for (Instruction *Instr : Chain) {
2030 SmallVector<Instruction *, 3> ChainToBase;
2093 Instruction *LastClonedValue = nullptr;
2094 Instruction *LastValue = nullptr;
2095 for (Instruction *Instr: ChainToBase) {
2102 Instruction *ClonedValue = Instr->clone();
2142 Instruction *InsertBefore = Call->getNextNode();
2144 Instruction *RematerializedValue = rematerializeChain(
2150 Instruction *NormalInsertBefore =
2152 Instruction *UnwindInsertBefore =
2155 Instruction *NormalRematerializedValue = rematerializeChain(
2157 Instruction *UnwindRematerializedValue = rematerializeChain(
2357 if (!isa<Instruction>(V))
2360 auto *LiveInst = cast<Instruction>(V);
2360 auto *LiveInst = cast<Instruction>(V);
2414 static void stripInvalidMetadataFromInstruction(Instruction &I) {
2453 for (Instruction &I : instructions(F)) {
2541 for (Instruction &I : instructions(F)) {
2584 return dyn_cast<Instruction>(BI->getCondition());
2589 Instruction *TI = BB.getTerminator();
2590 if (auto *Cond = getConditionInst(TI))
2604 for (Instruction &I : instructions(F)) {
2641 for (auto &I : make_range(Begin, End)) {
2673 for (auto &I : *Succ) {
2689 for (Instruction &I : *BB)
2699 Instruction *TI, bool TermOkay = false) {
2701 if (auto *I = dyn_cast<Instruction>(V)) {
2701 if (auto *I = dyn_cast<Instruction>(V)) {
2791 static void findLiveSetAtInst(Instruction *Inst, GCPtrLivenessData &Data,
lib/Transforms/Scalar/SCCP.cpp 258 const PredicateBase *getPredicateInfoFor(Instruction *I) {
573 void getFeasibleSuccessors(Instruction &TI, SmallVectorImpl<bool> &Succs);
578 void OperandChangedState(Instruction *I) {
592 if (auto *UI = dyn_cast<Instruction>(U))
592 if (auto *UI = dyn_cast<Instruction>(U))
598 if (auto *UI = dyn_cast<Instruction>(U))
598 if (auto *UI = dyn_cast<Instruction>(U))
614 void visitTerminator(Instruction &TI);
618 void visitUnaryOperator(Instruction &I);
619 void visitBinaryOperator(Instruction &I);
654 void visitInstruction(Instruction &I) {
666 void SCCPSolver::getFeasibleSuccessors(Instruction &TI,
860 void SCCPSolver::visitTerminator(Instruction &TI) {
976 void SCCPSolver::visitUnaryOperator(Instruction &I) {
999 void SCCPSolver::visitBinaryOperator(Instruction &I) {
1023 if (I.getOpcode() == Instruction::UDiv || I.getOpcode() == Instruction::SDiv)
1023 if (I.getOpcode() == Instruction::UDiv || I.getOpcode() == Instruction::SDiv)
1031 if (I.getOpcode() == Instruction::And || I.getOpcode() == Instruction::Mul ||
1031 if (I.getOpcode() == Instruction::And || I.getOpcode() == Instruction::Mul ||
1032 I.getOpcode() == Instruction::Or) {
1043 if (I.getOpcode() == Instruction::And ||
1044 I.getOpcode() == Instruction::Mul) {
1200 Instruction *I = CS.getInstruction();
1440 for (Instruction &I : BB) {
1513 case Instruction::Add:
1514 case Instruction::Sub:
1515 case Instruction::Trunc:
1516 case Instruction::FPTrunc:
1517 case Instruction::BitCast:
1519 case Instruction::FSub:
1520 case Instruction::FAdd:
1521 case Instruction::FMul:
1522 case Instruction::FDiv:
1523 case Instruction::FRem:
1530 case Instruction::FNeg:
1532 case Instruction::ZExt:
1533 case Instruction::SExt:
1534 case Instruction::FPToUI:
1535 case Instruction::FPToSI:
1536 case Instruction::FPExt:
1537 case Instruction::PtrToInt:
1538 case Instruction::IntToPtr:
1539 case Instruction::SIToFP:
1540 case Instruction::UIToFP:
1544 case Instruction::Mul:
1545 case Instruction::And:
1553 case Instruction::Or:
1560 case Instruction::Xor:
1570 case Instruction::SDiv:
1571 case Instruction::UDiv:
1572 case Instruction::SRem:
1573 case Instruction::URem:
1587 case Instruction::AShr:
1602 case Instruction::LShr:
1603 case Instruction::Shl:
1620 case Instruction::Select:
1641 case Instruction::Load:
1646 case Instruction::ICmp:
1656 case Instruction::Call:
1657 case Instruction::Invoke:
1658 case Instruction::CallBr:
1671 Instruction *TI = BB.getTerminator();
1843 Instruction *Inst = &*BI++;
1971 static void forceIndeterminateEdge(Instruction* I, SCCPSolver &Solver) {
2095 Instruction *Inst = &*BI++;
2133 auto *I = dyn_cast<Instruction>(*UI);
2133 auto *I = dyn_cast<Instruction>(*UI);
2165 Instruction *Inst = &*BI++;
lib/Transforms/Scalar/SROA.cpp 142 void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB,
279 ArrayRef<Instruction *> getDeadUsers() const { return DeadUsers; }
317 Instruction *PointerEscapingInstr;
333 SmallVector<Instruction *, 8> DeadUsers;
635 static Value *foldPHINodeOrSelectInst(Instruction &I) {
656 SmallDenseMap<Instruction *, unsigned> MemTransferSliceMap;
657 SmallDenseMap<Instruction *, uint64_t> PHIOrSelectSizes;
660 SmallPtrSet<Instruction *, 4> VisitedDeadInsts;
668 void markAsDead(Instruction &I) {
673 void insertUse(Instruction &I, const APInt &Offset, uint64_t Size,
769 void handleLoadOrStore(Type *Ty, Instruction &I, const APInt &Offset,
876 SmallDenseMap<Instruction *, unsigned>::iterator MTPI =
899 SmallDenseMap<Instruction *, unsigned>::iterator MTPI;
944 Instruction *hasUnsafePHIOrSelectUse(Instruction *Root, uint64_t &Size) {
944 Instruction *hasUnsafePHIOrSelectUse(Instruction *Root, uint64_t &Size) {
949 SmallPtrSet<Instruction *, 4> Visited;
950 SmallVector<std::pair<Instruction *, Instruction *>, 4> Uses;
950 SmallVector<std::pair<Instruction *, Instruction *>, 4> Uses;
952 Uses.push_back(std::make_pair(cast<Instruction>(*U), Root));
958 Instruction *I, *UsedI;
984 if (Visited.insert(cast<Instruction>(U)).second)
985 Uses.push_back(std::make_pair(I, cast<Instruction>(U)));
991 void visitPHINodeOrSelectInst(Instruction &I) {
1024 if (Instruction *UnsafeI = hasUnsafePHIOrSelectUse(&I, Size))
1047 void visitInstruction(Instruction &I) { PI.setAborted(&I); }
1236 Instruction *TI = PN.getIncomingBlock(Idx)->getTerminator();
1299 Instruction *TI = Pred->getTerminator();
1626 if (Instruction *I = dyn_cast<Instruction>(OffsetPtr)) {
1626 if (Instruction *I = dyn_cast<Instruction>(OffsetPtr)) {
1644 if (Operator::getOpcode(Ptr) == Instruction::BitCast) {
1683 static unsigned getAdjustedAlignment(Instruction *I, uint64_t Offset,
2309 Instruction *OldPtr = nullptr;
2369 OldPtr = cast<Instruction>(OldUse->get());
2371 Instruction *OldUserI = cast<Instruction>(OldUse->getUser());
2371 Instruction *OldUserI = cast<Instruction>(OldUse->getUser());
2376 CanSROA &= visit(cast<Instruction>(OldUse->getUser()));
2387 bool visitInstruction(Instruction &I) {
2454 Instruction *I = cast<Instruction>(V);
2454 Instruction *I = cast<Instruction>(V);
3108 void fixLoadStoreAlign(Instruction &Root) {
3112 SmallPtrSet<Instruction *, 4> Visited;
3113 SmallVector<Instruction *, 4> Uses;
3117 Instruction *I = Uses.pop_back_val();
3140 if (Visited.insert(cast<Instruction>(U)).second)
3141 Uses.push_back(cast<Instruction>(U));
3235 bool rewrite(Instruction &I) {
3241 Changed |= visit(cast<Instruction>(U->getUser()));
3249 void enqueueUsers(Instruction &I) {
3256 bool visitInstruction(Instruction &I) { return false; }
3288 OpSplitter(Instruction *InsertionPoint, Value *Ptr, Type *BaseTy,
3351 LoadOpSplitter(Instruction *InsertionPoint, Value *Ptr, Type *BaseTy,
3390 StoreOpSplitter(Instruction *InsertionPoint, Value *Ptr, Type *BaseTy,
3646 SmallDenseMap<Instruction *, SplitOffsets, 8> SplitOffsetsMap;
3664 Instruction *I = cast<Instruction>(S.getUse()->getUser());
3664 Instruction *I = cast<Instruction>(S.getUse()->getUser());
3728 SplitOffsetsMap.find(cast<Instruction>(S->getUse()->getUser()));
3850 Instruction *BasePtr = cast<Instruction>(LI->getPointerOperand());
3850 Instruction *BasePtr = cast<Instruction>(LI->getPointerOperand());
3974 Instruction *StoreBasePtr = cast<Instruction>(SI->getPointerOperand());
3974 Instruction *StoreBasePtr = cast<Instruction>(SI->getPointerOperand());
4423 if (Instruction *OldI = dyn_cast<Instruction>(OldV))
4423 if (Instruction *OldI = dyn_cast<Instruction>(OldV))
4464 for (Instruction *DeadUser : AS.getDeadUsers()) {
4511 Instruction *I = DeadInsts.pop_back_val();
4526 if (Instruction *U = dyn_cast<Instruction>(Operand)) {
4526 if (Instruction *U = dyn_cast<Instruction>(Operand)) {
lib/Transforms/Scalar/Scalarizer.cpp 71 using GatherList = SmallVector<std::pair<Instruction *, ValueVector *>, 16>;
184 bool visitInstruction(Instruction &I) { return false; }
200 Scatterer scatter(Instruction *Point, Value *V);
201 void gather(Instruction *Op, const ValueVector &CV);
203 void transferMetadataAndIRFlags(Instruction *Op, const ValueVector &CV);
208 template<typename T> bool splitUnary(Instruction &, const T &);
209 template<typename T> bool splitBinary(Instruction &, const T &);
322 Instruction *I = &*II;
334 Scatterer ScalarizerVisitor::scatter(Instruction *Point, Value *V) {
342 if (Instruction *VOp = dyn_cast<Instruction>(V)) {
342 if (Instruction *VOp = dyn_cast<Instruction>(V)) {
358 void ScalarizerVisitor::gather(Instruction *Op, const ValueVector &CV) {
375 Instruction *Old = cast<Instruction>(V);
375 Instruction *Old = cast<Instruction>(V);
400 void ScalarizerVisitor::transferMetadataAndIRFlags(Instruction *Op,
405 if (Instruction *New = dyn_cast<Instruction>(CV[I])) {
405 if (Instruction *New = dyn_cast<Instruction>(CV[I])) {
441 bool ScalarizerVisitor::splitUnary(Instruction &I, const Splitter &Split) {
461 bool ScalarizerVisitor::splitBinary(Instruction &I, const Splitter &Split) {
687 Instruction *VI;
690 while ((VI = dyn_cast<Instruction>(V)) &&
691 VI->getOpcode() == Instruction::BitCast)
830 Instruction *Op = GMI.first;
lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp 246 ConstantOffsetExtractor(Instruction *InsertionPt, const DominatorTree *DT)
335 Instruction *IP;
430 bool reuniteExts(Instruction *I);
433 Instruction *findClosestMatchingDominator(const SCEV *Key,
434 Instruction *Dominatee);
458 DenseMap<const SCEV *, SmallVector<Instruction *, 2>> DominatingExprs;
490 if (BO->getOpcode() != Instruction::Add &&
491 BO->getOpcode() != Instruction::Sub &&
492 BO->getOpcode() != Instruction::Or) {
501 if (BO->getOpcode() == Instruction::Or &&
516 if (BO->getOpcode() == Instruction::Add && !ZeroExtended && NonNegative) {
537 if (BO->getOpcode() == Instruction::Add ||
538 BO->getOpcode() == Instruction::Sub) {
565 if (BO->getOpcode() == Instruction::Sub)
624 Instruction *Ext = (*I)->clone();
703 if (CI->isZero() && !(BO->getOpcode() == Instruction::Sub && OpNo == 0))
708 if (BO->getOpcode() == Instruction::Or) {
722 NewOp = Instruction::Add;
1060 Instruction *NewGEP = GEP->clone();
1142 Instruction *SeparateConstOffsetFromGEP::findClosestMatchingDominator(
1143 const SCEV *Key, Instruction *Dominatee) {
1154 Instruction *Candidate = Candidates.back();
1162 bool SeparateConstOffsetFromGEP::reuniteExts(Instruction *I) {
1176 if (auto *Dom = findClosestMatchingDominator(Key, I)) {
1177 Instruction *NewSExt = new SExtInst(Dom, I->getType(), "", I);
1204 Instruction *Cur = &*I++;
1213 for (Instruction &I : B) {
1252 Instruction *FirstOffsetDef = dyn_cast<Instruction>(FirstOffset);
1252 Instruction *FirstOffsetDef = dyn_cast<Instruction>(FirstOffset);
1265 FirstOffsetDef = dyn_cast<Instruction>(FirstOffsetDef->getOperand(0));
1272 if ((opc == Instruction::Add || opc == Instruction::Sub) &&
1272 if ((opc == Instruction::Add || opc == Instruction::Sub) &&
1283 if (Instruction *User = dyn_cast<Instruction>(U))
1283 if (Instruction *User = dyn_cast<Instruction>(U))
lib/Transforms/Scalar/SimpleLoopUnswitch.cpp 103 collectHomogenousInstGraphLoopInvariants(Loop &L, Instruction &Root,
110 SmallVector<Instruction *, 4> Worklist;
111 SmallPtrSet<Instruction *, 8> Visited;
115 Instruction &I = *Worklist.pop_back_val();
128 Instruction *OpI = dyn_cast<Instruction>(OpV);
128 Instruction *OpI = dyn_cast<Instruction>(OpV);
149 Instruction *UserI = dyn_cast<Instruction>(U->getUser());
149 Instruction *UserI = dyn_cast<Instruction>(U->getUser());
161 for (Instruction &I : ExitBB) {
226 Instruction *InsertPt = &*UnswitchedBB.begin();
366 if (auto *CondInst = dyn_cast<Instruction>(BI.getCondition()))
366 if (auto *CondInst = dyn_cast<Instruction>(BI.getCondition()))
396 if (cast<Instruction>(BI.getCondition())->getOpcode() != Instruction::Or)
396 if (cast<Instruction>(BI.getCondition())->getOpcode() != Instruction::Or)
399 if (cast<Instruction>(BI.getCondition())->getOpcode() != Instruction::And)
399 if (cast<Instruction>(BI.getCondition())->getOpcode() != Instruction::And)
882 Instruction *CurrentTerm = CurrentBB->getTerminator();
1041 Instruction &I = std::get<0>(ZippedInsts);
1042 Instruction &ClonedI = std::get<1>(ZippedInsts);
1067 for (Instruction &I : *ClonedBB) {
1902 Loop &L, Instruction &TI, ArrayRef<Value *> Invariants,
1934 if (cast<Instruction>(BI->getCondition())->getOpcode() != Instruction::Or) {
1934 if (cast<Instruction>(BI->getCondition())->getOpcode() != Instruction::Or) {
2044 Instruction *NewTI = TI.clone();
2225 Instruction *UserI = dyn_cast<Instruction>(U->getUser());
2225 Instruction *UserI = dyn_cast<Instruction>(U->getUser());
2392 Instruction *DeoptBlockTerm =
2452 Instruction &TI, Loop &L, LoopInfo &LI, DominatorTree &DT,
2453 ArrayRef<std::pair<Instruction *, TinyPtrVector<Value *>>>
2478 Instruction *CI = Candidate.first;
2530 SmallVector<std::pair<Instruction *, TinyPtrVector<Value *>>, 4>
2547 for (auto &I : *BB)
2574 Instruction &CondI = *cast<Instruction>(BI->getCondition());
2574 Instruction &CondI = *cast<Instruction>(BI->getCondition());
2575 if (CondI.getOpcode() != Instruction::And &&
2576 CondI.getOpcode() != Instruction::Or)
2636 for (auto &I : *BB) {
2688 if (cast<Instruction>(BI.getCondition())->getOpcode() ==
2689 Instruction::And) {
2726 Instruction *BestUnswitchTI = nullptr;
2730 Instruction &TI = *TerminatorAndInvariants.first;
lib/Transforms/Scalar/Sink.cpp 36 static bool AllUsesDominatedByBlock(Instruction *Inst, BasicBlock *BB,
44 Instruction *UseInst = cast<Instruction>(U.getUser());
44 Instruction *UseInst = cast<Instruction>(U.getUser());
59 static bool isSafeToMove(Instruction *Inst, AliasAnalysis &AA,
60 SmallPtrSetImpl<Instruction *> &Stores) {
69 for (Instruction *S : Stores)
84 for (Instruction *S : Stores)
94 static bool IsAcceptableTarget(Instruction *Inst, BasicBlock *SuccToSinkTo,
138 static bool SinkInstruction(Instruction *Inst,
139 SmallPtrSetImpl<Instruction *> &Stores,
214 SmallPtrSet<Instruction *, 8> Stores;
216 Instruction *Inst = &*I; // The instruction to sink.
lib/Transforms/Scalar/SpeculateAroundPHIs.cpp 50 SmallPtrSetImpl<Instruction *> &PotentialSpecSet,
51 SmallPtrSetImpl<Instruction *> &UnsafeSet) {
53 SmallPtrSet<Instruction *, 4> Visited;
54 SmallVector<std::pair<Instruction *, User::value_op_iterator>, 16> DFSStack;
58 auto *UI = cast<Instruction>(U.getUser());
58 auto *UI = cast<Instruction>(U.getUser());
99 auto *OpI = dyn_cast<Instruction>(*OpIt);
99 auto *OpI = dyn_cast<Instruction>(*OpIt);
142 Instruction *I = StackPair.first;
170 for (auto *I : Visited)
204 SmallPtrSetImpl<Instruction *> &PotentialSpecSet,
205 SmallPtrSetImpl<Instruction *> &UnsafeSet, DominatorTree &DT,
254 auto *UserI = cast<Instruction>(U.getUser());
254 auto *UserI = cast<Instruction>(U.getUser());
346 SmallVector<std::pair<Instruction *, User::value_op_iterator>, 16> DFSStack;
349 auto *UI = cast<Instruction>(U.getUser());
349 auto *UI = cast<Instruction>(U.getUser());
361 auto *OpI = dyn_cast<Instruction>(*OpIt);
361 auto *OpI = dyn_cast<Instruction>(*OpIt);
430 SmallDenseMap<Instruction *, TinyPtrVector<PHINode *>, 16> UserToPNMap;
432 SmallPtrSet<Instruction *, 16> UserSet;
436 UserSet.insert(cast<Instruction>(U.getUser()));
438 for (auto *UI : UserSet)
446 SmallDenseMap<Instruction *, int, 16> SpecCostMap;
463 if (auto *OpI = dyn_cast<Instruction>(OpV)) {
463 if (auto *OpI = dyn_cast<Instruction>(OpV)) {
491 SmallVector<Instruction *, 16> SpecWorklist;
496 SpecCostMap.find(cast<Instruction>(U.getUser()))->second;
517 auto *UI = cast<Instruction>(U.getUser());
517 auto *UI = cast<Instruction>(U.getUser());
530 Instruction *SpecI = SpecWorklist.pop_back_val();
536 auto *OpI = dyn_cast<Instruction>(OpV);
536 auto *OpI = dyn_cast<Instruction>(OpV);
560 SmallPtrSetImpl<Instruction *> &PotentialSpecSet,
590 SmallPtrSet<Instruction *, 16> SpecSet;
591 SmallVector<Instruction *, 16> SpecList;
621 SmallDenseMap<Instruction *, SmallVector<Value *, 2>, 16> SpeculatedValueMap;
626 for (auto *OrigI : SpecList)
657 for (auto *OrigI : SpecList) {
658 auto *NewI = OrigI->clone();
666 auto *OpI = dyn_cast<Instruction>(U.get());
666 auto *OpI = dyn_cast<Instruction>(U.get());
701 for (auto *OrigI : llvm::reverse(SpecList)) {
743 SmallPtrSet<Instruction *, 16> PotentialSpecSet;
750 SmallPtrSet<Instruction *, 16> UnsafeSet;
780 const auto *TermInst = PredBB->getTerminator();
lib/Transforms/Scalar/SpeculativeExecution.cpp 211 static unsigned ComputeSpeculationCost(const Instruction *I,
214 case Instruction::GetElementPtr:
215 case Instruction::Add:
216 case Instruction::Mul:
217 case Instruction::And:
218 case Instruction::Or:
219 case Instruction::Select:
220 case Instruction::Shl:
221 case Instruction::Sub:
222 case Instruction::LShr:
223 case Instruction::AShr:
224 case Instruction::Xor:
225 case Instruction::ZExt:
226 case Instruction::SExt:
227 case Instruction::Call:
228 case Instruction::BitCast:
229 case Instruction::PtrToInt:
230 case Instruction::IntToPtr:
231 case Instruction::AddrSpaceCast:
232 case Instruction::FPToUI:
233 case Instruction::FPToSI:
234 case Instruction::UIToFP:
235 case Instruction::SIToFP:
236 case Instruction::FPExt:
237 case Instruction::FPTrunc:
238 case Instruction::FAdd:
239 case Instruction::FSub:
240 case Instruction::FMul:
241 case Instruction::FDiv:
242 case Instruction::FRem:
243 case Instruction::FNeg:
244 case Instruction::ICmp:
245 case Instruction::FCmp:
255 SmallPtrSet<const Instruction *, 8> NotHoisted;
258 if (Instruction *I = dyn_cast<Instruction>(V)) {
258 if (Instruction *I = dyn_cast<Instruction>(V)) {
267 for (auto& I : FromBlock) {
lib/Transforms/Scalar/StraightLineStrengthReduce.cpp 111 Instruction *I)
139 Instruction *Ins = nullptr;
182 void allocateCandidatesAndFindBasis(Instruction *I);
185 void allocateCandidatesAndFindBasisForAdd(Instruction *I);
190 Instruction *I);
192 void allocateCandidatesAndFindBasisForMul(Instruction *I);
197 Instruction *I);
206 Instruction *I);
212 Instruction *I);
240 std::vector<Instruction *> UnlinkedInstructions;
337 Instruction *I) {
372 Instruction *I) {
374 case Instruction::Add:
377 case Instruction::Mul:
380 case Instruction::GetElementPtr:
387 Instruction *I) {
400 Value *LHS, Value *RHS, Instruction *I) {
432 Value *LHS, Value *RHS, Instruction *I) {
454 Instruction *I) {
471 Instruction *I) {
716 for (auto &I : *(Node->getBlock()))
730 for (auto *UnlinkedInst : UnlinkedInstructions) {
lib/Transforms/Scalar/StructurizeCFG.cpp 413 if (Instruction *Inst = dyn_cast<Instruction>(Condition)) {
413 if (Instruction *Inst = dyn_cast<Instruction>(Condition)) {
417 if (Instruction *I = dyn_cast<Instruction>(U))
417 if (Instruction *I = dyn_cast<Instruction>(U))
662 Instruction *Term = BB->getTerminator();
910 for (Instruction &I : *BB) {
916 Instruction *User = cast<Instruction>(U.getUser());
916 Instruction *User = cast<Instruction>(U.getUser());
1025 if (Instruction *Term = E->getEntry()->getTerminator())
lib/Transforms/Scalar/TailRecursionElimination.cpp 123 Instruction *I = cast<Instruction>(U->getUser());
123 Instruction *I = cast<Instruction>(U->getUser());
126 case Instruction::Call:
127 case Instruction::Invoke: {
145 case Instruction::Load: {
150 case Instruction::Store: {
155 case Instruction::BitCast:
156 case Instruction::GetElementPtr:
157 case Instruction::PHI:
158 case Instruction::Select:
159 case Instruction::AddrSpaceCast:
183 SmallPtrSet<Instruction *, 32> AllocaUsers;
184 SmallPtrSet<Instruction *, 32> EscapePoints;
201 for (auto &I : BB)
235 for (auto &I : *BB) {
328 static bool canMoveAboveCall(Instruction *I, CallInst *CI, AliasAnalysis *AA) {
422 static Value *canTransformAccumulatorRecursion(Instruction *I, CallInst *CI) {
442 static Instruction *firstNonDbg(BasicBlock::iterator I) {
448 static CallInst *findTRECandidate(Instruction *TI,
514 Instruction *AccumulatorRecursionInstr = nullptr;
593 Instruction *InsertPos = &OldEntry->front();
629 Instruction *AccRecInstr = AccumulatorRecursionInstr;
704 Instruction *PTI = Pred->getTerminator();
lib/Transforms/Utils/AddDiscriminators.cpp 112 static bool shouldHaveDiscriminator(const Instruction *I) {
189 for (auto &I : B.getInstList()) {
233 for (auto &I : B.getInstList()) {
lib/Transforms/Utils/BasicBlockUtils.cpp 70 Instruction &I = BB->back();
246 Instruction *PTI = PredBB->getTerminator();
247 Instruction *STI = BB->getTerminator();
248 Instruction *Start = &*BB->begin();
283 if (isa<Instruction>(*Incoming)) {
323 Instruction &I = *BI;
336 BasicBlock::iterator &BI, Instruction *I) {
355 void llvm::ReplaceInstWithInst(Instruction *From, Instruction *To) {
355 void llvm::ReplaceInstWithInst(Instruction *From, Instruction *To) {
365 Instruction *LatchTerm = BB->getTerminator();
393 Instruction *TI = BB.getTerminator();
402 BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt,
738 Instruction *Clone1 = LPad->clone();
743 Instruction *Clone2 = LPad->clone();
770 Instruction *UncondBranch = Pred->getTerminator();
772 Instruction *NewRet = RI->clone();
780 Instruction *NewBC = nullptr;
810 Instruction *llvm::SplitBlockAndInsertIfThen(Value *Cond,
811 Instruction *SplitBefore,
818 Instruction *HeadOldTerm = Head->getTerminator();
820 Instruction *CheckTerm;
862 void llvm::SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
863 Instruction **ThenTerm,
864 Instruction **ElseTerm,
868 Instruction *HeadOldTerm = Head->getTerminator();
lib/Transforms/Utils/BreakCriticalEdges.cpp 137 llvm::SplitCriticalEdge(Instruction *TI, unsigned SuccNum,
337 Instruction *PredTerm = PredBB->getTerminator();
339 case Instruction::IndirectBr:
344 case Instruction::Br:
345 case Instruction::Switch:
386 Instruction *FirstNonPHI = Target->getFirstNonPHI();
lib/Transforms/Utils/BypassSlowDivision.cpp 65 using VisitedSetTy = SmallPtrSet<Instruction *, 4>;
79 Instruction *SlowDivOrRem = nullptr;
93 return SlowDivOrRem->getOpcode() == Instruction::SDiv ||
94 SlowDivOrRem->getOpcode() == Instruction::SRem;
98 return SlowDivOrRem->getOpcode() == Instruction::SDiv ||
99 SlowDivOrRem->getOpcode() == Instruction::UDiv;
105 FastDivInsertionTask(Instruction *I, const BypassWidthsTy &BypassWidths);
112 FastDivInsertionTask::FastDivInsertionTask(Instruction *I,
115 case Instruction::UDiv:
116 case Instruction::SDiv:
117 case Instruction::URem:
118 case Instruction::SRem:
191 Instruction *I = dyn_cast<Instruction>(V);
191 Instruction *I = dyn_cast<Instruction>(V);
196 case Instruction::Xor:
198 case Instruction::Mul: {
209 case Instruction::PHI:
294 Builder.CreateCast(Instruction::Trunc, Divisor, BypassType);
296 Builder.CreateCast(Instruction::Trunc, Dividend, BypassType);
302 Builder.CreateCast(Instruction::ZExt, ShortQV, getSlowType());
304 Builder.CreateCast(Instruction::ZExt, ShortRV, getSlowType());
451 Instruction *Next = &*BB->begin();
455 Instruction *I = Next;
lib/Transforms/Utils/CallPromotionUtils.cpp 104 static void createRetPHINode(Instruction *OrigInst, Instruction *NewInst,
104 static void createRetPHINode(Instruction *OrigInst, Instruction *NewInst,
171 Instruction *InsertBefore = nullptr;
256 static Instruction *versionCallSite(CallSite CS, Value *Callee,
260 Instruction *OrigInst = CS.getInstruction();
272 Instruction *ThenTerm = nullptr;
273 Instruction *ElseTerm = nullptr;
284 Instruction *NewInst = OrigInst->clone();
365 Instruction *llvm::promoteCall(CallSite CS, Function *Callee,
449 Instruction *llvm::promoteCallWithIfThenElse(CallSite CS, Function *Callee,
455 Instruction *NewInst = versionCallSite(CS, Callee, BranchWeights);
lib/Transforms/Utils/CloneFunction.cpp 53 for (const Instruction &I : *BB) {
57 Instruction *NewInst = I.clone();
209 for (Instruction &II : *BB)
336 Instruction *NewInst = II->clone();
383 const Instruction *OldTI = BB->getTerminator();
420 Instruction *NewInst = OldTI->clone();
432 const Instruction *TI = BB->getTerminator();
449 const Instruction *StartingInst,
616 auto *I = dyn_cast_or_null<Instruction>(VMap.lookup(OrigV));
616 auto *I = dyn_cast_or_null<Instruction>(VMap.lookup(OrigV));
635 Worklist.insert(cast<Instruction>(U));
732 Instruction *TheCall) {
742 for (auto &Inst : *BB)
836 BasicBlock *BB, BasicBlock *PredBB, Instruction *StopAt,
850 Instruction *NewTerm = NewBB->getTerminator();
863 Instruction *New = BI->clone();
870 if (Instruction *Inst = dyn_cast<Instruction>(New->getOperand(i))) {
870 if (Instruction *Inst = dyn_cast<Instruction>(New->getOperand(i))) {
lib/Transforms/Utils/CodeExtractor.cpp 97 for (Instruction const &Inst : BB)
107 if (isa<Instruction>(Curr) && cast<Instruction>(Curr)->getParent() != &BB)
107 if (isa<Instruction>(Curr) && cast<Instruction>(Curr)->getParent() != &BB)
268 if (Instruction *I = dyn_cast<Instruction>(V))
268 if (Instruction *I = dyn_cast<Instruction>(V))
279 if (Instruction *I = dyn_cast<Instruction>(V))
279 if (Instruction *I = dyn_cast<Instruction>(V))
310 for (Instruction &II : BB.instructionsWithoutDebug())
319 for (Instruction &II : BB.instructionsWithoutDebug()) {
323 case Instruction::Store:
324 case Instruction::Load: {
325 if (Opcode == Instruction::Store) {
372 const CodeExtractorAnalysisCache &CEAC, Instruction *Addr) const {
444 Instruction *Addr,
530 SmallVector<Instruction *, 2> Bitcasts;
534 Instruction *Bitcast = cast<Instruction>(U);
534 Instruction *Bitcast = cast<Instruction>(U);
557 Instruction *BitcastAddr = Bitcasts[I];
603 for (Instruction &II : *BB) {
665 Instruction *TI = PN->getIncomingBlock(i)->getTerminator();
936 Instruction *TI = newFunction->begin()->getTerminator();
946 if (Instruction *inst = dyn_cast<Instruction>(use))
946 if (Instruction *inst = dyn_cast<Instruction>(use))
967 if (Instruction *I = dyn_cast<Instruction>(U))
967 if (Instruction *I = dyn_cast<Instruction>(U))
1013 Instruction *Term = TheCall->getParent()->getTerminator();
1172 Instruction *inst = cast<Instruction>(Users[u]);
1172 Instruction *inst = cast<Instruction>(Users[u]);
1192 Instruction *TI = Block->getTerminator();
1236 auto *OutI = dyn_cast<Instruction>(outputs[i]);
1236 auto *OutI = dyn_cast<Instruction>(outputs[i]);
1251 Instruction *InsertBefore = &*InsertPt;
1348 Instruction *TI = CodeReplacer->getTerminator();
1412 for (auto &I : *Block)
1493 cast<Instruction>(II)->moveAfter(FirstSunkAlloca);
1499 Instruction *TI = HoistToBlock->getTerminator();
1501 cast<Instruction>(II)->moveBefore(TI);
1577 Instruction *Inst = &*BlockIt;
1585 for (Instruction &I : BB)
1595 const Instruction *Term = BB.getTerminator();
lib/Transforms/Utils/DemoteRegToStack.cpp 23 AllocaInst *llvm::DemoteRegToStack(Instruction &I, bool VolatileLoads,
24 Instruction *AllocaPoint) {
58 Instruction *U = cast<Instruction>(I.user_back());
58 Instruction *U = cast<Instruction>(I.user_back());
110 AllocaInst *llvm::DemotePHIToStack(PHINode *P, Instruction *AllocaPoint) {
lib/Transforms/Utils/EntryExitInstrumenter.cpp 21 Instruction *InsertionPt, DebugLoc DL) {
45 Instruction *RetAddr = CallInst::Create(
93 Instruction *T = BB.getTerminator();
98 Instruction *Prev = T->getPrevNode();
lib/Transforms/Utils/EscapeEnumerator.cpp 39 Instruction *TI = CurBB->getTerminator();
56 SmallVector<Instruction *, 16> Calls;
58 for (Instruction &II : BB)
lib/Transforms/Utils/Evaluator.cpp 86 case Instruction::BitCast:
90 case Instruction::IntToPtr:
91 case Instruction::PtrToInt:
100 case Instruction::GetElementPtr:
106 case Instruction::Add:
143 if (CE->getOpcode() == Instruction::GetElementPtr &&
166 } else if (CE->getOpcode() == Instruction::BitCast &&
234 case Instruction::GetElementPtr:
239 case Instruction::BitCast:
276 if (!CE || CE->getOpcode() != Instruction::BitCast ||
313 if (!RV || !CE || CE->getOpcode() != Instruction::BitCast)
365 if (CE->getOpcode() == Instruction::BitCast) {
lib/Transforms/Utils/FlattenCFG.cpp 192 Instruction *CI = &*BI++;
234 Instruction *TBB = LastCondBlock->getTerminator();
327 Instruction *PTI2 = Head2->getTerminator();
328 Instruction *PBI2 = &Head2->front();
357 Instruction *CurI = &*iter1;
401 Instruction *CInst2 = dyn_cast_or_null<Instruction>(IfCond2);
401 Instruction *CInst2 = dyn_cast_or_null<Instruction>(IfCond2);
411 Instruction *CInst1 = dyn_cast_or_null<Instruction>(IfCond1);
411 Instruction *CInst1 = dyn_cast_or_null<Instruction>(IfCond1);
423 Instruction *PTI2 = SecondEntryBlock->getTerminator();
424 Instruction *PBI2 = &SecondEntryBlock->front();
437 Instruction *CI = &*BI;
lib/Transforms/Utils/FunctionComparator.cpp 169 int FunctionComparator::cmpOperandBundlesSchema(const Instruction *L,
170 const Instruction *R) const {
494 int FunctionComparator::cmpOperations(const Instruction *L,
495 const Instruction *R,
869 const Instruction *TermL = BBL->getTerminator();
870 const Instruction *TermR = BBR->getTerminator();
940 const Instruction *Term = BB->getTerminator();
lib/Transforms/Utils/GlobalStatus.cpp 80 } else if (const Instruction *I = dyn_cast<Instruction>(UR)) {
80 } else if (const Instruction *I = dyn_cast<Instruction>(UR)) {
lib/Transforms/Utils/GuardUtils.cpp 32 auto *DeoptBlockTerm =
lib/Transforms/Utils/InlineFunction.cpp 177 Instruction *InsertPoint = &InnerResumeDest->front();
224 using UnwindDestMemoTy = DenseMap<Instruction *, Value *>;
228 static Value *getUnwindDestTokenHelper(Instruction *EHPad,
230 SmallVector<Instruction *, 8> Worklist(1, EHPad);
233 Instruction *CurrentPad = Worklist.pop_back_val();
263 Instruction *ChildPad = cast<Instruction>(Child);
263 Instruction *ChildPad = cast<Instruction>(Child);
301 Instruction *ChildPad = cast<Instruction>(U);
301 Instruction *ChildPad = cast<Instruction>(U);
320 if (isa<Instruction>(ChildUnwindDestToken) &&
337 if (auto *UnwindPad = dyn_cast<Instruction>(UnwindDestToken))
337 if (auto *UnwindPad = dyn_cast<Instruction>(UnwindDestToken))
342 for (Instruction *ExitedPad = CurrentPad;
344 ExitedPad = dyn_cast<Instruction>(getParentPad(ExitedPad))) {
379 static Value *getUnwindDestToken(Instruction *EHPad,
405 SmallPtrSet<Instruction *, 4> TempMemos;
408 Instruction *LastUselessPad = EHPad;
411 auto *AncestorPad = dyn_cast<Instruction>(AncestorToken);
411 auto *AncestorPad = dyn_cast<Instruction>(AncestorToken);
452 SmallVector<Instruction *, 8> Worklist(1, LastUselessPad);
454 Instruction *UselessPad = Worklist.pop_back_val();
488 auto *CatchPad = HandlerBlock->getFirstNonPHI();
497 Worklist.push_back(cast<Instruction>(U));
510 Worklist.push_back(cast<Instruction>(U));
527 Instruction *I = &*BBI++;
555 auto *FuncletPad = cast<Instruction>(FuncletBundle->Inputs[0]);
555 auto *FuncletPad = cast<Instruction>(FuncletBundle->Inputs[0]);
561 Instruction *MemoKey;
653 for (Instruction &I : *UnwindDest) {
694 Instruction *I = BB->getFirstNonPHI();
698 Instruction *Replacement = nullptr;
702 if (auto *ParentPad =
703 dyn_cast<Instruction>(CatchSwitch->getParentPad())) {
784 Instruction *NI = dyn_cast<Instruction>(VMI->second);
784 Instruction *NI = dyn_cast<Instruction>(VMI->second);
823 for (const Instruction &J : I) {
880 Instruction *NI = dyn_cast<Instruction>(VMI->second);
880 Instruction *NI = dyn_cast<Instruction>(VMI->second);
974 if (const Instruction *I = dyn_cast<Instruction>(VMI->first)) {
974 if (const Instruction *I = dyn_cast<Instruction>(VMI->first)) {
978 Instruction *NI = dyn_cast<Instruction>(VMI->second);
978 Instruction *NI = dyn_cast<Instruction>(VMI->second);
1262 static Value *HandleByValArgument(Value *Arg, Instruction *TheCall,
1481 const Instruction *TheCall,
1524 for (Instruction &I : BB)
1541 Instruction *TheCall = CS.getInstruction();
1617 Instruction *CallSiteEHPad = nullptr;
1738 Instruction *I = dyn_cast_or_null<Instruction>(VH);
1738 Instruction *I = dyn_cast_or_null<Instruction>(VH);
1771 Instruction *NewI = nullptr;
1811 for (Instruction &I : NewBlock) {
1884 Instruction &I = *II++;
2038 Instruction *FirstNonPHI = UnwindDest->getFirstNonPHI();
2057 Instruction *I = &*BBI++;
2075 Instruction *NewInst;
2097 Instruction *I = BB->getFirstNonPHI();
2216 for (Instruction &I : NewBB)
2295 Instruction *Br = OrigBB->getTerminator();
lib/Transforms/Utils/InstructionNamer.cpp 42 for (Instruction &I : BB)
lib/Transforms/Utils/IntegerDivision.cpp 67 if (Instruction *URemInst = dyn_cast<Instruction>(URem))
67 if (Instruction *URemInst = dyn_cast<Instruction>(URem))
92 if (Instruction *UDiv = dyn_cast<Instruction>(Quotient))
92 if (Instruction *UDiv = dyn_cast<Instruction>(Quotient))
141 if (Instruction *UDiv = dyn_cast<Instruction>(Q_Mag))
141 if (Instruction *UDiv = dyn_cast<Instruction>(Q_Mag))
388 if (Rem->getOpcode() == Instruction::SRem) {
446 if (Div->getOpcode() == Instruction::SDiv) {
511 if (Rem->getOpcode() == Instruction::SRem) {
559 if (Rem->getOpcode() == Instruction::SRem) {
608 if (Div->getOpcode() == Instruction::SDiv) {
657 if (Div->getOpcode() == Instruction::SDiv) {
lib/Transforms/Utils/LCSSA.cpp 76 bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
91 Instruction *I = Worklist.pop_back_val();
105 Instruction *User = cast<Instruction>(U.getUser());
105 Instruction *User = cast<Instruction>(U.getUser());
189 Instruction *User = cast<Instruction>(UseToRewrite->getUser());
189 Instruction *User = cast<Instruction>(UseToRewrite->getUser());
344 SmallVector<Instruction *, 8> Worklist;
353 for (Instruction &I : *BB) {
lib/Transforms/Utils/LibCallsShrinkWrap.cpp 447 Instruction *I = dyn_cast<Instruction>(Base);
447 Instruction *I = dyn_cast<Instruction>(Base);
453 if (Opcode == Instruction::UIToFP || Opcode == Instruction::SIToFP) {
453 if (Opcode == Instruction::UIToFP || Opcode == Instruction::SIToFP) {
489 Instruction *NewInst =
lib/Transforms/Utils/Local.cpp 112 Instruction *T = BB->getTerminator();
359 bool llvm::isInstructionTriviallyDead(Instruction *I,
366 bool llvm::wouldInstructionBeTriviallyDead(Instruction *I,
442 Instruction *I = dyn_cast<Instruction>(V);
442 Instruction *I = dyn_cast<Instruction>(V);
446 SmallVector<Instruction*, 16> DeadInsts;
454 SmallVectorImpl<Instruction *> &DeadInsts, const TargetLibraryInfo *TLI,
458 Instruction &I = *DeadInsts.pop_back_val();
478 if (Instruction *OpI = dyn_cast<Instruction>(OpV))
478 if (Instruction *OpI = dyn_cast<Instruction>(OpV))
489 bool llvm::replaceDbgUsesWithUndef(Instruction *I) {
504 static bool areAllUsesEqual(Instruction *I) {
525 SmallPtrSet<Instruction*, 4> Visited;
526 for (Instruction *I = PN; areAllUsesEqual(I) && !I->mayHaveSideEffects();
527 I = cast<Instruction>(*I->user_begin())) {
544 simplifyAndDCEInstruction(Instruction *I,
545 SmallSetVector<Instruction *, 16> &WorkList,
563 if (Instruction *OpI = dyn_cast<Instruction>(OpV))
563 if (Instruction *OpI = dyn_cast<Instruction>(OpV))
578 WorkList.insert(cast<Instruction>(U));
612 AssertingVH<Instruction> TerminatorVH(&BB->back());
615 SmallSetVector<Instruction *, 16> WorkList;
622 Instruction *I = &*BI;
632 Instruction *I = WorkList.pop_back_val();
655 PhiIt = &*++BasicBlock::iterator(cast<Instruction>(PhiIt));
1048 Instruction *TI = BB->getTerminator();
1183 const Instruction *CxtI,
1214 Instruction *I) {
1276 static DebugLoc getDebugValueLoc(DbgVariableIntrinsic *DII, Instruction *Src) {
1341 Instruction *DbgValue = Builder.insertDbgValueIntrinsic(
1395 for (Instruction &BI : FI)
1456 for (auto &I : *BB) {
1479 Instruction *NewDbgII = DbgII->clone();
1540 Instruction *InsertBefore, DIBuilder &Builder,
1605 bool llvm::salvageDebugInfo(Instruction &I) {
1615 Instruction &I, ArrayRef<DbgVariableIntrinsic *> DbgUsers) {
1641 DIExpression *llvm::salvageDebugInfoImpl(Instruction &I,
1693 case Instruction::Add:
1695 case Instruction::Sub:
1697 case Instruction::Mul:
1699 case Instruction::SDiv:
1701 case Instruction::SRem:
1703 case Instruction::Or:
1705 case Instruction::And:
1707 case Instruction::Xor:
1709 case Instruction::Shl:
1711 case Instruction::LShr:
1713 case Instruction::AShr:
1733 Instruction &From, Value &To, Instruction &DomPoint, DominatorTree &DT,
1733 Instruction &From, Value &To, Instruction &DomPoint, DominatorTree &DT,
1744 if (isa<Instruction>(&To)) {
1821 bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To,
1822 Instruction &DomPoint, DominatorTree &DT) {
1881 Instruction *EndInst = BB->getTerminator(); // Last not to be deleted.
1884 Instruction *Inst = &*--EndInst->getIterator();
1898 unsigned llvm::changeToUnreachable(Instruction *I, bool UseLLVMTrap,
2026 for (Instruction &I : *BB) {
2100 Instruction *Terminator = BB->getTerminator();
2176 Instruction *TI = BB->getTerminator();
2183 Instruction *NewTI;
2249 Instruction *TI = BB->getTerminator();
2282 void llvm::combineMetadata(Instruction *K, const Instruction *J,
2282 void llvm::combineMetadata(Instruction *K, const Instruction *J,
2363 void llvm::combineMetadataForCSE(Instruction *K, const Instruction *J,
2363 void llvm::combineMetadataForCSE(Instruction *K, const Instruction *J,
2427 void llvm::patchReplacementInstruction(Instruction *I, Value *Repl) {
2428 auto *ReplInst = dyn_cast<Instruction>(Repl);
2428 auto *ReplInst = dyn_cast<Instruction>(Repl);
2479 unsigned llvm::replaceNonLocalUsesWith(Instruction *From, Value *To) {
2487 auto *I = cast<Instruction>(U.getUser());
2487 auto *I = cast<Instruction>(U.getUser());
2509 auto *I = cast<Instruction>(U.getUser())->getParent();
2584 void llvm::dropDebugUsers(Instruction &I) {
2591 void llvm::hoistAllInstructionsInto(BasicBlock *DomBlock, Instruction *InsertPt,
2615 Instruction *I = &*II;
2692 if (Instruction *I = dyn_cast<Instruction>(V)) {
2692 if (Instruction *I = dyn_cast<Instruction>(V)) {
2694 if (I->getOpcode() == Instruction::Or) {
2738 if (I->getOpcode() == Instruction::Shl) {
2751 if (I->getOpcode() == Instruction::And &&
2776 if (I->getOpcode() == Instruction::ZExt) {
2818 Instruction *I, bool MatchBSwaps, bool MatchBitReversals,
2819 SmallVectorImpl<Instruction *> &InsertedInsts) {
2820 if (Operator::getOpcode(I) != Instruction::Or)
2869 auto *Trunc = CastInst::Create(Instruction::Trunc, Provider, DemandedTy,
2876 auto *ExtInst = CastInst::Create(Instruction::ZExt, CI, ITy, "zext", I);
2901 bool llvm::canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx) {
2913 case Instruction::Call:
2914 case Instruction::Invoke:
2929 case Instruction::ShuffleVector:
2932 case Instruction::Switch:
2933 case Instruction::ExtractValue:
2936 case Instruction::InsertValue:
2939 case Instruction::Alloca:
2944 case Instruction::GetElementPtr:
lib/Transforms/Utils/LoopRotationUtils.cpp 123 Instruction *UserInst = cast<Instruction>(U.getUser());
123 Instruction *UserInst = cast<Instruction>(U.getUser());
185 return cast<Instruction>(U)->getParent() != HeaderExit;
307 Instruction *LoopEntryBranch = OrigPreheader->getTerminator();
325 Instruction *Inst = &*I++;
341 Instruction *C = Inst->clone();
541 case Instruction::GetElementPtr:
547 case Instruction::Add:
548 case Instruction::Sub:
549 case Instruction::And:
550 case Instruction::Or:
551 case Instruction::Xor:
552 case Instruction::Shl:
553 case Instruction::LShr:
554 case Instruction::AShr: {
566 auto *UserInst = cast<Instruction>(UseI);
566 auto *UserInst = cast<Instruction>(UseI);
577 case Instruction::Trunc:
578 case Instruction::ZExt:
579 case Instruction::SExt:
lib/Transforms/Utils/LoopSimplify.cpp 446 Instruction *TI = BackedgeBlocks[i]->getTerminator();
504 Instruction *TI = P->getTerminator();
641 Instruction *Inst = &*I++;
lib/Transforms/Utils/LoopUnroll.cpp 67 void llvm::remapInstruction(Instruction *I, ValueToValueMapTy &VMap) {
112 for (Instruction &I : *BB) {
114 if (auto Def = dyn_cast<Instruction>(U)) {
210 if (Instruction *Inst =
211 dyn_cast_or_null<Instruction>(&*DeadInsts.pop_back_val()))
221 Instruction *Inst = &*I++;
589 for (Instruction &I : *BB)
624 if (Instruction *InValI = dyn_cast<Instruction>(InVal))
624 if (Instruction *InValI = dyn_cast<Instruction>(InVal))
685 for (Instruction &I : *NewBlock) {
703 if (Instruction *InValI = dyn_cast<Instruction>(InVal)) {
703 if (Instruction *InValI = dyn_cast<Instruction>(InVal)) {
852 Instruction *Term = Iter->getTerminator();
lib/Transforms/Utils/LoopUnrollAndJam.cpp 74 Instruction *TI = BB->getTerminator();
94 SmallVector<Instruction *, 8> Worklist;
97 if (Instruction *I = dyn_cast<Instruction>(V))
97 if (Instruction *I = dyn_cast<Instruction>(V))
102 Instruction *I = Worklist.back();
109 if (Instruction *II = dyn_cast<Instruction>(U))
109 if (Instruction *II = dyn_cast<Instruction>(U))
119 Instruction *InsertLoc,
123 std::vector<Instruction *> Visited;
133 for (Instruction *I : reverse(Visited)) {
300 for (Instruction &I : *BB)
382 for (Instruction &I : *NewBlock) {
437 Instruction *insertPoint = Dest->getFirstNonPHI();
594 for (Instruction &I : *BB) {
619 Instruction *Src = cast<Instruction>(I);
619 Instruction *Src = cast<Instruction>(I);
620 Instruction *Dst = cast<Instruction>(J);
620 Instruction *Dst = cast<Instruction>(J);
lib/Transforms/Utils/LoopUnrollPeel.cpp 541 Instruction *LatchInst = dyn_cast<Instruction>(LatchVal);
541 Instruction *LatchInst = dyn_cast<Instruction>(LatchVal);
557 Instruction *LatchInst = dyn_cast<Instruction>(LatchVal);
557 Instruction *LatchInst = dyn_cast<Instruction>(LatchVal);
735 Instruction *LatchInst = dyn_cast<Instruction>(NewVal);
735 Instruction *LatchInst = dyn_cast<Instruction>(NewVal);
lib/Transforms/Utils/LoopUnrollRuntime.cpp 115 if (Instruction *I = dyn_cast<Instruction>(V)) {
115 if (Instruction *I = dyn_cast<Instruction>(V)) {
148 Instruction *InsertPt = PrologExit->getTerminator();
226 Instruction *I = dyn_cast<Instruction>(V);
226 Instruction *I = dyn_cast<Instruction>(V);
270 Instruction *InsertPt = NewExit->getTerminator();
679 auto *NewExitTerminator = NewExit->getTerminator();
802 for (auto &II : *BB) {
879 for (Instruction &I : *BB) {
lib/Transforms/Utils/LoopUtils.cpp 120 SmallVector<Instruction *, 8> llvm::findDefsUsedOutsideOfLoop(Loop *L) {
121 SmallVector<Instruction *, 8> UsedOutside;
126 for (auto &Inst : *Block) {
129 auto *Use = cast<Instruction>(U);
129 auto *Use = cast<Instruction>(U);
612 for (Instruction &I : *Block) {
617 if (auto *Usr = dyn_cast<Instruction>(U.getUser()))
617 if (auto *Usr = dyn_cast<Instruction>(U.getUser()))
643 Instruction *InsertDbgValueBefore = ExitBlock->getFirstNonPHI();
802 if (Op != Instruction::ICmp && Op != Instruction::FCmp) {
802 if (Op != Instruction::ICmp && Op != Instruction::FCmp) {
844 if (Op != Instruction::ICmp && Op != Instruction::FCmp) {
844 if (Op != Instruction::ICmp && Op != Instruction::FCmp) {
873 case Instruction::Add:
876 case Instruction::Mul:
879 case Instruction::And:
882 case Instruction::Or:
885 case Instruction::Xor:
888 case Instruction::FAdd:
895 case Instruction::FMul:
902 case Instruction::ICmp:
915 case Instruction::FCmp:
951 return createSimpleTargetReduction(B, TTI, Instruction::FAdd, Src, Flags);
953 return createSimpleTargetReduction(B, TTI, Instruction::FMul, Src, Flags);
955 return createSimpleTargetReduction(B, TTI, Instruction::Add, Src, Flags);
957 return createSimpleTargetReduction(B, TTI, Instruction::Mul, Src, Flags);
959 return createSimpleTargetReduction(B, TTI, Instruction::And, Src, Flags);
961 return createSimpleTargetReduction(B, TTI, Instruction::Or, Src, Flags);
963 return createSimpleTargetReduction(B, TTI, Instruction::Xor, Src, Flags);
968 return createSimpleTargetReduction(B, TTI, Instruction::ICmp, Src, Flags);
972 return createSimpleTargetReduction(B, TTI, Instruction::FCmp, Src, Flags);
980 auto *VecOp = dyn_cast<Instruction>(I);
980 auto *VecOp = dyn_cast<Instruction>(I);
983 auto *Intersection = (OpValue == nullptr) ? dyn_cast<Instruction>(VL[0])
983 auto *Intersection = (OpValue == nullptr) ? dyn_cast<Instruction>(VL[0])
984 : dyn_cast<Instruction>(OpValue);
990 auto *Instr = dyn_cast<Instruction>(V);
990 auto *Instr = dyn_cast<Instruction>(V);
lib/Transforms/Utils/LoopVersioning.cpp 55 const SmallVectorImpl<Instruction *> &DefsUsedOutside) {
56 Instruction *FirstCheckInst;
57 Instruction *MemRuntimeCheck;
78 RuntimeCheck = BinaryOperator::Create(Instruction::Or, MemRuntimeCheck,
80 if (auto *I = dyn_cast<Instruction>(RuntimeCheck))
80 if (auto *I = dyn_cast<Instruction>(RuntimeCheck))
109 Instruction *OrigTerm = RuntimeCheckBB->getTerminator();
124 const SmallVectorImpl<Instruction *> &DefsUsedOutside) {
131 for (auto *Inst : DefsUsedOutside) {
144 if (!VersionedLoop->contains(cast<Instruction>(U)->getParent()))
217 for (Instruction *I : LAI.getDepChecker().getMemoryInstructions()) {
222 void LoopVersioning::annotateInstWithNoAlias(Instruction *VersionedInst,
223 const Instruction *OrigInst) {
lib/Transforms/Utils/LowerMemIntrinsics.cpp 25 void llvm::createMemCpyLoopKnownSize(Instruction *InsertBefore, Value *SrcAddr,
135 void llvm::createMemCpyLoopUnknownSize(Instruction *InsertBefore,
287 static void createMemMoveLoop(Instruction *InsertBefore,
305 Instruction *ThenTerm, *ElseTerm;
368 static void createMemSetLoop(Instruction *InsertBefore,
lib/Transforms/Utils/LowerSwitch.cpp 364 Instruction* Add = BinaryOperator::CreateAdd(Val, NegLo,
lib/Transforms/Utils/MetaRenamer.cpp 152 for (auto &I : BB)
lib/Transforms/Utils/MisExpect.cpp 52 Instruction *getOprndOrInst(Instruction *I) {
52 Instruction *getOprndOrInst(Instruction *I) {
54 Instruction *Ret = nullptr;
56 Ret = dyn_cast<Instruction>(B->getCondition());
73 void emitMisexpectDiagnostic(Instruction *I, LLVMContext &Ctx,
83 Instruction *Cond = getOprndOrInst(I);
95 void verifyMisExpect(Instruction *I, const SmallVector<uint32_t, 4> &Weights,
147 void checkFrontendInstrumentation(Instruction &I) {
lib/Transforms/Utils/PredicateInfo.cpp 67 static Instruction *getBranchTerminator(const PredicateBase *PB) {
121 return OI.dfsBefore(cast<Instruction>(A), cast<Instruction>(B));
121 return OI.dfsBefore(cast<Instruction>(A), cast<Instruction>(B));
226 const Instruction *getDefOrUser(const Value *Def, const Use *U) const {
228 return cast<Instruction>(Def);
229 return cast<Instruction>(U->getUser());
294 if (auto *I = dyn_cast<Instruction>(U.getUser())) {
294 if (auto *I = dyn_cast<Instruction>(U.getUser())) {
333 if ((isa<Instruction>(Op0) || isa<Argument>(Op0)) && !Op0->hasOneUse())
335 if ((isa<Instruction>(Op1) || isa<Argument>(Op1)) && !Op1->hasOneUse())
429 if (BinOp->getOpcode() == Instruction::And)
431 else if (BinOp->getOpcode() == Instruction::Or)
464 if ((!isa<Instruction>(Op) && !isa<Argument>(Op)) || Op->hasOneUse())
787 Instruction *Inst = &*I++;
834 virtual void emitInstructionAnnot(const Instruction *I,
lib/Transforms/Utils/PromoteMemoryToRegister.cpp 136 Instruction *User = cast<Instruction>(*UI++);
136 Instruction *User = cast<Instruction>(*UI++);
186 DenseMap<const Instruction *, unsigned> InstNumbers;
191 static bool isInterestingInstruction(const Instruction *I) {
197 unsigned getInstructionIndex(const Instruction *I) {
202 DenseMap<const Instruction *, unsigned>::iterator It = InstNumbers.find(I);
211 for (const Instruction &BBI : *BB)
220 void deleteValue(const Instruction *I) { InstNumbers.erase(I); }
320 Instruction *I = cast<Instruction>(*UI);
320 Instruction *I = cast<Instruction>(*UI);
330 Instruction *Inst = cast<Instruction>(*UUI);
330 Instruction *Inst = cast<Instruction>(*UUI);
351 bool StoringGlobalVal = !isa<Instruction>(OnlyStore->getOperand(0));
359 Instruction *UserInst = cast<Instruction>(*UI++);
359 Instruction *UserInst = cast<Instruction>(*UI++);
661 for (Instruction *A : Allocas) {
933 Instruction *I = &*II++; // get the instruction, increment iterator
lib/Transforms/Utils/SSAUpdater.cpp 178 if (const Instruction *I = BB->getFirstNonPHI())
190 Instruction *User = cast<Instruction>(U.getUser());
190 Instruction *User = cast<Instruction>(U.getUser());
207 Instruction *User = cast<Instruction>(U.getUser());
207 Instruction *User = cast<Instruction>(U.getUser());
293 static PHINode *InstrIsPHI(Instruction *I) {
337 LoadAndStorePromoter(ArrayRef<const Instruction *> Insts,
352 void LoadAndStorePromoter::run(const SmallVectorImpl<Instruction *> &Insts) {
356 DenseMap<BasicBlock *, TinyPtrVector<Instruction *>> UsesByBlock;
358 for (Instruction *User : Insts)
367 for (Instruction *User : Insts) {
369 TinyPtrVector<Instruction *> &BlockUses = UsesByBlock[BB];
390 for (Instruction *I : BlockUses) {
401 for (Instruction *I : BlockUses)
413 for (Instruction &I : *BB) {
463 for (Instruction *User : Insts) {
491 LoadAndStorePromoter::isInstInList(Instruction *I,
492 const SmallVectorImpl<Instruction *> &Insts)
lib/Transforms/Utils/SSAUpdaterBulk.cpp 30 auto *User = cast<Instruction>(U->getUser());
30 auto *User = cast<Instruction>(U->getUser());
lib/Transforms/Utils/SimplifyCFG.cpp 185 Value *isValueEqualityComparison(Instruction *TI);
187 Instruction *TI, std::vector<ValueEqualityComparisonCase> &Cases);
188 bool SimplifyEqualityComparisonWithOnlyPredecessor(Instruction *TI,
191 bool FoldValueComparisonIntoPredecessors(Instruction *TI,
229 SafeToMergeTerminators(Instruction *SI1, Instruction *SI2,
229 SafeToMergeTerminators(Instruction *SI1, Instruction *SI2,
262 Instruction *Cond,
340 SmallPtrSetImpl<Instruction *> &AggressiveInsts,
351 Instruction *I = dyn_cast<Instruction>(V);
351 Instruction *I = dyn_cast<Instruction>(V);
425 if (CE->getOpcode() == Instruction::IntToPtr)
465 ConstantComparesGatherer(Instruction *Cond, const DataLayout &DL) : DL(DL) {
490 bool matchInstruction(Instruction *I, bool isEQ) {
635 bool isEQ = (cast<Instruction>(V)->getOpcode() == Instruction::Or);
635 bool isEQ = (cast<Instruction>(V)->getOpcode() == Instruction::Or);
648 if (Instruction *I = dyn_cast<Instruction>(V)) {
648 if (Instruction *I = dyn_cast<Instruction>(V)) {
650 if (I->getOpcode() == (isEQ ? Instruction::Or : Instruction::And)) {
650 if (I->getOpcode() == (isEQ ? Instruction::Or : Instruction::And)) {
680 static void EraseTerminatorAndDCECond(Instruction *TI,
682 Instruction *Cond = nullptr;
684 Cond = dyn_cast<Instruction>(SI->getCondition());
687 Cond = dyn_cast<Instruction>(BI->getCondition());
689 Cond = dyn_cast<Instruction>(IBI->getAddress());
699 Value *SimplifyCFGOpt::isValueEqualityComparison(Instruction *TI) {
727 Instruction *TI, std::vector<ValueEqualityComparisonCase> &Cases) {
799 static void setBranchWeights(Instruction *I, uint32_t TrueWeight,
817 Instruction *TI, BasicBlock *Pred, IRBuilder<> &Builder) {
855 Instruction *NI = Builder.CreateBr(ThisDef);
923 Instruction *NI = Builder.CreateBr(TheRealDest);
956 static inline bool HasBranchWeights(const Instruction *I) {
968 static void GetBranchWeights(Instruction *TI,
1002 bool SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(Instruction *TI,
1014 Instruction *PTI = Pred->getTerminator();
1219 Instruction *I1, Instruction *I2) {
1219 Instruction *I1, Instruction *I2) {
1232 static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I);
1250 Instruction *I1 = &*BB1_Itr++, *I2 = &*BB2_Itr++;
1376 Instruction *NT = I1->clone();
1427 static bool isLifeTimeMarker(const Instruction *I) {
1446 ArrayRef<Instruction *> Insts,
1447 DenseMap<Instruction *, SmallVector<Value *, 4>> &PHIOperands) {
1452 for (auto *I : Insts) {
1472 const Instruction *I0 = Insts.front();
1473 for (auto *I : Insts)
1485 auto *U = cast<Instruction>(*I->user_begin());
1534 for (auto *I : Insts)
1549 SmallVector<Instruction*,4> Insts;
1551 Instruction *I = BB->getTerminator();
1563 Instruction *I0 = Insts.front();
1567 auto *U = cast<Instruction>(*I->user_begin());
1596 for (auto *I : Insts)
1608 for (auto *I : Insts)
1632 for (auto *I : Insts)
1651 SmallVector<Instruction*,4> Insts;
1663 Instruction *Inst = BB->getTerminator();
1682 for (auto *&Inst : Insts) {
1693 ArrayRef<Instruction*> operator * () const {
1747 Instruction *Cond = nullptr;
1749 auto *T = B->getTerminator();
1769 DenseMap<Instruction*, SmallVector<Value*,4>> PHIOperands;
1782 for (auto *I : *LRI)
1884 static Value *isSafeToSpeculateStore(Instruction *I, BasicBlock *BrBB,
1898 for (Instruction &CurI : reverse(BrBB->instructionsWithoutDebug())) {
1980 SmallDenseMap<Instruction *, unsigned, 4> SinkCandidateUseCounts;
1982 SmallVector<Instruction *, 4> SpeculatedDbgIntrinsics;
1990 Instruction *I = &*BBI;
2021 Instruction *OpI = dyn_cast<Instruction>(*i);
2021 Instruction *OpI = dyn_cast<Instruction>(*i);
2032 for (SmallDenseMap<Instruction *, unsigned, 4>::iterator
2107 for (auto &I : *ThenBB)
2141 for (Instruction *I : SpeculatedDbgIntrinsics)
2152 for (Instruction &I : BB->instructionsWithoutDebug()) {
2160 Instruction *UI = cast<Instruction>(U);
2160 Instruction *UI = cast<Instruction>(U);
2242 Instruction *N = BBI->clone();
2277 Instruction *PredBBTI = PredBB->getTerminator();
2326 SmallPtrSet<Instruction *, 4> AggressiveInsts;
2411 Instruction *InsertPt = DomBlock->getTerminator();
2435 Instruction *OldTI = DomBlock->getTerminator();
2532 static bool tryCSEWithPredecessor(Instruction *Inst, BasicBlock *PB) {
2535 for (Instruction &I : *PB) {
2536 Instruction *PBI = &I;
2579 Instruction *Cond = nullptr;
2581 Cond = dyn_cast<Instruction>(BI->getCondition());
2595 Instruction *Curr = &*I++;
2638 Instruction *User = dyn_cast<Instruction>(I->user_back());
2638 Instruction *User = dyn_cast<Instruction>(I->user_back());
2683 Instruction::BinaryOps Opc = Instruction::BinaryOpsEnd;
2683 Instruction::BinaryOps Opc = Instruction::BinaryOpsEnd;
2688 Opc = Instruction::Or;
2690 Opc = Instruction::And;
2692 Opc = Instruction::And;
2695 Opc = Instruction::Or;
2734 Instruction *NewBonusInst = BonusInst->clone();
2753 Instruction *CondInPred = Cond->clone();
2761 Instruction *NewCond = cast<Instruction>(
2761 Instruction *NewCond = cast<Instruction>(
2818 Instruction *MergedCond = nullptr;
2823 Instruction *NotCond = cast<Instruction>(
2823 Instruction *NotCond = cast<Instruction>(
2825 MergedCond = cast<Instruction>(
2826 Builder.CreateBinOp(Instruction::And, NotCond, CondInPred,
2829 MergedCond = cast<Instruction>(Builder.CreateBinOp(
2830 Instruction::Or, PBI->getCondition(), MergedCond, "or.cond"));
2835 MergedCond = cast<Instruction>(Builder.CreateBinOp(
2836 Instruction::And, PBI->getCondition(), CondInPred, "and.cond"));
2838 Instruction *NotCond = cast<Instruction>(
2838 Instruction *NotCond = cast<Instruction>(
2840 MergedCond = cast<Instruction>(Builder.CreateBinOp(
2841 Instruction::Or, NotCond, MergedCond, "or.cond"));
2868 for (Instruction &I : *BB)
2884 for (auto &I : *BB)
2933 (!isa<Instruction>(V) || cast<Instruction>(V)->getParent() != BB))
2933 (!isa<Instruction>(V) || cast<Instruction>(V)->getParent() != BB))
2976 for (auto &I : *QFB->getSinglePredecessor())
2979 for (auto &I : *QFB)
2983 for (auto &I : *QTB)
3001 for (auto &I : BB->instructionsWithoutDebug()) {
3069 auto *T =
3191 for (auto &I : *BB)
3198 for (auto &I : *BB)
3458 static bool SimplifyTerminatorOnSelect(Instruction *OldTerm, Value *Cond,
3694 Instruction *Cond = dyn_cast<Instruction>(BI->getCondition());
3694 Instruction *Cond = dyn_cast<Instruction>(BI->getCondition());
3718 bool TrueWhenEqual = (Cond->getOpcode() == Instruction::Or);
3757 Instruction *OldTI = BB->getTerminator();
3824 BasicBlock::iterator I = cast<Instruction>(RI->getValue())->getIterator(),
3965 Instruction *DestEHPad = UnwindDest ? UnwindDest->getFirstNonPHI() : nullptr;
4020 Instruction *InsertPt = DestEHPad;
4049 Instruction *TI = PredBB->getTerminator();
4118 Instruction *PTI = P->getTerminator();
4223 Instruction *TI = Preds[i]->getTerminator();
4330 auto *NewTerminator = NewDefaultBlock->getTerminator();
4644 ConstantFold(Instruction *I, const DataLayout &DL,
4689 for (Instruction &I :CaseDest->instructionsWithoutDebug()) {
4704 if (Instruction *I = dyn_cast<Instruction>(User))
4704 if (Instruction *I = dyn_cast<Instruction>(User))
5779 Instruction &Inst = *I;
5881 } else if (&*I == cast<Instruction>(BI->getCondition())) {
5922 Instruction *Succ0TI = BI->getSuccessor(0)->getTerminator();
5931 Instruction *Succ1TI = BI->getSuccessor(1)->getTerminator();
5964 static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I) {
5980 UI = BasicBlock::iterator(dyn_cast<Instruction>(Use));
6021 Instruction *T = PHI.getIncomingBlock(i)->getTerminator();
lib/Transforms/Utils/SimplifyIndVar.cpp 78 Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
78 Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
80 bool eliminateIdentitySCEV(Instruction *UseInst, Instruction *IVOperand);
80 bool eliminateIdentitySCEV(Instruction *UseInst, Instruction *IVOperand);
81 bool replaceIVUserWithLoopInvariant(Instruction *UseInst);
86 bool eliminateIVUser(Instruction *UseInst, Instruction *IVOperand);
86 bool eliminateIVUser(Instruction *UseInst, Instruction *IVOperand);
108 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) {
108 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) {
116 case Instruction::UDiv:
117 case Instruction::LShr:
135 if (UseInst->getOpcode() == Instruction::LShr) {
405 static bool willNotOverflow(ScalarEvolution *SE, Instruction::BinaryOps BinOp,
412 case Instruction::Add:
415 case Instruction::Sub:
418 case Instruction::Mul:
541 if (isa<Instruction>(U) &&
542 !DT->isReachableFromEntry(cast<Instruction>(U)->getParent()))
581 Instruction *Ext = nullptr;
616 bool SimplifyIndvar::eliminateIVUser(Instruction *UseInst,
617 Instruction *IVOperand) {
623 bool IsSRem = Bin->getOpcode() == Instruction::SRem;
624 if (IsSRem || Bin->getOpcode() == Instruction::URem) {
629 if (Bin->getOpcode() == Instruction::SDiv)
651 static Instruction *GetLoopInvariantInsertPosition(Loop *L, Instruction *Hint) {
651 static Instruction *GetLoopInvariantInsertPosition(Loop *L, Instruction *Hint) {
659 bool SimplifyIndvar::replaceIVUserWithLoopInvariant(Instruction *I) {
673 auto *IP = GetLoopInvariantInsertPosition(L, I);
686 bool SimplifyIndvar::eliminateIdentitySCEV(Instruction *UseInst,
687 Instruction *IVOperand) {
735 if (BO->getOpcode() != Instruction::Add &&
736 BO->getOpcode() != Instruction::Sub &&
737 BO->getOpcode() != Instruction::Mul)
768 if (BO->getOpcode() == Instruction::Shl) {
792 Instruction *Def, Loop *L,
793 SmallPtrSet<Instruction*,16> &Simplified,
794 SmallVectorImpl< std::pair<Instruction*,Instruction*> > &SimpleIVUsers) {
794 SmallVectorImpl< std::pair<Instruction*,Instruction*> > &SimpleIVUsers) {
797 Instruction *UI = cast<Instruction>(U);
797 Instruction *UI = cast<Instruction>(U);
825 static bool isSimpleIVUser(Instruction *I, const Loop *L, ScalarEvolution *SE) {
857 SmallPtrSet<Instruction*,16> Simplified;
860 SmallVector<std::pair<Instruction*, Instruction*>, 8> SimpleIVUsers;
860 SmallVector<std::pair<Instruction*, Instruction*>, 8> SimpleIVUsers;
868 std::pair<Instruction*, Instruction*> UseOper =
868 std::pair<Instruction*, Instruction*> UseOper =
870 Instruction *UseInst = UseOper.first;
889 Instruction *IVOperand = UseOper.second;
896 IVOperand = dyn_cast<Instruction>(NewOper);
lib/Transforms/Utils/SimplifyLibCalls.cpp 1413 Value *Op = cast<Instruction>(I2F)->getOperand(0);
1976 Instruction *I = dyn_cast<Instruction>(CI->getArgOperand(0));
1976 Instruction *I = dyn_cast<Instruction>(CI->getArgOperand(0));
1977 if (!I || I->getOpcode() != Instruction::FMul || !I->isFast())
1999 if (OtherMul0 == OtherMul1 && cast<Instruction>(Op0)->isFast()) {
2095 if (Instruction *ArgInst = dyn_cast<Instruction>(Arg)) {
2095 if (Instruction *ArgInst = dyn_cast<Instruction>(Arg)) {
3130 function_ref<void(Instruction *, Value *)> Replacer,
3131 function_ref<void(Instruction *)> Eraser)
3135 void LibCallSimplifier::replaceAllUsesWith(Instruction *I, Value *With) {
3140 void LibCallSimplifier::eraseFromParent(Instruction *I) {
lib/Transforms/Utils/SplitModule.cpp 65 if (const Instruction *I = dyn_cast<Instruction>(U)) {
65 if (const Instruction *I = dyn_cast<Instruction>(U)) {
lib/Transforms/Utils/StripGCRelocates.cpp 48 for (Instruction &I : instructions(F)) {
lib/Transforms/Utils/VNCoercion.cpp 388 Instruction *InsertPt, const DataLayout &DL) {
408 Instruction *InsertPt, const DataLayout &DL) {
520 Type *LoadTy, Instruction *InsertPt,
lib/Transforms/Utils/ValueMapper.cpp 145 void remapInstruction(Instruction *I);
852 void Mapper::remapInstruction(Instruction *I) {
951 for (Instruction &I : BB)
1110 void ValueMapper::remapInstruction(Instruction &I) {
lib/Transforms/Vectorize/LoadStoreVectorizer.cpp 108 using InstrList = SmallVector<Instruction *, 8>;
159 void reorder(Instruction *I);
166 void eraseInstructions(ArrayRef<Instruction *> Chain);
172 std::pair<ArrayRef<Instruction *>, ArrayRef<Instruction *>>
172 std::pair<ArrayRef<Instruction *>, ArrayRef<Instruction *>>
173 splitOddVectorElts(ArrayRef<Instruction *> Chain, unsigned ElementSizeBits);
181 ArrayRef<Instruction *> getVectorizablePrefix(ArrayRef<Instruction *> Chain);
181 ArrayRef<Instruction *> getVectorizablePrefix(ArrayRef<Instruction *> Chain);
191 bool vectorizeInstructions(ArrayRef<Instruction *> Instrs);
195 vectorizeLoadChain(ArrayRef<Instruction *> Chain,
196 SmallPtrSet<Instruction *, 16> *InstructionsProcessed);
200 vectorizeStoreChain(ArrayRef<Instruction *> Chain,
201 SmallPtrSet<Instruction *, 16> *InstructionsProcessed);
283 static void propagateMetadata(Instruction *I, ArrayRef<Instruction *> IL) {
283 static void propagateMetadata(Instruction *I, ArrayRef<Instruction *> IL) {
417 Instruction *OpA = dyn_cast<Instruction>(GTIA.getOperand());
417 Instruction *OpA = dyn_cast<Instruction>(GTIA.getOperand());
418 Instruction *OpB = dyn_cast<Instruction>(GTIB.getOperand());
418 Instruction *OpB = dyn_cast<Instruction>(GTIB.getOperand());
443 OpB = dyn_cast<Instruction>(OpB->getOperand(0));
451 if (OpB->getOpcode() == Instruction::Add &&
467 OpA = dyn_cast<Instruction>(ValA);
504 void Vectorizer::reorder(Instruction *I) {
506 SmallPtrSet<Instruction *, 16> InstructionsToMove;
507 SmallVector<Instruction *, 16> Worklist;
511 Instruction *IW = Worklist.pop_back_val();
514 Instruction *IM = dyn_cast<Instruction>(IW->getOperand(i));
514 Instruction *IM = dyn_cast<Instruction>(IW->getOperand(i));
515 if (!IM || IM->getOpcode() == Instruction::PHI)
535 Instruction *IM = &*BBI;
544 Instruction *C0 = Chain[0];
550 for (Instruction &I : *BB) {
568 void Vectorizer::eraseInstructions(ArrayRef<Instruction *> Chain) {
569 SmallVector<Instruction *, 16> Instrs;
570 for (Instruction *I : Chain) {
579 for (Instruction *I : Instrs)
584 std::pair<ArrayRef<Instruction *>, ArrayRef<Instruction *>>
584 std::pair<ArrayRef<Instruction *>, ArrayRef<Instruction *>>
585 Vectorizer::splitOddVectorElts(ArrayRef<Instruction *> Chain,
600 ArrayRef<Instruction *>
601 Vectorizer::getVectorizablePrefix(ArrayRef<Instruction *> Chain) {
603 SmallVector<Instruction *, 16> MemoryInstrs;
604 SmallVector<Instruction *, 16> ChainInstrs;
618 for (Instruction &I : make_range(getBoundaryInstrs(Chain))) {
643 Instruction *BarrierMemoryInstr = nullptr;
646 Instruction *ChainInstr = ChainInstrs[ChainInstrIdx];
655 for (Instruction *MemInstr : MemoryInstrs) {
716 SmallPtrSet<Instruction *, 8> VectorizableChainInstrs(
745 for (Instruction &I : *BB) {
861 ArrayRef<Instruction *> Chunk(&Chain.second[CI], Len);
869 bool Vectorizer::vectorizeInstructions(ArrayRef<Instruction *> Instrs) {
899 SmallPtrSet<Instruction *, 16> InstructionsProcessed;
916 SmallVector<Instruction *, 16> Operands;
939 ArrayRef<Instruction *> Chain,
940 SmallPtrSet<Instruction *, 16> *InstructionsProcessed) {
945 for (Instruction *I : Chain) {
970 ArrayRef<Instruction *> NewChain = getVectorizablePrefix(Chain);
1090 ArrayRef<Instruction *> Chain,
1091 SmallPtrSet<Instruction *, 16> *InstructionsProcessed) {
1121 ArrayRef<Instruction *> NewChain = getVectorizablePrefix(Chain);
1200 SmallVector<Instruction *, 16> InstrsToErase;
1207 Instruction *UI = cast<Instruction>(Use);
1207 Instruction *UI = cast<Instruction>(Use);
1223 if (Instruction *BitcastInst = dyn_cast<Instruction>(Bitcast))
1223 if (Instruction *BitcastInst = dyn_cast<Instruction>(Bitcast))
1241 if (Instruction *BitcastInst = dyn_cast<Instruction>(Bitcast))
1241 if (Instruction *BitcastInst = dyn_cast<Instruction>(Bitcast))
lib/Transforms/Vectorize/LoopVectorizationLegality.cpp 391 static bool hasOutsideLoopUser(const Loop *TheLoop, Instruction *Inst,
398 Instruction *UI = cast<Instruction>(U);
398 Instruction *UI = cast<Instruction>(U);
500 const SmallVectorImpl<Instruction *> &Casts = ID.getCastInsts();
580 for (Instruction &I : *BB) {
861 auto *Inst = dyn_cast<Instruction>(V);
881 for (Instruction &I : *BB) {
943 for (Instruction &I : *BB)
955 for (Instruction &I : *BB) {
1210 Instruction *UI = cast<Instruction>(U);
1210 Instruction *UI = cast<Instruction>(U);
lib/Transforms/Vectorize/LoopVectorizationPlanner.h 118 Instruction *Inst = nullptr) {
125 Instruction *Inst = nullptr) {
134 return createInstruction(Instruction::BinaryOps::And, {LHS, RHS});
138 return createInstruction(Instruction::BinaryOps::Or, {LHS, RHS});
260 SmallPtrSetImpl<Instruction *> &DeadInstructions);
277 SmallPtrSetImpl<Instruction *> &DeadInstructions);
lib/Transforms/Vectorize/LoopVectorize.cpp 342 cast<Instruction>(V)->setFastMathFlags(FastMathFlags::getFast());
348 cast<Instruction>(V)->setFastMathFlags(FMF);
418 void widenInstruction(Instruction &I);
434 void widenPHIInstruction(Instruction *PN, unsigned UF, unsigned VF);
440 void scalarizeInstruction(Instruction *Instr, const VPIteration &Instance,
482 void vectorizeInterleaveGroup(Instruction *Instr,
487 void vectorizeMemoryInstruction(Instruction *Instr,
516 Value *Step, Instruction *DL);
537 void sinkScalarOperands(Instruction *PredInst);
558 Instruction::BinaryOps Opcode =
559 Instruction::BinaryOpsEnd);
566 void buildScalarSteps(Value *ScalarIV, Value *Step, Instruction *EntryVal,
575 Value *Step, Instruction *EntryVal);
579 bool shouldScalarizeInstruction(Instruction *I) const;
582 bool needsScalarInduction(Instruction *IV) const;
603 const Instruction *EntryVal,
648 void addNewMetadata(Instruction *To, const Instruction *Orig);
648 void addNewMetadata(Instruction *To, const Instruction *Orig);
655 void addMetadata(Instruction *To, Instruction *From);
655 void addMetadata(Instruction *To, Instruction *From);
659 void addMetadata(ArrayRef<Value *> To, Instruction *From);
744 SmallVector<Instruction *, 4> PredicatedInstructions;
785 Instruction::BinaryOps Opcode =
786 Instruction::BinaryOpsEnd) override;
794 static Instruction *getDebugLocFromInstOrOperands(Instruction *I) {
794 static Instruction *getDebugLocFromInstOrOperands(Instruction *I) {
803 if (Instruction *OpInst = dyn_cast<Instruction>(*OI))
803 if (Instruction *OpInst = dyn_cast<Instruction>(*OI))
812 if (const Instruction *Inst = dyn_cast_or_null<Instruction>(Ptr)) {
812 if (const Instruction *Inst = dyn_cast_or_null<Instruction>(Ptr)) {
835 Instruction *I) {
853 StringRef RemarkName, Loop *TheLoop, Instruction *I) {
874 OptimizationRemarkEmitter *ORE, Loop *TheLoop, Instruction *I) {
900 void InnerLoopVectorizer::addNewMetadata(Instruction *To,
901 const Instruction *Orig) {
908 void InnerLoopVectorizer::addMetadata(Instruction *To,
909 Instruction *From) {
915 Instruction *From) {
917 if (Instruction *I = dyn_cast<Instruction>(V))
917 if (Instruction *I = dyn_cast<Instruction>(V))
1027 const MapVector<Instruction *, uint64_t> &getMinimalBitwidths() const {
1033 bool isProfitableToScalarize(Instruction *I, unsigned VF) const {
1048 bool isUniformAfterVectorization(Instruction *I, unsigned VF) const {
1064 bool isScalarAfterVectorization(Instruction *I, unsigned VF) const {
1081 bool canTruncateToMinimalBitwidth(Instruction *I, unsigned VF) const {
1099 void setWideningDecision(Instruction *I, unsigned VF, InstWidening W,
1107 void setWideningDecision(const InterleaveGroup<Instruction> *Grp, unsigned VF,
1113 if (auto *I = Grp->getMember(i)) {
1125 InstWidening getWideningDecision(Instruction *I, unsigned VF) {
1133 std::pair<Instruction *, unsigned> InstOnVF = std::make_pair(I, VF);
1142 unsigned getWideningCost(Instruction *I, unsigned VF) {
1144 std::pair<Instruction *, unsigned> InstOnVF = std::make_pair(I, VF);
1153 bool isOptimizableIVTruncate(Instruction *I, unsigned VF) {
1234 bool isScalarWithPredication(Instruction *I, unsigned VF = 1);
1239 bool isPredicatedInst(Instruction *I) {
1251 bool memoryInstructionCanBeWidened(Instruction *I, unsigned VF = 1);
1256 bool interleavedAccessCanBeWidened(Instruction *I, unsigned VF = 1);
1259 bool isAccessInterleaved(Instruction *Instr) {
1264 const InterleaveGroup<Instruction> *
1265 getInterleavedAccessGroup(Instruction *Instr) {
1325 VectorizationCostTy getInstructionCost(Instruction *I, unsigned VF);
1329 unsigned getInstructionCost(Instruction *I, unsigned VF, Type *&VectorTy);
1332 unsigned getMemoryInstructionCost(Instruction *I, unsigned VF);
1335 unsigned getMemInstScalarizationCost(Instruction *I, unsigned VF);
1338 unsigned getInterleaveGroupCost(Instruction *I, unsigned VF);
1341 unsigned getGatherScatterCost(Instruction *I, unsigned VF);
1345 unsigned getConsecutiveMemOpCost(Instruction *I, unsigned VF);
1351 unsigned getUniformMemOpCost(Instruction *I, unsigned VF);
1355 unsigned getScalarizationOverhead(Instruction *I, unsigned VF);
1359 bool isConsecutiveLoadOrStore(Instruction *I);
1363 bool useEmulatedMaskMemRefHack(Instruction *I);
1368 MapVector<Instruction *, uint64_t> MinBWs;
1373 using ScalarCostsTy = DenseMap<Instruction *, unsigned>;
1399 DenseMap<unsigned, SmallPtrSet<Instruction *, 4>> Uniforms;
1403 DenseMap<unsigned, SmallPtrSet<Instruction *, 4>> Scalars;
1407 DenseMap<unsigned, SmallPtrSet<Instruction *, 4>> ForcedScalars;
1414 int computePredInstDiscount(Instruction *PredInst, ScalarCostsTy &ScalarCosts,
1437 using DecisionList = DenseMap<std::pair<Instruction *, unsigned>,
1445 Instruction *I = dyn_cast<Instruction>(V);
1445 Instruction *I = dyn_cast<Instruction>(V);
1659 Instruction *Instr = dyn_cast<Instruction>(V);
1659 Instruction *Instr = dyn_cast<Instruction>(V);
1675 const InductionDescriptor &II, Value *Step, Instruction *EntryVal) {
1688 Start = Builder.CreateCast(Instruction::Trunc, Start, TruncType);
1696 Instruction::BinaryOps AddOp;
1697 Instruction::BinaryOps MulOp;
1699 AddOp = Instruction::Add;
1700 MulOp = Instruction::Mul;
1703 MulOp = Instruction::FMul;
1726 Instruction *LastInduction = VecInd;
1734 LastInduction = cast<Instruction>(addFastMathFlag(
1743 auto *ICmp = cast<Instruction>(Br->getCondition());
1743 auto *ICmp = cast<Instruction>(Br->getCondition());
1751 bool InnerLoopVectorizer::shouldScalarizeInstruction(Instruction *I) const {
1756 bool InnerLoopVectorizer::needsScalarInduction(Instruction *IV) const {
1760 auto *I = cast<Instruction>(U);
1760 auto *I = cast<Instruction>(U);
1767 const InductionDescriptor &ID, const Instruction *EntryVal,
1781 const SmallVectorImpl<Instruction *> &Casts = ID.getCastInsts();
1787 Instruction *CastInst = *Casts.begin();
1810 Instruction *EntryVal = Trunc ? cast<Instruction>(Trunc) : IV;
1810 Instruction *EntryVal = Trunc ? cast<Instruction>(Trunc) : IV;
1852 : Builder.CreateCast(Instruction::SIToFP, Induction,
1892 Instruction::BinaryOps BinOp) {
1937 if (isa<Instruction>(MulOp))
1939 cast<Instruction>(MulOp)->setFastMathFlags(Flags);
1942 if (isa<Instruction>(BOp))
1943 cast<Instruction>(BOp)->setFastMathFlags(Flags);
1948 Instruction *EntryVal,
1960 Instruction::BinaryOps AddOp;
1961 Instruction::BinaryOps MulOp;
1963 AddOp = Instruction::Add;
1964 MulOp = Instruction::Mul;
1967 MulOp = Instruction::FMul;
1974 Cost->isUniformAfterVectorization(cast<Instruction>(EntryVal), VF) ? 1
2009 auto *I = cast<Instruction>(V);
2009 auto *I = cast<Instruction>(V);
2023 auto *LastInst = cast<Instruction>(
2023 auto *LastInst = cast<Instruction>(
2158 void InnerLoopVectorizer::vectorizeInterleaveGroup(Instruction *Instr,
2160 const InterleaveGroup<Instruction> *Group =
2240 Instruction *NewLoad;
2251 ? Builder.CreateBinOp(Instruction::And, ShuffledMask,
2269 Instruction *Member = Group->getMember(I);
2304 Instruction *Member = Group->getMember(i);
2328 Instruction *NewStoreInstr;
2345 void InnerLoopVectorizer::vectorizeMemoryInstruction(Instruction *Instr,
2426 Instruction *NewSI = nullptr;
2484 void InnerLoopVectorizer::scalarizeInstruction(Instruction *Instr,
2494 Instruction *Cloned = Instr->clone();
2524 Instruction *DL) {
2533 Instruction *OldInst = getDebugLocFromInstOrOperands(OldInduction);
2753 Instruction *FirstCheckInst;
2754 Instruction *MemRuntimeCheck;
2866 if (isa<Instruction>(MulExp))
2868 cast<Instruction>(MulExp)->setFastMathFlags(Flags);
2872 if (isa<Instruction>(BOp))
2873 cast<Instruction>(BOp)->setFastMathFlags(Flags);
3018 Instruction::CastOps CastOp =
3054 CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_EQ, Count,
3061 cast<Instruction>(CmpN)->setDebugLoc(ScalarLatchBr->getDebugLoc());
3122 Instruction *UI = cast<Instruction>(U);
3122 Instruction *UI = cast<Instruction>(U);
3133 auto *UI = cast<Instruction>(U);
3133 auto *UI = cast<Instruction>(U);
3144 ? B.CreateCast(Instruction::SIToFP, CountMinusOne,
3169 static bool canHandle(const Instruction *I) {
3174 static inline Instruction *getEmptyKey() {
3175 return DenseMapInfo<Instruction *>::getEmptyKey();
3178 static inline Instruction *getTombstoneKey() {
3179 return DenseMapInfo<Instruction *>::getTombstoneKey();
3182 static unsigned getHashValue(const Instruction *I) {
3188 static bool isEqual(const Instruction *LHS, const Instruction *RHS) {
3188 static bool isEqual(const Instruction *LHS, const Instruction *RHS) {
3201 SmallDenseMap<Instruction *, Instruction *, 4, CSEDenseMapInfo> CSEMap;
3201 SmallDenseMap<Instruction *, Instruction *, 4, CSEDenseMapInfo> CSEMap;
3203 Instruction *In = &*I++;
3210 if (Instruction *V = CSEMap.lookup(In)) {
3302 !isa<Instruction>(I))
3312 IRBuilder<> B(cast<Instruction>(I));
3343 case Instruction::Trunc:
3346 case Instruction::SExt:
3351 case Instruction::ZExt:
3386 NewI->takeName(cast<Instruction>(I));
3389 cast<Instruction>(I)->eraseFromParent();
3450 for (Instruction *PI : PredicatedInstructions)
3543 cast<Instruction>(VectorLoopValueMap.getVectorValue(Phi, 0)));
3564 &*++BasicBlock::iterator(cast<Instruction>(PreviousLastPart)));
3586 cast<Instruction>(PhiPart)->eraseFromParent();
3651 Instruction *LoopExitInst = RdxDesc.getLoopExitInstr();
3785 if (Op != Instruction::ICmp && Op != Instruction::FCmp)
3785 if (Op != Instruction::ICmp && Op != Instruction::FCmp)
3849 if (isa<Instruction>(IncomingValue))
3851 cast<Instruction>(IncomingValue), VF)
3864 void InnerLoopVectorizer::sinkScalarOperands(Instruction *PredInst) {
3874 SmallVector<Instruction *, 8> InstsToReanalyze;
3879 auto *I = cast<Instruction>(U.getUser());
3879 auto *I = cast<Instruction>(U.getUser());
3900 auto *I = dyn_cast<Instruction>(Worklist.pop_back_val());
3900 auto *I = dyn_cast<Instruction>(Worklist.pop_back_val());
3964 void InnerLoopVectorizer::widenPHIInstruction(Instruction *PN, unsigned UF,
4051 static bool mayDivideByZero(Instruction &I) {
4062 void InnerLoopVectorizer::widenInstruction(Instruction &I) {
4064 case Instruction::Br:
4065 case Instruction::PHI:
4067 case Instruction::GetElementPtr: {
4088 auto *Clone = Builder.Insert(GEP->clone());
4136 case Instruction::UDiv:
4137 case Instruction::SDiv:
4138 case Instruction::SRem:
4139 case Instruction::URem:
4140 case Instruction::Add:
4141 case Instruction::FAdd:
4142 case Instruction::Sub:
4143 case Instruction::FSub:
4144 case Instruction::FNeg:
4145 case Instruction::Mul:
4146 case Instruction::FMul:
4147 case Instruction::FDiv:
4148 case Instruction::FRem:
4149 case Instruction::Shl:
4150 case Instruction::LShr:
4151 case Instruction::AShr:
4152 case Instruction::And:
4153 case Instruction::Or:
4154 case Instruction::Xor: {
4165 if (auto *VecOp = dyn_cast<Instruction>(V))
4165 if (auto *VecOp = dyn_cast<Instruction>(V))
4175 case Instruction::Select: {
4204 case Instruction::ICmp:
4205 case Instruction::FCmp: {
4207 bool FCmp = (I.getOpcode() == Instruction::FCmp);
4229 case Instruction::ZExt:
4230 case Instruction::SExt:
4231 case Instruction::FPToUI:
4232 case Instruction::FPToSI:
4233 case Instruction::FPExt:
4234 case Instruction::PtrToInt:
4235 case Instruction::IntToPtr:
4236 case Instruction::SIToFP:
4237 case Instruction::UIToFP:
4238 case Instruction::Trunc:
4239 case Instruction::FPTrunc:
4240 case Instruction::BitCast: {
4257 case Instruction::Call: {
4366 SmallSetVector<Instruction *, 8> Worklist;
4370 SmallSetVector<Instruction *, 8> ScalarPtrs;
4371 SmallPtrSet<Instruction *, 8> PossibleNonScalarPtrs;
4409 auto *I = cast<Instruction>(Ptr);
4409 auto *I = cast<Instruction>(Ptr);
4440 for (auto &I : *BB) {
4448 for (auto *I : ScalarPtrs)
4462 auto *IndUpdate = cast<Instruction>(Ind->getIncomingValueForBlock(Latch));
4462 auto *IndUpdate = cast<Instruction>(Ind->getIncomingValueForBlock(Latch));
4477 for (auto *I : ForcedScalar->second)
4486 Instruction *Dst = Worklist[Idx++];
4489 auto *Src = cast<Instruction>(Dst->getOperand(0));
4489 auto *Src = cast<Instruction>(Dst->getOperand(0));
4491 auto *J = cast<Instruction>(U);
4491 auto *J = cast<Instruction>(U);
4505 auto *IndUpdate = cast<Instruction>(Ind->getIncomingValueForBlock(Latch));
4505 auto *IndUpdate = cast<Instruction>(Ind->getIncomingValueForBlock(Latch));
4518 auto *I = cast<Instruction>(U);
4518 auto *I = cast<Instruction>(U);
4528 auto *I = cast<Instruction>(U);
4528 auto *I = cast<Instruction>(U);
4545 bool LoopVectorizationCostModel::isScalarWithPredication(Instruction *I, unsigned VF) {
4551 case Instruction::Load:
4552 case Instruction::Store: {
4570 case Instruction::UDiv:
4571 case Instruction::SDiv:
4572 case Instruction::SRem:
4573 case Instruction::URem:
4579 bool LoopVectorizationCostModel::interleavedAccessCanBeWidened(Instruction *I,
4616 bool LoopVectorizationCostModel::memoryInstructionCanBeWidened(Instruction *I,
4664 Instruction *I = dyn_cast<Instruction>(V);
4664 Instruction *I = dyn_cast<Instruction>(V);
4668 SetVector<Instruction *> Worklist;
4674 auto *Cmp = dyn_cast<Instruction>(Latch->getTerminator()->getOperand(0));
4674 auto *Cmp = dyn_cast<Instruction>(Latch->getTerminator()->getOperand(0));
4684 SmallSetVector<Instruction *, 8> ConsecutiveLikePtrs;
4687 SmallPtrSet<Instruction *, 8> PossibleNonUniformPtrs;
4707 for (auto &I : *BB) {
4709 auto *Ptr = dyn_cast_or_null<Instruction>(getLoadStorePointerOperand(&I));
4709 auto *Ptr = dyn_cast_or_null<Instruction>(getLoadStorePointerOperand(&I));
4736 for (auto *V : ConsecutiveLikePtrs)
4747 Instruction *I = Worklist[idx++];
4760 auto *OI = cast<Instruction>(OV);
4760 auto *OI = cast<Instruction>(OV);
4762 auto *J = cast<Instruction>(U);
4762 auto *J = cast<Instruction>(U);
4787 auto *IndUpdate = cast<Instruction>(Ind->getIncomingValueForBlock(Latch));
4787 auto *IndUpdate = cast<Instruction>(Ind->getIncomingValueForBlock(Latch));
4792 auto *I = cast<Instruction>(U);
4792 auto *I = cast<Instruction>(U);
4803 auto *I = cast<Instruction>(U);
4803 auto *I = cast<Instruction>(U);
5077 for (Instruction &I : BB->instructionsWithoutDebug()) {
5323 using IntervalMap = DenseMap<Instruction *, unsigned>;
5326 SmallVector<Instruction *, 64> IdxToInstr;
5330 SmallPtrSet<Instruction *, 8> Ends;
5336 for (Instruction &I : BB->instructionsWithoutDebug()) {
5341 auto *Instr = dyn_cast<Instruction>(U);
5341 auto *Instr = dyn_cast<Instruction>(U);
5361 using InstrList = SmallVector<Instruction *, 2>;
5368 SmallPtrSet<Instruction *, 8> OpenIntervals;
5392 Instruction *I = IdxToInstr[i];
5396 for (Instruction *ToRemove : List)
5495 bool LoopVectorizationCostModel::useEmulatedMaskMemRefHack(Instruction *I){
5529 for (Instruction &I : *BB)
5544 Instruction *PredInst, DenseMap<Instruction *, unsigned> &ScalarCosts,
5544 Instruction *PredInst, DenseMap<Instruction *, unsigned> &ScalarCosts,
5556 SmallVector<Instruction *, 8> Worklist;
5585 if (auto *J = dyn_cast<Instruction>(U.get()))
5585 if (auto *J = dyn_cast<Instruction>(U.get()))
5598 Instruction *I = Worklist.pop_back_val();
5619 ScalarCost += VF * TTI.getCFInstrCost(Instruction::PHI);
5627 if (auto *J = dyn_cast<Instruction>(U.get())) {
5627 if (auto *J = dyn_cast<Instruction>(U.get())) {
5658 for (Instruction &I : BB->instructionsWithoutDebug()) {
5723 static bool isStrideMul(Instruction *I, LoopVectorizationLegality *Legal) {
5728 unsigned LoopVectorizationCostModel::getMemInstScalarizationCost(Instruction *I,
5770 unsigned LoopVectorizationCostModel::getConsecutiveMemOpCost(Instruction *I,
5794 unsigned LoopVectorizationCostModel::getUniformMemOpCost(Instruction *I,
5802 TTI.getMemoryOpCost(Instruction::Load, ValTy, Alignment, AS) +
5809 TTI.getMemoryOpCost(Instruction::Store, ValTy, Alignment, AS) +
5812 : TTI.getVectorInstrCost(Instruction::ExtractElement, VectorTy,
5816 unsigned LoopVectorizationCostModel::getGatherScatterCost(Instruction *I,
5829 unsigned LoopVectorizationCostModel::getInterleaveGroupCost(Instruction *I,
5867 unsigned LoopVectorizationCostModel::getMemoryInstructionCost(Instruction *I,
5883 LoopVectorizationCostModel::getInstructionCost(Instruction *I, unsigned VF) {
5908 unsigned LoopVectorizationCostModel::getScalarizationOverhead(Instruction *I,
5930 Instruction::op_range Ops = CI ? CI->arg_operands() : I->operands();
5944 for (Instruction &I : *BB) {
6041 SmallPtrSet<Instruction *, 8> AddrDefs;
6043 for (Instruction &I : *BB) {
6044 Instruction *PtrDef =
6045 dyn_cast_or_null<Instruction>(getLoadStorePointerOperand(&I));
6052 SmallVector<Instruction *, 4> Worklist;
6053 for (auto *I : AddrDefs)
6056 Instruction *I = Worklist.pop_back_val();
6058 if (auto *InstOp = dyn_cast<Instruction>(Op))
6058 if (auto *InstOp = dyn_cast<Instruction>(Op))
6064 for (auto *I : AddrDefs) {
6078 if (Instruction *Member = Group->getMember(I))
6090 unsigned LoopVectorizationCostModel::getInstructionCost(Instruction *I,
6101 case Instruction::GetElementPtr:
6107 case Instruction::Br: {
6125 (TTI.getCFInstrCost(Instruction::Br) * VF));
6128 return TTI.getCFInstrCost(Instruction::Br);
6136 case Instruction::PHI: {
6151 Instruction::Select, ToVectorTy(Phi->getType(), VF),
6154 return TTI.getCFInstrCost(Instruction::PHI);
6156 case Instruction::UDiv:
6157 case Instruction::SDiv:
6158 case Instruction::URem:
6159 case Instruction::SRem:
6171 Cost += VF * TTI.getCFInstrCost(Instruction::PHI);
6186 case Instruction::Add:
6187 case Instruction::FAdd:
6188 case Instruction::Sub:
6189 case Instruction::FSub:
6190 case Instruction::Mul:
6191 case Instruction::FMul:
6192 case Instruction::FDiv:
6193 case Instruction::FRem:
6194 case Instruction::Shl:
6195 case Instruction::LShr:
6196 case Instruction::AShr:
6197 case Instruction::And:
6198 case Instruction::Or:
6199 case Instruction::Xor: {
6201 if (I->getOpcode() == Instruction::Mul && isStrideMul(I, Legal))
6218 case Instruction::FNeg: {
6226 case Instruction::Select: {
6236 case Instruction::ICmp:
6237 case Instruction::FCmp: {
6239 Instruction *Op0AsInstruction = dyn_cast<Instruction>(I->getOperand(0));
6239 Instruction *Op0AsInstruction = dyn_cast<Instruction>(I->getOperand(0));
6245 case Instruction::Store:
6246 case Instruction::Load: {
6258 case Instruction::ZExt:
6259 case Instruction::SExt:
6260 case Instruction::FPToUI:
6261 case Instruction::FPToSI:
6262 case Instruction::FPExt:
6263 case Instruction::PtrToInt:
6264 case Instruction::IntToPtr:
6265 case Instruction::SIToFP:
6266 case Instruction::UIToFP:
6267 case Instruction::Trunc:
6268 case Instruction::FPTrunc:
6269 case Instruction::BitCast: {
6275 return TTI.getCastInstrCost(Instruction::Trunc, Trunc->getDestTy(),
6289 if (I->getOpcode() == Instruction::Trunc) {
6293 } else if (I->getOpcode() == Instruction::ZExt ||
6294 I->getOpcode() == Instruction::SExt) {
6304 case Instruction::Call: {
6315 return VF * TTI.getArithmeticInstrCost(Instruction::Mul, VectorTy) +
6351 bool LoopVectorizationCostModel::isConsecutiveLoadOrStore(Instruction *Inst) {
6367 SmallPtrSetImpl<Instruction *> &Casts = RedDes.getCastInsts();
6374 const SmallVectorImpl<Instruction *> &Casts = IndDes.getCastInsts();
6523 SmallPtrSetImpl<Instruction *> &DeadInstructions) {
6529 auto *Cmp = dyn_cast<Instruction>(Latch->getTerminator()->getOperand(0));
6529 auto *Cmp = dyn_cast<Instruction>(Latch->getTerminator()->getOperand(0));
6538 auto *IndUpdate = cast<Instruction>(Ind->getIncomingValueForBlock(Latch));
6538 auto *IndUpdate = cast<Instruction>(Ind->getIncomingValueForBlock(Latch));
6540 return U == Ind || DeadInstructions.find(cast<Instruction>(U)) !=
6554 const SmallVectorImpl<Instruction *> &Casts = IndDes.getCastInsts();
6564 Instruction::BinaryOps BinOp) {
6713 VPInterleaveRecipe *VPRecipeBuilder::tryToInterleaveMemory(Instruction *I,
6716 const InterleaveGroup<Instruction> *IG = CM.getInterleavedAccessGroup(I);
6745 VPRecipeBuilder::tryToWidenMemory(Instruction *I, VFRange &Range,
6776 VPRecipeBuilder::tryToOptimizeInduction(Instruction *I, VFRange &Range) {
6808 VPBlendRecipe *VPRecipeBuilder::tryToBlend(Instruction *I, VPlanPtr &Plan) {
6832 bool VPRecipeBuilder::tryToWiden(Instruction *I, VPBasicBlock *VPBB,
6843 case Instruction::Add:
6844 case Instruction::And:
6845 case Instruction::AShr:
6846 case Instruction::BitCast:
6847 case Instruction::Br:
6848 case Instruction::Call:
6849 case Instruction::FAdd:
6850 case Instruction::FCmp:
6851 case Instruction::FDiv:
6852 case Instruction::FMul:
6853 case Instruction::FNeg:
6854 case Instruction::FPExt:
6855 case Instruction::FPToSI:
6856 case Instruction::FPToUI:
6857 case Instruction::FPTrunc:
6858 case Instruction::FRem:
6859 case Instruction::FSub:
6860 case Instruction::GetElementPtr:
6861 case Instruction::ICmp:
6862 case Instruction::IntToPtr:
6863 case Instruction::Load:
6864 case Instruction::LShr:
6865 case Instruction::Mul:
6866 case Instruction::Or:
6867 case Instruction::PHI:
6868 case Instruction::PtrToInt:
6869 case Instruction::SDiv:
6870 case Instruction::Select:
6871 case Instruction::SExt:
6872 case Instruction::Shl:
6873 case Instruction::SIToFP:
6874 case Instruction::SRem:
6875 case Instruction::Store:
6876 case Instruction::Sub:
6877 case Instruction::Trunc:
6878 case Instruction::UDiv:
6879 case Instruction::UIToFP:
6880 case Instruction::URem:
6881 case Instruction::Xor:
6882 case Instruction::ZExt:
6939 Instruction *I, VFRange &Range, VPBasicBlock *VPBB,
6940 DenseMap<Instruction *, VPReplicateRecipe *> &PredInst2Recipe,
6955 if (auto *PredInst = dyn_cast<Instruction>(Op))
6955 if (auto *PredInst = dyn_cast<Instruction>(Op))
6977 VPRegionBlock *VPRecipeBuilder::createReplicateRegion(Instruction *Instr,
7005 bool VPRecipeBuilder::tryToCreateRecipe(Instruction *Instr, VFRange &Range,
7079 SmallPtrSet<Instruction *, 4> DeadInstructions;
7092 SmallPtrSetImpl<Instruction *> &DeadInstructions) {
7096 DenseMap<Instruction *, VPReplicateRecipe *> PredInst2Recipe;
7098 DenseMap<Instruction *, Instruction *> &SinkAfter = Legal->getSinkAfter();
7098 DenseMap<Instruction *, Instruction *> &SinkAfter = Legal->getSinkAfter();
7099 DenseMap<Instruction *, Instruction *> SinkAfterInverse;
7099 DenseMap<Instruction *, Instruction *> SinkAfterInverse;
7124 std::vector<Instruction *> Ingredients;
7128 for (Instruction &I : BB->instructionsWithoutDebug()) {
7129 Instruction *Instr = &I;
7139 const InterleaveGroup<Instruction> *IG =
7173 for (Instruction *Instr : Ingredients) {
7206 Builder.createNaryOp(Instruction::Select, {Cond, Red, Phi});
7253 SmallPtrSet<Instruction *, 1> DeadInstructions;
7275 if (Instruction *I = IG->getMember(i))
7281 for (auto &Instr : make_range(Begin, End))
7390 auto *CurrentTerminator = State.CFG.PrevBB->getTerminator();
7400 Instruction *ScalarPredInst = cast<Instruction>(
7400 Instruction *ScalarPredInst = cast<Instruction>(
lib/Transforms/Vectorize/SLPVectorizer.cpp 182 Instruction *I0 = dyn_cast<Instruction>(VL[0]);
182 Instruction *I0 = dyn_cast<Instruction>(VL[0]);
187 Instruction *I = dyn_cast<Instruction>(VL[i]);
187 Instruction *I = dyn_cast<Instruction>(VL[i]);
217 static bool isCommutative(Instruction *I) {
323 Instruction *MainOp = nullptr;
324 Instruction *AltOp = nullptr;
338 bool isOpcodeOrAlt(Instruction *I) const {
344 InstructionsState(Value *OpValue, Instruction *MainOp, Instruction *AltOp)
344 InstructionsState(Value *OpValue, Instruction *MainOp, Instruction *AltOp)
354 auto *I = dyn_cast<Instruction>(Op);
354 auto *I = dyn_cast<Instruction>(Op);
366 if (llvm::any_of(VL, [](Value *V) { return !isa<Instruction>(V); }))
371 unsigned Opcode = cast<Instruction>(VL[BaseIndex])->getOpcode();
378 unsigned InstOpcode = cast<Instruction>(VL[Cnt])->getOpcode();
388 Type *Ty0 = cast<Instruction>(VL[BaseIndex])->getOperand(0)->getType();
389 Type *Ty1 = cast<Instruction>(VL[Cnt])->getOperand(0)->getType();
404 return InstructionsState(VL[BaseIndex], cast<Instruction>(VL[BaseIndex]),
405 cast<Instruction>(VL[AltIndex]));
420 static Optional<unsigned> getExtractIndex(Instruction *E) {
425 if (Opcode == Instruction::ExtractElement) {
439 static bool InTreeUserNeedToExtract(Value *Scalar, Instruction *UserInst,
443 case Instruction::Load: {
447 case Instruction::Store: {
451 case Instruction::Call: {
466 static MemoryLocation getLocation(Instruction *I, AliasAnalysis *AA) {
475 static bool isSimple(Instruction *I) {
496 using InstrList = SmallVector<Instruction *, 16>;
500 MapVector<Value *, SmallVector<Instruction *, 2>>;
810 if ((isa<Instruction>(Op) && isa<Instruction>(OpLastLane) &&
810 if ((isa<Instruction>(Op) && isa<Instruction>(OpLastLane) &&
811 cast<Instruction>(Op)->getOpcode() ==
812 cast<Instruction>(OpLastLane)->getOpcode()) ||
813 (isa<UndefValue>(OpLastLane) && isa<Instruction>(Op)) ||
891 unsigned NumOperands = cast<Instruction>(VL[0])->getNumOperands();
908 bool IsInverseOperation = !isCommutative(cast<Instruction>(VL[Lane]));
910 OpsVec[OpIdx][Lane] = {cast<Instruction>(VL[Lane])->getOperand(OpIdx),
1013 else if (isa<Instruction>(OpLane0)) {
1134 bool isDeleted(Instruction *I) const { return DeletedInstructions.count(I); }
1143 bool areAllUsersVectorized(Instruction *I) const;
1244 Instruction *MainOp = nullptr;
1245 Instruction *AltOp = nullptr;
1261 auto *I0 = cast<Instruction>(Scalars[0]);
1261 auto *I0 = cast<Instruction>(Scalars[0]);
1268 auto *I = cast<Instruction>(Scalars[Lane]);
1268 auto *I = cast<Instruction>(Scalars[Lane]);
1297 bool isOpcodeOrAlt(Instruction *I) const {
1307 auto *I = dyn_cast<Instruction>(Op);
1307 auto *I = dyn_cast<Instruction>(Op);
1318 Instruction *getMainOp() const {
1322 Instruction *getAltOp() const {
1479 bool isAliased(const MemoryLocation &Loc1, Instruction *Inst1,
1480 Instruction *Inst2) {
1498 using AliasCacheKey = std::pair<Instruction *, Instruction *>;
1498 using AliasCacheKey = std::pair<Instruction *, Instruction *>;
1510 void eraseInstruction(Instruction *I, bool ReplaceOpsWithUndef = false) {
1517 DenseMap<Instruction *, bool> DeletedInstructions;
1529 SetVector<Instruction *> GatherSeq;
1615 Instruction *Inst = nullptr;
1769 if (auto *I = dyn_cast<Instruction>(TE->getOperand(OpIdx)[Lane]))
1769 if (auto *I = dyn_cast<Instruction>(TE->getOperand(OpIdx)[Lane]))
1775 if (auto *I = dyn_cast<Instruction>(U.get()))
1775 if (auto *I = dyn_cast<Instruction>(U.get()))
1809 for (auto *I = ScheduleStart; I != ScheduleEnd; I = I->getNextNode()) {
1841 void initScheduleData(Instruction *FromI, Instruction *ToI,
1841 void initScheduleData(Instruction *FromI, Instruction *ToI,
1882 Instruction *ScheduleStart = nullptr;
1885 Instruction *ScheduleEnd = nullptr;
2093 if (auto *I = dyn_cast<Instruction>(V))
2093 if (auto *I = dyn_cast<Instruction>(V))
2141 Instruction *UserInst = dyn_cast<Instruction>(U);
2141 Instruction *UserInst = dyn_cast<Instruction>(U);
2235 auto *I = dyn_cast<Instruction>(V);
2235 auto *I = dyn_cast<Instruction>(V);
2259 auto *VL0 = cast<Instruction>(S.OpValue);
2259 auto *VL0 = cast<Instruction>(S.OpValue);
2313 (unsigned) Instruction::ShuffleVector : S.getOpcode();
2315 case Instruction::PHI: {
2321 Instruction *Term = dyn_cast<Instruction>(
2321 Instruction *Term = dyn_cast<Instruction>(
2353 case Instruction::ExtractValue:
2354 case Instruction::ExtractElement: {
2398 case Instruction::Load: {
2479 case Instruction::ZExt:
2480 case Instruction::SExt:
2481 case Instruction::FPToUI:
2482 case Instruction::FPToSI:
2483 case Instruction::FPExt:
2484 case Instruction::PtrToInt:
2485 case Instruction::IntToPtr:
2486 case Instruction::SIToFP:
2487 case Instruction::UIToFP:
2488 case Instruction::Trunc:
2489 case Instruction::FPTrunc:
2490 case Instruction::BitCast: {
2493 Type *Ty = cast<Instruction>(V)->getOperand(0)->getType();
2512 Operands.push_back(cast<Instruction>(V)->getOperand(i));
2518 case Instruction::ICmp:
2519 case Instruction::FCmp: {
2565 case Instruction::Select:
2566 case Instruction::FNeg:
2567 case Instruction::Add:
2568 case Instruction::FAdd:
2569 case Instruction::Sub:
2570 case Instruction::FSub:
2571 case Instruction::Mul:
2572 case Instruction::FMul:
2573 case Instruction::UDiv:
2574 case Instruction::SDiv:
2575 case Instruction::FDiv:
2576 case Instruction::URem:
2577 case Instruction::SRem:
2578 case Instruction::FRem:
2579 case Instruction::Shl:
2580 case Instruction::LShr:
2581 case Instruction::AShr:
2582 case Instruction::And:
2583 case Instruction::Or:
2584 case Instruction::Xor: {
2606 Operands.push_back(cast<Instruction>(j)->getOperand(i));
2612 case Instruction::GetElementPtr: {
2615 if (cast<Instruction>(V)->getNumOperands() != 2) {
2628 Type *CurTy = cast<Instruction>(V)->getOperand(0)->getType();
2641 auto Op = cast<Instruction>(V)->getOperand(1);
2660 Operands.push_back(cast<Instruction>(V)->getOperand(i));
2666 case Instruction::Store: {
2683 Operands.push_back(cast<Instruction>(V)->getOperand(0));
2688 case Instruction::Call: {
2763 case Instruction::ShuffleVector: {
2793 Operands.push_back(cast<Instruction>(V)->getOperand(i));
2835 Instruction *E0 = cast<Instruction>(OpValue);
2835 Instruction *E0 = cast<Instruction>(OpValue);
2847 if (E0->getOpcode() == Instruction::ExtractValue) {
2874 auto *Inst = cast<Instruction>(VL[I]);
2874 auto *Inst = cast<Instruction>(VL[I]);
2900 bool BoUpSLP::areAllUsersVectorized(Instruction *I) const {
2937 if (E->getOpcode() == Instruction::ExtractElement &&
2947 if (areAllUsersVectorized(cast<Instruction>(V)) &&
2951 Cost -= TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy,
2961 Instruction *VL0 = E->getMainOp();
2963 E->isAltShuffle() ? (unsigned)Instruction::ShuffleVector : E->getOpcode();
2965 case Instruction::PHI:
2968 case Instruction::ExtractValue:
2969 case Instruction::ExtractElement:
2973 if (ShuffleOrOp == Instruction::ExtractElement) {
2978 Instruction::ExtractElement, VecTy, Idx);
2981 Instruction::ExtractElement, VecTy, Idx);
2987 if (ShuffleOrOp == Instruction::ExtractElement) {
2995 TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy, Idx);
3006 Instruction *E = cast<Instruction>(VL[i]);
3006 Instruction *E = cast<Instruction>(VL[i]);
3013 Instruction *Ext = E->user_back();
3028 TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy, i);
3035 case Instruction::ZExt:
3036 case Instruction::SExt:
3037 case Instruction::FPToUI:
3038 case Instruction::FPToSI:
3039 case Instruction::FPExt:
3040 case Instruction::PtrToInt:
3041 case Instruction::IntToPtr:
3042 case Instruction::SIToFP:
3043 case Instruction::UIToFP:
3044 case Instruction::Trunc:
3045 case Instruction::FPTrunc:
3046 case Instruction::BitCast: {
3066 case Instruction::FCmp:
3067 case Instruction::ICmp:
3068 case Instruction::Select: {
3080 case Instruction::FNeg:
3081 case Instruction::Add:
3082 case Instruction::FAdd:
3083 case Instruction::Sub:
3084 case Instruction::FSub:
3085 case Instruction::Mul:
3086 case Instruction::FMul:
3087 case Instruction::UDiv:
3088 case Instruction::SDiv:
3089 case Instruction::FDiv:
3090 case Instruction::URem:
3091 case Instruction::SRem:
3092 case Instruction::FRem:
3093 case Instruction::Shl:
3094 case Instruction::LShr:
3095 case Instruction::AShr:
3096 case Instruction::And:
3097 case Instruction::Or:
3098 case Instruction::Xor: {
3117 const Instruction *I = cast<Instruction>(VL[i]);
3117 const Instruction *I = cast<Instruction>(VL[i]);
3147 case Instruction::GetElementPtr: {
3154 TTI->getArithmeticInstrCost(Instruction::Add, ScalarTy, Op1VK, Op2VK);
3160 TTI->getArithmeticInstrCost(Instruction::Add, VecTy, Op1VK, Op2VK);
3163 case Instruction::Load: {
3167 TTI->getMemoryOpCost(Instruction::Load, ScalarTy, alignment, 0, VL0);
3173 TTI->getMemoryOpCost(Instruction::Load, VecTy, alignment, 0, VL0);
3181 case Instruction::Store: {
3185 TTI->getMemoryOpCost(Instruction::Store, ScalarTy, alignment, 0, VL0);
3191 TTI->getMemoryOpCost(Instruction::Store, VecTy, alignment, 0, VL0);
3194 case Instruction::Call: {
3224 case Instruction::ShuffleVector: {
3234 Instruction *I = cast<Instruction>(VL[Idx]);
3234 Instruction *I = cast<Instruction>(VL[Idx]);
3239 Instruction *I = cast<Instruction>(V);
3239 Instruction *I = cast<Instruction>(V);
3245 Instruction *I = cast<Instruction>(V);
3245 Instruction *I = cast<Instruction>(V);
3253 if (Instruction::isBinaryOp(E->getOpcode())) {
3297 if (RdxOpcode != Instruction::Or)
3361 SmallPtrSet<Instruction*, 4> LiveValues;
3362 Instruction *PrevInst = nullptr;
3365 Instruction *Inst = dyn_cast<Instruction>(TEPtr->Scalars[0]);
3365 Instruction *Inst = dyn_cast<Instruction>(TEPtr->Scalars[0]);
3377 if (isa<Instruction>(&*J) && getTreeEntry(&*J))
3378 LiveValues.insert(cast<Instruction>(&*J));
3411 for (auto *II : LiveValues)
3480 MinBWs[ScalarRoot].second ? Instruction::SExt : Instruction::ZExt;
3480 MinBWs[ScalarRoot].second ? Instruction::SExt : Instruction::ZExt;
3486 TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy, EU.Lane);
3513 Cost += TTI->getVectorInstrCost(Instruction::InsertElement, Ty, i);
3557 auto *Front = E->getMainOp();
3566 Instruction *LastInst = nullptr;
3601 for (auto &I : make_range(BasicBlock::iterator(Front), BB->end())) {
3705 if (auto *I = dyn_cast<Instruction>(V)) {
3705 if (auto *I = dyn_cast<Instruction>(V)) {
3730 Instruction *VL0 = E->getMainOp();
3744 if (auto *I = dyn_cast<Instruction>(V)) {
3744 if (auto *I = dyn_cast<Instruction>(V)) {
3754 E->isAltShuffle() ? (unsigned)Instruction::ShuffleVector : E->getOpcode();
3756 case Instruction::PHI: {
3792 case Instruction::ExtractElement: {
3817 if (auto *I = dyn_cast<Instruction>(V)) {
3817 if (auto *I = dyn_cast<Instruction>(V)) {
3825 case Instruction::ExtractValue: {
3852 if (auto *I = dyn_cast<Instruction>(V)) {
3852 if (auto *I = dyn_cast<Instruction>(V)) {
3860 case Instruction::ZExt:
3861 case Instruction::SExt:
3862 case Instruction::FPToUI:
3863 case Instruction::FPToSI:
3864 case Instruction::FPExt:
3865 case Instruction::PtrToInt:
3866 case Instruction::IntToPtr:
3867 case Instruction::SIToFP:
3868 case Instruction::UIToFP:
3869 case Instruction::Trunc:
3870 case Instruction::FPTrunc:
3871 case Instruction::BitCast: {
3891 case Instruction::FCmp:
3892 case Instruction::ICmp: {
3905 if (E->getOpcode() == Instruction::FCmp)
3919 case Instruction::Select: {
3940 case Instruction::FNeg: {
3953 if (auto *I = dyn_cast<Instruction>(V))
3953 if (auto *I = dyn_cast<Instruction>(V))
3965 case Instruction::Add:
3966 case Instruction::FAdd:
3967 case Instruction::Sub:
3968 case Instruction::FSub:
3969 case Instruction::Mul:
3970 case Instruction::FMul:
3971 case Instruction::UDiv:
3972 case Instruction::SDiv:
3973 case Instruction::FDiv:
3974 case Instruction::URem:
3975 case Instruction::SRem:
3976 case Instruction::FRem:
3977 case Instruction::Shl:
3978 case Instruction::LShr:
3979 case Instruction::AShr:
3980 case Instruction::And:
3981 case Instruction::Or:
3982 case Instruction::Xor: {
3997 if (auto *I = dyn_cast<Instruction>(V))
3997 if (auto *I = dyn_cast<Instruction>(V))
4009 case Instruction::Load: {
4052 case Instruction::Store: {
4083 case Instruction::GetElementPtr: {
4097 if (Instruction *I = dyn_cast<Instruction>(V))
4097 if (Instruction *I = dyn_cast<Instruction>(V))
4109 case Instruction::Call: {
4158 case Instruction::ShuffleVector: {
4167 if (Instruction::isBinaryOp(E->getOpcode())) {
4182 if (Instruction::isBinaryOp(E->getOpcode())) {
4201 auto *OpInst = cast<Instruction>(E->Scalars[i]);
4201 auto *OpInst = cast<Instruction>(E->Scalars[i]);
4217 if (Instruction *I = dyn_cast<Instruction>(V))
4217 if (Instruction *I = dyn_cast<Instruction>(V))
4254 if (auto *I = dyn_cast<Instruction>(VectorRoot))
4254 if (auto *I = dyn_cast<Instruction>(VectorRoot))
4300 if (auto *VecI = dyn_cast<Instruction>(Vec)) {
4300 if (auto *VecI = dyn_cast<Instruction>(Vec)) {
4308 CSEBlocks.insert(cast<Instruction>(Scalar)->getParent());
4319 if (auto *VecI = dyn_cast<Instruction>(Vec)) {
4319 if (auto *VecI = dyn_cast<Instruction>(Vec)) {
4323 Instruction *IncomingTerminator =
4338 Builder.SetInsertPoint(cast<Instruction>(User));
4341 CSEBlocks.insert(cast<Instruction>(User)->getParent());
4382 eraseInstruction(cast<Instruction>(Scalar));
4395 for (Instruction *I : GatherSeq) {
4412 auto *Op0 = dyn_cast<Instruction>(I->getOperand(0));
4412 auto *Op0 = dyn_cast<Instruction>(I->getOperand(0));
4413 auto *Op1 = dyn_cast<Instruction>(I->getOperand(1));
4413 auto *Op1 = dyn_cast<Instruction>(I->getOperand(1));
4442 SmallVector<Instruction *, 16> Visited;
4449 Instruction *In = &*it++;
4457 for (Instruction *v : Visited) {
4485 Instruction *OldScheduleEnd = ScheduleEnd;
4530 for (auto *I = ScheduleStart; I != ScheduleEnd; I = I->getNextNode()) {
4608 Instruction *I = dyn_cast<Instruction>(V);
4608 Instruction *I = dyn_cast<Instruction>(V);
4681 void BoUpSLP::BlockScheduling::initScheduleData(Instruction *FromI,
4682 Instruction *ToI,
4686 for (Instruction *I = FromI; I != ToI; I = I->getNextNode()) {
4752 if (isa<Instruction>(U)) {
4775 Instruction *SrcInst = BundleMember->Inst;
4845 for (Instruction *I = ScheduleStart; I != ScheduleEnd; I = I->getNextNode()) {
4878 for (auto *I = BS->ScheduleStart; I != BS->ScheduleEnd;
4893 Instruction *LastScheduledInst = BS->ScheduleEnd;
4904 Instruction *pickedInst = BundleMember->Inst;
4933 SmallVector<Instruction *, 16> Worklist;
4934 SmallPtrSet<Instruction *, 16> Visited;
4935 if (auto *I = dyn_cast<Instruction>(V))
4935 if (auto *I = dyn_cast<Instruction>(V))
4943 auto *I = Worklist.pop_back_val();
4963 if (auto *J = dyn_cast<Instruction>(U.get()))
4963 if (auto *J = dyn_cast<Instruction>(U.get()))
4996 auto *I = dyn_cast<Instruction>(V);
4996 auto *I = dyn_cast<Instruction>(V);
5004 case Instruction::Trunc:
5007 case Instruction::ZExt:
5008 case Instruction::SExt:
5013 case Instruction::Add:
5014 case Instruction::Sub:
5015 case Instruction::Mul:
5016 case Instruction::And:
5017 case Instruction::Or:
5018 case Instruction::Xor:
5025 case Instruction::Select: {
5035 case Instruction::PHI: {
5107 auto Mask = DB->getDemandedBits(cast<Instruction>(Root));
5352 auto *I = dyn_cast<Instruction>(V);
5352 auto *I = dyn_cast<Instruction>(V);
5468 for (Instruction &I : *BB) {
5516 Instruction *I0 = cast<Instruction>(S.OpValue);
5516 Instruction *I0 = cast<Instruction>(S.OpValue);
5572 auto *I = dyn_cast<Instruction>(V);
5572 auto *I = dyn_cast<Instruction>(V);
5604 cast<Instruction>(Ops[0]))
5635 bool SLPVectorizerPass::tryToVectorize(Instruction *I, BoUpSLP &R) {
5645 auto *Op0 = dyn_cast<Instruction>(I->getOperand(0));
5645 auto *Op0 = dyn_cast<Instruction>(I->getOperand(0));
5646 auto *Op1 = dyn_cast<Instruction>(I->getOperand(1));
5646 auto *Op1 = dyn_cast<Instruction>(I->getOperand(1));
5743 MapVector<Instruction *, Value *> ExtraArgs;
5777 (Opcode == Instruction::Add || Opcode == Instruction::FAdd ||
5777 (Opcode == Instruction::Add || Opcode == Instruction::FAdd ||
5778 Opcode == Instruction::Mul || Opcode == Instruction::FMul ||
5778 Opcode == Instruction::Mul || Opcode == Instruction::FMul ||
5779 Opcode == Instruction::And || Opcode == Instruction::Or ||
5779 Opcode == Instruction::And || Opcode == Instruction::Or ||
5780 Opcode == Instruction::Xor)) ||
5781 ((Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) &&
5781 ((Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) &&
5783 (Opcode == Instruction::ICmp &&
5797 Cmp = Opcode == Instruction::ICmp ? Builder.CreateICmpSLT(LHS, RHS)
5801 Cmp = Opcode == Instruction::ICmp ? Builder.CreateICmpSGT(LHS, RHS)
5824 if (auto *I = dyn_cast<Instruction>(V))
5824 if (auto *I = dyn_cast<Instruction>(V))
5873 bool hasSameParent(Instruction *I, Value *P, bool IsRedOp) const {
5888 auto *Cmp = cast<Instruction>(cast<SelectInst>(I)->getCondition());
5888 auto *Cmp = cast<Instruction>(cast<SelectInst>(I)->getCondition());
5897 bool hasRequiredNumberOfUses(Instruction *I, bool IsReductionOp) const {
5935 void addReductionOps(Instruction *I, ReductionOpsListType &ReductionOps) {
5955 bool isAssociative(Instruction *I) const {
5963 return Opcode == Instruction::ICmp ||
5964 cast<Instruction>(I->getOperand(0))->isFast();
5977 bool isVectorizable(Instruction *I) const {
6049 Instruction *I) const {
6080 Flags.IsSigned = Opcode == Instruction::ICmp;
6084 Flags.IsSigned = Opcode == Instruction::ICmp;
6116 void markExtraArg(std::pair<Instruction *, unsigned> &ParentStackElem,
6147 return OperationData(Instruction::ICmp, LHS, RHS, RK_UMin);
6149 return OperationData(Instruction::ICmp, LHS, RHS, RK_Min);
6153 Instruction::FCmp, LHS, RHS, RK_Min,
6154 cast<Instruction>(Select->getCondition())->hasNoNaNs());
6156 return OperationData(Instruction::ICmp, LHS, RHS, RK_UMax);
6158 return OperationData(Instruction::ICmp, LHS, RHS, RK_Max);
6162 Instruction::FCmp, LHS, RHS, RK_Max,
6163 cast<Instruction>(Select->getCondition())->hasNoNaNs());
6177 Instruction *L1;
6178 Instruction *L2;
6187 !L2->isIdenticalTo(cast<Instruction>(RHS)))
6191 !L1->isIdenticalTo(cast<Instruction>(LHS)))
6197 !L1->isIdenticalTo(cast<Instruction>(LHS)) ||
6198 !L2->isIdenticalTo(cast<Instruction>(RHS)))
6207 return OperationData(Instruction::ICmp, LHS, RHS, RK_UMin);
6211 return OperationData(Instruction::ICmp, LHS, RHS, RK_Min);
6217 return OperationData(Instruction::FCmp, LHS, RHS, RK_Min,
6218 cast<Instruction>(Cond)->hasNoNaNs());
6222 return OperationData(Instruction::ICmp, LHS, RHS, RK_UMax);
6226 return OperationData(Instruction::ICmp, LHS, RHS, RK_Max);
6232 return OperationData(Instruction::FCmp, LHS, RHS, RK_Max,
6233 cast<Instruction>(Cond)->hasNoNaNs());
6244 bool matchAssociativeReduction(PHINode *Phi, Instruction *B) {
6256 B = dyn_cast<Instruction>(ReductionData.getRHS());
6260 B = dyn_cast<Instruction>(ReductionData.getLHS());
6279 SmallVector<std::pair<Instruction *, unsigned>, 32> Stack;
6283 Instruction *TreeN = Stack.back().first;
6317 auto *I = dyn_cast<Instruction>(NextV);
6317 auto *I = dyn_cast<Instruction>(NextV);
6390 IRBuilder<> Builder(cast<Instruction>(ReductionRoot));
6435 SV_NAME, "HorSLPNotBeneficial", cast<Instruction>(VL[0]))
6448 SV_NAME, "VectorizedHorizontalReduction", cast<Instruction>(VL[0]))
6455 DebugLoc Loc = cast<Instruction>(ReducedVals[i])->getDebugLoc();
6459 Builder.SetInsertPoint(cast<Instruction>(ReductionRoot));
6478 auto *I = cast<Instruction>(ReducedVals[i]);
6478 auto *I = cast<Instruction>(ReducedVals[i]);
6487 for (auto *I : Pair.second) {
6560 TTI->getCmpSelInstrCost(Instruction::Select, ScalarTy,
6633 UserCost += TTI->getVectorInstrCost(Instruction::InsertElement,
6684 return isa<Instruction>(R) &&
6685 DT->dominates(P->getParent(), cast<Instruction>(R)->getParent());
6734 PHINode *P, Instruction *Root, BasicBlock *BB, BoUpSLP &R,
6736 const function_ref<bool(Instruction *, BoUpSLP &)> Vectorize) {
6754 SmallVector<std::pair<Instruction *, unsigned>, 8> Stack(1, {Root, 0});
6758 Instruction *Inst;
6775 Inst = dyn_cast<Instruction>(BI->getOperand(0));
6777 Inst = dyn_cast<Instruction>(BI->getOperand(1));
6800 if (auto *I = dyn_cast<Instruction>(Op))
6800 if (auto *I = dyn_cast<Instruction>(Op))
6812 auto *I = dyn_cast<Instruction>(V);
6812 auto *I = dyn_cast<Instruction>(V);
6871 SmallVectorImpl<Instruction *> &Instructions, BasicBlock *BB, BoUpSLP &R) {
6873 for (auto *I : reverse(Instructions)) {
6898 for (Instruction &I : *BB) {
6947 SmallVector<Instruction *, 8> PostProcessInstructions;
6948 SmallDenseSet<Instruction *, 4> KeyNodes;
7054 [&R](Value *I) { return R.isDeleted(cast<Instruction>(I)); });
lib/Transforms/Vectorize/VPRecipeBuilder.h 68 VPInterleaveRecipe *tryToInterleaveMemory(Instruction *I, VFRange &Range,
75 tryToWidenMemory(Instruction *I, VFRange &Range, VPlanPtr &Plan);
81 VPWidenIntOrFpInductionRecipe *tryToOptimizeInduction(Instruction *I,
87 VPBlendRecipe *tryToBlend(Instruction *I, VPlanPtr &Plan);
95 bool tryToWiden(Instruction *I, VPBasicBlock *VPBB, VFRange &Range);
99 VPRegionBlock *createReplicateRegion(Instruction *I, VPRecipeBase *PredRecipe,
110 bool tryToCreateRecipe(Instruction *Instr, VFRange &Range, VPlanPtr &Plan,
120 Instruction *I, VFRange &Range, VPBasicBlock *VPBB,
121 DenseMap<Instruction *, VPReplicateRecipe *> &PredInst2Recipe,
lib/Transforms/Vectorize/VPlan.cpp 142 auto *PredBBTerminator = PredBB->getTerminator();
218 auto *CurrentTerminator = NewBB->getTerminator();
296 if (Instruction::isBinaryOp(getOpcode())) {
318 case Instruction::Select: {
361 O << Instruction::getOpcodeName(getOpcode());
422 auto *BBTerminator = BB->getTerminator();
629 if (auto *Inst = dyn_cast<Instruction>(V)) {
629 if (auto *Inst = dyn_cast<Instruction>(V)) {
649 for (auto &Instr : make_range(Begin, End))
737 auto *Inst = cast<Instruction>(VPInst->getUnderlyingValue());
737 auto *Inst = cast<Instruction>(VPInst->getUnderlyingValue());
lib/Transforms/Vectorize/VPlan.h 639 Not = Instruction::OtherOpsEnd + 1,
654 Instruction *getUnderlyingInstr() {
655 return cast_or_null<Instruction>(getUnderlyingValue());
658 void setUnderlyingInstr(Instruction *I) { setUnderlyingValue(I); }
700 return Opcode == Instruction::Store || Opcode == Instruction::Call ||
700 return Opcode == Instruction::Store || Opcode == Instruction::Call ||
701 Opcode == Instruction::Invoke || Opcode == SLPStore;
716 VPWidenRecipe(Instruction *I) : VPRecipeBase(VPWidenSC) {
732 bool appendInstruction(Instruction *Instr) {
824 const InterleaveGroup<Instruction> *IG;
828 VPInterleaveRecipe(const InterleaveGroup<Instruction> *IG, VPValue *Mask)
846 const InterleaveGroup<Instruction> *getInterleaveGroup() { return IG; }
856 Instruction *Ingredient;
868 VPReplicateRecipe(Instruction *I, bool IsUniform, bool IsPredicated = false)
935 Instruction *PredInst;
940 VPPredInstPHIRecipe(Instruction *PredInst)
961 Instruction &Instr;
965 VPWidenMemoryInstructionRecipe(Instruction &Instr, VPValue *Mask)
1559 using Old2NewTy = DenseMap<InterleaveGroup<Instruction> *,
lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp 133 Instruction *Inst = dyn_cast<Instruction>(Val);
133 Instruction *Inst = dyn_cast<Instruction>(Val);
195 for (Instruction &InstRef : *BB) {
196 Instruction *Inst = &InstRef;
274 Instruction *TI = BB->getTerminator();
lib/Transforms/Vectorize/VPlanHCFGTransforms.cpp 22 SmallPtrSetImpl<Instruction *> &DeadInstructions) {
50 Instruction *Inst = cast<Instruction>(VPInst->getUnderlyingValue());
50 Instruction *Inst = cast<Instruction>(VPInst->getUnderlyingValue());
lib/Transforms/Vectorize/VPlanHCFGTransforms.h 30 SmallPtrSetImpl<Instruction *> &DeadInstructions);
lib/Transforms/Vectorize/VPlanSLP.cpp 90 const Instruction *OriginalInstr =
95 const Instruction *I = cast<VPInstruction>(Op)->getUnderlyingInstr();
121 if (Opcode == Instruction::Load) {
126 if (VPI->getOpcode() == Instruction::Load &&
148 if (Opcode == Instruction::Store)
171 return Instruction::isCommutative(
181 case Instruction::Load:
183 case Instruction::Store:
212 if (A->getOpcode() != Instruction::Load &&
213 A->getOpcode() != Instruction::Store)
310 Instruction::Load)
351 if (auto *Instr = VPInstr->getUnderlyingInstr()) {
438 if (ValuesOpcode == Instruction::Load)
448 case Instruction::Load:
451 case Instruction::Store:
tools/bugpoint/BugDriver.h 191 std::unique_ptr<Module> deleteInstructionFromProgram(const Instruction *I,
tools/bugpoint/CrashDebugger.cpp 471 Instruction *BBTerm = BB.getTerminator();
735 class ReduceCrashingInstructions : public ListReducer<const Instruction *> {
743 Expected<TestResult> doTest(std::vector<const Instruction *> &Prefix,
744 std::vector<const Instruction *> &Kept) override {
752 bool TestInsts(std::vector<const Instruction *> &Prefix);
757 std::vector<const Instruction *> &Insts) {
763 SmallPtrSet<Instruction *, 32> Instructions;
766 Instructions.insert(cast<Instruction>(VMap[Insts[i]]));
778 Instruction *Inst = &*I++;
800 for (Instruction *Inst : Instructions)
1008 std::vector<const Instruction *> Insts;
1011 for (const Instruction &I : BB)
tools/bugpoint/ExtractFunction.cpp 84 BugDriver::deleteInstructionFromProgram(const Instruction *I,
101 Instruction *TheInst = &*RI; // Got the corresponding instruction!
tools/clang/lib/CodeGen/Address.h 108 template <class U> inline U cast(CodeGen::Address addr) {
tools/clang/lib/CodeGen/CGAtomic.cpp 497 llvm::Instruction::BinaryOps PostOp = (llvm::Instruction::BinaryOps)0;
574 PostOp = llvm::Instruction::Add;
583 PostOp = llvm::Instruction::Sub;
604 PostOp = llvm::Instruction::And;
613 PostOp = llvm::Instruction::Or;
622 PostOp = llvm::Instruction::Xor;
631 PostOp = llvm::Instruction::And; // the NOT is special cased below
993 llvm::Instruction::BinaryOps PostOp = (llvm::Instruction::BinaryOps)0;
1058 PostOp = llvm::Instruction::Add;
1070 PostOp = llvm::Instruction::And;
1082 PostOp = llvm::Instruction::Or;
1094 PostOp = llvm::Instruction::Sub;
1106 PostOp = llvm::Instruction::Xor;
1134 PostOp = llvm::Instruction::And; // the NOT is special cased below
tools/clang/lib/CodeGen/CGBlocks.cpp 846 blockInfo.DominatingIP = cast<llvm::Instruction>(addr.getPointer());
2098 cast<llvm::Instruction>(dstField.getPointer())->eraseFromParent();
tools/clang/lib/CodeGen/CGBlocks.h 262 llvm::Instruction *DominatingIP;
tools/clang/lib/CodeGen/CGBuilder.h 32 void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
55 CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
tools/clang/lib/CodeGen/CGBuiltin.cpp 179 Instruction::BinaryOps Op,
205 Result = CGF.Builder.CreateBinOp(llvm::Instruction::Xor, Result,
481 llvm::Instruction *Call = CGF.Builder.CreateCall(F);
2770 llvm::Instruction::Add);
2777 llvm::Instruction::Sub);
2784 llvm::Instruction::And);
2791 llvm::Instruction::Or);
2798 llvm::Instruction::Xor);
2805 llvm::Instruction::And, true);
9583 static Value *EmitX86MaskLogic(CodeGenFunction &CGF, Instruction::BinaryOps Opc,
11465 Value *Or = EmitX86MaskLogic(*this, Instruction::Or, Ops);
11474 Value *Or = EmitX86MaskLogic(*this, Instruction::Or, Ops);
11556 return EmitX86MaskLogic(*this, Instruction::And, Ops);
11561 return EmitX86MaskLogic(*this, Instruction::And, Ops, true);
11566 return EmitX86MaskLogic(*this, Instruction::Or, Ops);
11571 return EmitX86MaskLogic(*this, Instruction::Xor, Ops, true);
11576 return EmitX86MaskLogic(*this, Instruction::Xor, Ops);
tools/clang/lib/CodeGen/CGCall.cpp 2574 static void eraseUnusedBitCasts(llvm::Instruction *insn) {
2580 insn = cast<llvm::Instruction>(bitcast->getOperand(0));
2596 llvm::Instruction *generator = cast<llvm::Instruction>(result);
2596 llvm::Instruction *generator = cast<llvm::Instruction>(result);
2598 SmallVector<llvm::Instruction *, 4> InstsToKill;
2605 generator = cast<llvm::Instruction>(bitcast->getOperand(0));
2635 llvm::Instruction *prev = call->getPrevNode();
2662 for (auto *I : InstsToKill)
2702 eraseUnusedBitCasts(cast<llvm::Instruction>(result));
2705 eraseUnusedBitCasts(cast<llvm::Instruction>(retainedValue));
2751 llvm::Instruction *I = &IP->back();
2957 llvm::Instruction *Ret;
3102 llvm::Instruction *isActive = Builder.CreateUnreachable();
3609 llvm::Instruction *IsActive = Builder.CreateUnreachable();
3647 CodeGenFunction::AddObjCARCExceptionMetadata(llvm::Instruction *Inst) {
3774 void CodeGenFunction::deferPlaceholderReplacement(llvm::Instruction *Old,
3834 llvm::Instruction *IP = CallArgs.getStackBase();
3912 llvm::Instruction *Placeholder =
3913 cast<llvm::Instruction>(Addr.getPointer());
4242 if (CE->getOpcode() == llvm::Instruction::BitCast)
tools/clang/lib/CodeGen/CGCall.h 284 llvm::Instruction *IsActiveIP;
324 llvm::Instruction *IsActiveIP) {
336 llvm::Instruction *getStackBase() const { return StackBase; }
tools/clang/lib/CodeGen/CGClass.cpp 2592 llvm::Instruction *VTable = Builder.CreateLoad(VTablePtrSrc, "vtable");
tools/clang/lib/CodeGen/CGCleanup.cpp 305 llvm::Instruction *beforeInst) {
311 llvm::Instruction *beforeInst) {
362 llvm::Instruction *Term = Block->getTerminator();
445 auto *Inst = dyn_cast_or_null<llvm::Instruction>(*ReloadedValue);
445 auto *Inst = dyn_cast_or_null<llvm::Instruction>(*ReloadedValue);
585 llvm::Instruction *Term = Exit->getTerminator();
827 SmallVector<llvm::Instruction*, 2> InstsToAppend;
836 llvm::Instruction *NormalCleanupDestSlot =
837 cast<llvm::Instruction>(getNormalCleanupDestSlot().getPointer());
976 SaveAndRestore<llvm::Instruction *> RestoreCurrentFuncletPad(
1173 llvm::Instruction *dominatingIP) {
1229 llvm::Instruction *dominatingIP) {
1241 llvm::Instruction *dominatingIP) {
tools/clang/lib/CodeGen/CGCoroutine.cpp 386 if (llvm::Instruction *EHPad = CGF.CurrentFuncletPad)
451 auto *InsertPt = SaveInsertBlock->getTerminator();
tools/clang/lib/CodeGen/CGDebugInfo.cpp 2050 void CGDebugInfo::addHeapAllocSiteMetadata(llvm::Instruction *CI,
4088 const CGBlockInfo &blockInfo, llvm::Instruction *InsertPoint) {
tools/clang/lib/CodeGen/CGDebugInfo.h 449 const CGBlockInfo &blockInfo, llvm::Instruction *InsertPoint = nullptr);
494 void addHeapAllocSiteMetadata(llvm::Instruction *CallSite, QualType Ty,
tools/clang/lib/CodeGen/CGException.cpp 292 if (CE->getOpcode() != llvm::Instruction::BitCast) return false;
400 cast<llvm::Instruction>(typedAddr.getPointer()));
1174 SaveAndRestore<llvm::Instruction *> RestoreCurrentFuncletPad(
1208 SaveAndRestore<llvm::Instruction *> RestoreCurrentFuncletPad(
1252 while (llvm::Instruction *TI = RethrowBlock->getTerminator()) {
1532 SaveAndRestore<llvm::Instruction *> RestoreCurrentFuncletPad(
tools/clang/lib/CodeGen/CGExpr.cpp 3054 llvm::Instruction *Branch = Builder.CreateCondBr(JointCond, Cont, Handlers);
4999 if (Accuracy == 0.0 || !isa<llvm::Instruction>(Val))
5005 cast<llvm::Instruction>(Val)->setMetadata(llvm::LLVMContext::MD_fpmath, Node);
tools/clang/lib/CodeGen/CGExprAgg.cpp 519 llvm::Instruction *cleanupDominator = nullptr;
1297 llvm::Instruction *CleanupDominator = nullptr;
1500 llvm::Instruction *cleanupDominator = nullptr;
tools/clang/lib/CodeGen/CGExprCXX.cpp 980 llvm::Instruction *CleanupDominator = nullptr;
1673 llvm::Instruction *cleanupDominator = nullptr;
tools/clang/lib/CodeGen/CGExprComplex.cpp 716 llvm::Instruction *Branch = Builder.CreateCondBr(IsRNaN, INaNBB, ContBB);
tools/clang/lib/CodeGen/CGExprScalar.cpp 221 if (auto *I = dyn_cast<llvm::Instruction>(V)) {
221 if (auto *I = dyn_cast<llvm::Instruction>(V)) {
2386 llvm::Instruction::BinaryOps op = isInc ? llvm::Instruction::Add :
2386 llvm::Instruction::BinaryOps op = isInc ? llvm::Instruction::Add :
2387 llvm::Instruction::Sub;
3327 if (LHSBinOp->getOpcode() == llvm::Instruction::FMul &&
3332 if (RHSBinOp->getOpcode() == llvm::Instruction::FMul &&
tools/clang/lib/CodeGen/CGLoopInfo.cpp 764 void LoopInfoStack::InsertHelper(Instruction *I) const {
tools/clang/lib/CodeGen/CGLoopInfo.h 221 void InsertHelper(llvm::Instruction *I) const;
tools/clang/lib/CodeGen/CGObjC.cpp 2145 if (!mandatory && isa<llvm::Instruction>(result)) {
tools/clang/lib/CodeGen/CGObjCMac.cpp 4278 llvm::Instruction &I = *BI;
tools/clang/lib/CodeGen/CGObjCRuntime.cpp 231 SaveAndRestore<llvm::Instruction *> RestoreCurrentFuncletPad(CGF.CurrentFuncletPad);
tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp 1619 llvm::Instruction *Ptr = Elem.second.ServiceInsertPt;
1709 !isa<llvm::Instruction>(LVal.getPointer()) ||
1710 cast<llvm::Instruction>(LVal.getPointer())->getParent() == TopBlock ||
1711 cast<llvm::Instruction>(LVal.getPointer())->getParent() ==
tools/clang/lib/CodeGen/CGOpenMPRuntime.h 343 llvm::AssertingVH<llvm::Instruction> ServiceInsertPt = nullptr;
tools/clang/lib/CodeGen/CGStmt.cpp 505 if (llvm::Instruction *insn = dyn_cast<llvm::Instruction>(u)) {
505 if (llvm::Instruction *insn = dyn_cast<llvm::Instruction>(u)) {
tools/clang/lib/CodeGen/CGVTables.cpp 129 for (auto &I : BB) {
220 llvm::Instruction *T = BB.getTerminator();
tools/clang/lib/CodeGen/CodeGenFunction.cpp 385 llvm::Instruction *Ptr = AllocaInsertPt;
410 for (SmallVectorImpl<std::pair<llvm::Instruction *, llvm::Value *> >::iterator
1078 for (llvm::Instruction &I : BB)
2030 llvm::Instruction *inst = new llvm::BitCastInst(value, value->getType(), "",
2051 llvm::Instruction *Assumption = Builder.CreateAlignmentAssumption(
2129 void CodeGenFunction::InsertHelper(llvm::Instruction *I,
2139 llvm::Instruction *I, const llvm::Twine &Name, llvm::BasicBlock *BB,
2342 llvm::Instruction *Assumption) {
tools/clang/lib/CodeGen/CodeGenFunction.h 150 if (!isa<llvm::Instruction>(value)) return false;
153 llvm::BasicBlock *block = cast<llvm::Instruction>(value)->getParent();
289 void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
343 llvm::AssertingVH<llvm::Instruction> AllocaInsertPt;
501 llvm::Instruction *CurrentFuncletPad = nullptr;
694 llvm::Instruction *DominatingIP);
704 llvm::Instruction *DominatingIP);
1066 llvm::Instruction *Inst;
2825 llvm::Instruction *Assumption);
4161 void deferPlaceholderReplacement(llvm::Instruction *Old, llvm::Value *New);
4163 llvm::SmallVector<std::pair<llvm::Instruction *, llvm::Value *>, 4>
4360 void AddObjCARCExceptionMetadata(llvm::Instruction *Inst);
tools/clang/lib/CodeGen/CodeGenModule.cpp 716 void CodeGenModule::DecorateInstructionWithTBAA(llvm::Instruction *Inst,
723 llvm::Instruction *I, const CXXRecordDecl *RD) {
4272 if (bitcast->getOpcode() == llvm::Instruction::BitCast)
tools/clang/lib/CodeGen/CodeGenModule.h 756 void DecorateInstructionWithTBAA(llvm::Instruction *Inst,
760 void DecorateInstructionWithInvariantGroup(llvm::Instruction *I,
tools/clang/lib/CodeGen/CodeGenPGO.cpp 918 llvm::Instruction *ValueSite, llvm::Value *ValuePtr) {
tools/clang/lib/CodeGen/CodeGenPGO.h 89 llvm::Instruction *ValueSite, llvm::Value *ValuePtr);
tools/clang/lib/CodeGen/ItaniumCXXABI.cpp 1048 llvm::Instruction::BinaryOps And, Or;
1051 And = llvm::Instruction::Or;
1052 Or = llvm::Instruction::And;
1055 And = llvm::Instruction::And;
1056 Or = llvm::Instruction::Or;
2019 llvm::Instruction *SI = CGF.Builder.CreateStore(NumElements, NumElementsPtr);
tools/clang/lib/CodeGen/MicrosoftCXXABI.cpp 2826 llvm::Instruction::BinaryOps And, Or;
2829 And = llvm::Instruction::Or;
2830 Or = llvm::Instruction::And;
2833 And = llvm::Instruction::And;
2834 Or = llvm::Instruction::Or;
tools/clang/lib/CodeGen/SanitizerMetadata.cpp 85 void SanitizerMetadata::disableSanitizerForInstruction(llvm::Instruction *I) {
tools/clang/lib/CodeGen/SanitizerMetadata.h 45 void disableSanitizerForInstruction(llvm::Instruction *I);
tools/clang/unittests/CodeGen/IRMatchers.h 78 void push(const T *V, unsigned N = ~0) {
193 if (const auto *Insn = dyn_cast<Instruction>(VR)) {
193 if (const auto *Insn = dyn_cast<Instruction>(VR)) {
251 virtual bool matchInstruction(const Instruction &I) {
256 if (const auto *I = dyn_cast<Instruction>(&V)) {
256 if (const auto *I = dyn_cast<Instruction>(&V)) {
415 inline const Instruction *match(const BasicBlock *BB,
418 for (const auto &I : *BB) {
433 inline const Instruction *matchNext(const Instruction *I, std::shared_ptr<Matcher> M) {
433 inline const Instruction *matchNext(const Instruction *I, std::shared_ptr<Matcher> M) {
tools/clang/unittests/CodeGen/TBAAMetadataTest.cpp 137 const Instruction *I = match(BB,
138 MInstruction(Instruction::Store,
147 MInstruction(Instruction::Store,
159 MInstruction(Instruction::Store,
171 MInstruction(Instruction::Store,
183 MInstruction(Instruction::Store,
195 MInstruction(Instruction::Store,
257 const Instruction *I = match(BB,
258 MInstruction(Instruction::Store,
270 MInstruction(Instruction::Store,
282 MInstruction(Instruction::Store,
294 MInstruction(Instruction::Store,
306 MInstruction(Instruction::Store,
318 MInstruction(Instruction::Store,
368 const Instruction *I = match(BB,
369 MInstruction(Instruction::Store,
381 MInstruction(Instruction::Store,
394 MInstruction(Instruction::Store,
406 MInstruction(Instruction::Store,
460 const Instruction *I = match(BB,
461 MInstruction(Instruction::Store,
473 MInstruction(Instruction::Store,
486 MInstruction(Instruction::Store,
498 MInstruction(Instruction::Store,
565 const Instruction *I = match(BB,
566 MInstruction(Instruction::Store,
578 MInstruction(Instruction::Store,
590 MInstruction(Instruction::Store,
602 MInstruction(Instruction::Store,
665 const Instruction *I = match(BB,
666 MInstruction(Instruction::Store,
678 MInstruction(Instruction::Store,
690 MInstruction(Instruction::Store,
702 MInstruction(Instruction::Store,
714 MInstruction(Instruction::Store,
726 MInstruction(Instruction::Store,
789 const Instruction *I = match(BB,
790 MInstruction(Instruction::Store,
802 MInstruction(Instruction::Store,
814 MInstruction(Instruction::Store,
826 MInstruction(Instruction::Store,
883 const Instruction *I = match(BB,
884 MInstruction(Instruction::Store,
896 MInstruction(Instruction::Store,
908 MInstruction(Instruction::Store,
962 const Instruction *I = match(BB,
963 MInstruction(Instruction::Store,
975 MInstruction(Instruction::Store,
987 MInstruction(Instruction::Store,
1038 const Instruction *I = match(BB,
1039 MInstruction(Instruction::Store,
1051 MInstruction(Instruction::Store,
1063 MInstruction(Instruction::Store,
1116 const Instruction *I = match(BB,
1117 MInstruction(Instruction::Store,
1129 MInstruction(Instruction::Store,
1141 MInstruction(Instruction::Store,
1192 const Instruction *I = match(BB,
1193 MInstruction(Instruction::Store,
1205 MInstruction(Instruction::Store,
1217 MInstruction(Instruction::Load,
1229 MInstruction(Instruction::Store,
1274 const Instruction *I = match(BB,
1275 MInstruction(Instruction::Store,
1287 MInstruction(Instruction::Store,
tools/lldb/source/Expression/IRInterpreter.cpp 262 case Instruction::IntToPtr:
263 case Instruction::PtrToInt:
264 case Instruction::BitCast:
266 case Instruction::GetElementPtr: {
465 case Instruction::IntToPtr:
466 case Instruction::PtrToInt:
467 case Instruction::BitCast:
469 case Instruction::GetElementPtr: {
518 case Instruction::Add:
519 case Instruction::Alloca:
520 case Instruction::BitCast:
521 case Instruction::Br:
522 case Instruction::PHI:
524 case Instruction::Call: {
541 case Instruction::GetElementPtr:
543 case Instruction::ICmp: {
574 case Instruction::And:
575 case Instruction::AShr:
576 case Instruction::IntToPtr:
577 case Instruction::PtrToInt:
578 case Instruction::Load:
579 case Instruction::LShr:
580 case Instruction::Mul:
581 case Instruction::Or:
582 case Instruction::Ret:
583 case Instruction::SDiv:
584 case Instruction::SExt:
585 case Instruction::Shl:
586 case Instruction::SRem:
587 case Instruction::Store:
588 case Instruction::Sub:
589 case Instruction::Trunc:
590 case Instruction::UDiv:
591 case Instruction::URem:
592 case Instruction::Xor:
593 case Instruction::ZExt:
689 const Instruction *inst = &*frame.m_ii;
697 case Instruction::Add:
698 case Instruction::Sub:
699 case Instruction::Mul:
700 case Instruction::SDiv:
701 case Instruction::UDiv:
702 case Instruction::SRem:
703 case Instruction::URem:
704 case Instruction::Shl:
705 case Instruction::LShr:
706 case Instruction::AShr:
707 case Instruction::And:
708 case Instruction::Or:
709 case Instruction::Xor: {
747 case Instruction::Add:
750 case Instruction::Mul:
753 case Instruction::Sub:
756 case Instruction::SDiv:
761 case Instruction::UDiv:
766 case Instruction::SRem:
771 case Instruction::URem:
776 case Instruction::Shl:
779 case Instruction::AShr:
782 case Instruction::LShr:
786 case Instruction::And:
789 case Instruction::Or:
792 case Instruction::Xor:
806 case Instruction::Alloca: {
876 case Instruction::BitCast:
877 case Instruction::ZExt: {
902 case Instruction::SExt: {
931 case Instruction::Br: {
973 case Instruction::PHI: {
1008 case Instruction::GetElementPtr: {
1078 case Instruction::ICmp: {
1174 case Instruction::IntToPtr: {
1205 case Instruction::PtrToInt: {
1236 case Instruction::Trunc: {
1267 case Instruction::Load: {
1354 case Instruction::Ret: {
1357 case Instruction::Store: {
1442 case Instruction::Call: {
tools/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp 178 virtual bool InstrumentInstruction(llvm::Instruction *inst) = 0;
184 void RegisterInstruction(llvm::Instruction &i) {
196 virtual bool InspectInstruction(llvm::Instruction &i) { return true; }
297 typedef std::vector<llvm::Instruction *> InstVector;
320 bool InstrumentInstruction(llvm::Instruction *inst) override {
357 bool InspectInstruction(llvm::Instruction &i) override {
385 std::map<llvm::Instruction *, msgSend_type> msgSend_types;
388 bool InstrumentInstruction(llvm::Instruction *inst) override {
459 case llvm::Instruction::BitCast:
471 bool InspectInstruction(llvm::Instruction &i) override {
tools/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp 46 typedef SmallVector<Instruction *, 2> InstrList;
379 Instruction *first_entry_instruction(entry_block.getFirstNonPHIOrDbg());
533 llvm::cast<Instruction>(
649 if (nsstring_expr->getOpcode() == Instruction::GetElementPtr) {
652 } else if (nsstring_expr->getOpcode() == Instruction::BitCast) {
766 bool IRForTarget::RewriteObjCSelector(Instruction *selector_load) {
802 osr_initializer_expr->getOpcode() != Instruction::GetElementPtr)
898 for (Instruction &inst : basic_block) {
904 for (Instruction *inst : selector_loads) {
927 bool IRForTarget::RewriteObjCClassReference(Instruction *class_load) {
960 ocr_initializer_expr->getOpcode() != Instruction::BitCast)
1049 for (Instruction &inst : basic_block) {
1055 for (Instruction *inst : class_loads) {
1071 bool IRForTarget::RewritePersistentAlloc(llvm::Instruction *persistent_alloc) {
1148 for (Instruction &inst : basic_block) {
1169 for (Instruction *inst : pvar_allocs) {
1194 case Instruction::GetElementPtr:
1195 case Instruction::BitCast:
1389 for (Instruction &inst : basic_block) {
1421 for (Instruction &inst : basic_block) {
1485 if (CE->getOpcode() != Instruction::BitCast)
1499 void IRForTarget::TurnGuardLoadIntoZero(llvm::Instruction *guard_load) {
1505 static void ExciseGuardStore(Instruction *guard_store) {
1515 for (Instruction &inst : basic_block) {
1526 for (Instruction *inst : guard_loads)
1529 for (Instruction *inst : guard_stores)
1561 case Instruction::BitCast: {
1573 "", llvm::cast<Instruction>(
1581 case Instruction::GetElementPtr: {
1613 llvm::cast<Instruction>(
1630 if (Instruction *inst = llvm::dyn_cast<Instruction>(user)) {
1630 if (Instruction *inst = llvm::dyn_cast<Instruction>(user)) {
1740 Instruction *FirstEntryInstruction(entry_block.getFirstNonPHIOrDbg());
1789 llvm::Instruction *entry_instruction = llvm::cast<Instruction>(
1789 llvm::Instruction *entry_instruction = llvm::cast<Instruction>(
1818 } else if (Instruction *instruction = dyn_cast<Instruction>(value)) {
1818 } else if (Instruction *instruction = dyn_cast<Instruction>(value)) {
tools/lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.h 273 bool RewriteObjCSelector(llvm::Instruction *selector_load);
295 bool RewriteObjCClassReference(llvm::Instruction *class_load);
321 bool RewritePersistentAlloc(llvm::Instruction *persistent_alloc);
410 void TurnGuardLoadIntoZero(llvm::Instruction *guard_load);
tools/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp 133 for (auto &inst : block) {
182 llvm::Instruction::BitCast, func, new_func_ptr_type);
tools/llvm-diff/DiffConsumer.cpp 121 } else if (isa<Instruction>(I->L)) {
tools/llvm-diff/DiffLog.h 61 typedef std::pair<Instruction*,Instruction*> DiffRecord;
61 typedef std::pair<Instruction*,Instruction*> DiffRecord;
70 void addMatch(Instruction *L, Instruction *R);
70 void addMatch(Instruction *L, Instruction *R);
72 void addLeft(Instruction *L);
73 void addRight(Instruction *R);
77 Instruction *getLeft(unsigned I) const;
78 Instruction *getRight(unsigned I) const;
tools/llvm-diff/DifferenceEngine.cpp 173 void unify(Instruction *L, Instruction *R) {
173 void unify(Instruction *L, Instruction *R) {
198 Instruction *LeftI = &*LI, *RightI = &*RI;
222 bool matchForBlockDiff(Instruction *L, Instruction *R);
222 bool matchForBlockDiff(Instruction *L, Instruction *R);
245 bool diff(Instruction *L, Instruction *R, bool Complain, bool TryUnify) {
245 bool diff(Instruction *L, Instruction *R, bool Complain, bool TryUnify) {
433 case Instruction::ICmp:
434 case Instruction::FCmp:
439 case Instruction::GetElementPtr:
469 if (isa<Instruction>(L))
512 bool FunctionDifferenceEngine::matchForBlockDiff(Instruction *L,
513 Instruction *R) {
598 Instruction *L = &*LI, *R = &*RI;
631 Instruction *LTerm = LStart->getParent()->getTerminator();
632 Instruction *RTerm = RStart->getParent()->getTerminator();
tools/llvm-dis/llvm-dis.cpp 94 if (const Instruction *I = dyn_cast<Instruction>(&V)) {
94 if (const Instruction *I = dyn_cast<Instruction>(&V)) {
tools/llvm-extract/llvm-extract.cpp 302 for (auto &I : BB) {
tools/llvm-reduce/deltas/ReduceArguments.cpp 63 std::vector<Instruction *> InstToDelete;
70 if (auto *I = dyn_cast<Instruction>(*&U))
70 if (auto *I = dyn_cast<Instruction>(*&U))
74 for (auto *I : InstToDelete) {
tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp 120 for (auto &I : *BB)
tools/llvm-reduce/deltas/ReduceGlobalVars.cpp 35 std::vector<Instruction *> InstToRemove;
39 if (auto *Inst = dyn_cast<Instruction>(U))
39 if (auto *Inst = dyn_cast<Instruction>(U))
47 for (auto *Inst : InstToRemove) {
tools/llvm-reduce/deltas/ReduceInstructions.cpp 23 std::set<Instruction *> InstToKeep;
27 for (auto &Inst : BB)
35 std::vector<Instruction *> InstToDelete;
38 for (auto &Inst : BB)
tools/llvm-reduce/deltas/ReduceMetadata.cpp 24 static void getChunkMetadataNodes(T &MDUser, int &I,
43 static void eraseMetadataIfOutsideChunk(T &MDUser,
67 for (auto &Inst : BB)
78 for (auto &Inst : BB)
106 static void addMetadataToSet(T &MDUser, std::set<MDNode *> &UnnamedNodes) {
126 for (auto &I : BB)
tools/llvm-stress/llvm-stress.cpp 389 Instruction* Term = BB->getTerminator();
391 Instruction::BinaryOps Op;
395 case 0:{Op = (isFloat?Instruction::FAdd : Instruction::Add); break; }
395 case 0:{Op = (isFloat?Instruction::FAdd : Instruction::Add); break; }
396 case 1:{Op = (isFloat?Instruction::FSub : Instruction::Sub); break; }
396 case 1:{Op = (isFloat?Instruction::FSub : Instruction::Sub); break; }
397 case 2:{Op = (isFloat?Instruction::FMul : Instruction::Mul); break; }
397 case 2:{Op = (isFloat?Instruction::FMul : Instruction::Mul); break; }
398 case 3:{Op = (isFloat?Instruction::FDiv : Instruction::SDiv); break; }
398 case 3:{Op = (isFloat?Instruction::FDiv : Instruction::SDiv); break; }
399 case 4:{Op = (isFloat?Instruction::FDiv : Instruction::UDiv); break; }
399 case 4:{Op = (isFloat?Instruction::FDiv : Instruction::UDiv); break; }
400 case 5:{Op = (isFloat?Instruction::FRem : Instruction::SRem); break; }
400 case 5:{Op = (isFloat?Instruction::FRem : Instruction::SRem); break; }
401 case 6:{Op = (isFloat?Instruction::FRem : Instruction::URem); break; }
401 case 6:{Op = (isFloat?Instruction::FRem : Instruction::URem); break; }
402 case 7: {Op = Instruction::Shl; break; }
403 case 8: {Op = Instruction::LShr; break; }
404 case 9: {Op = Instruction::AShr; break; }
405 case 10:{Op = Instruction::And; break; }
406 case 11:{Op = Instruction::Or; break; }
407 case 12:{Op = Instruction::Xor; break; }
662 Value *V = CmpInst::Create(fp ? Instruction::FCmp : Instruction::ICmp,
662 Value *V = CmpInst::Create(fp ? Instruction::FCmp : Instruction::ICmp,
708 std::vector<Instruction*> BoolInst;
709 for (auto &Instr : F->front()) {
716 for (auto *Instr : BoolInst) {
tools/opt/AnalysisWrappers.cpp 40 Instruction *UI = dyn_cast<Instruction>(U);
40 Instruction *UI = dyn_cast<Instruction>(U);
tools/opt/Debugify.cpp 54 Instruction *findTerminatingInstruction(BasicBlock &BB) {
107 for (Instruction &I : BB)
116 Instruction *LastInst = findTerminatingInstruction(BB);
123 Instruction *InsertBefore = &*InsertPt;
126 for (Instruction *I = &*BB.begin(); I != LastInst; I = I->getNextNode()) {
242 for (Instruction &I : instructions(F)) {
262 for (Instruction &I : instructions(F)) {
tools/polly/include/polly/CodeGen/BlockGenerators.h 40 using EscapeUserVectorTy = SmallVector<Instruction *, 4>;
46 MapVector<Instruction *,
477 void copyInstScalar(ScopStmt &Stmt, Instruction *Inst, ValueMapT &BBMap,
572 void copyInstruction(ScopStmt &Stmt, Instruction *Inst, ValueMapT &BBMap,
578 bool canSyntheziseInStmt(ScopStmt &Stmt, Instruction *Inst);
748 void copyInstScalarized(ScopStmt &Stmt, Instruction *Inst,
752 bool extractScalarValues(const Instruction *Inst, ValueMapT &VectorMap,
755 bool hasVectorOperands(const Instruction *Inst, ValueMapT &VectorMap);
772 void copyInstruction(ScopStmt &Stmt, Instruction *Inst, ValueMapT &VectorMap,
tools/polly/include/polly/CodeGen/IRBuilder.h 57 void annotate(llvm::Instruction *I);
95 void annotateSecondLevel(llvm::Instruction *I, llvm::Value *BasePtr);
140 void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
tools/polly/include/polly/CodeGen/IslNodeBuilder.h 297 isl_ast_build *Build, Instruction *AccInst);
tools/polly/include/polly/CodeGen/PerfMonitor.h 34 void insertRegionStart(llvm::Instruction *InsertBefore);
39 void insertRegionEnd(llvm::Instruction *InsertBefore);
tools/polly/include/polly/ScopBuilder.h 56 SmallVector<std::pair<ScopStmt *, Instruction *>, 16> GlobalReads;
159 bool buildConditionSets(BasicBlock *BB, Instruction *TI, Loop *L,
172 bool buildConditionSets(BasicBlock *BB, Value *Condition, Instruction *TI,
467 void buildScalarDependences(ScopStmt *UserStmt, Instruction *Inst);
476 void buildEscapingDependences(Instruction *Inst);
496 bool shouldModelInst(Instruction *Inst, Loop *L);
543 MemoryAccess *addMemoryAccess(ScopStmt *Stmt, Instruction *Inst,
578 void ensureValueWrite(Instruction *Inst);
tools/polly/include/polly/ScopDetection.h 80 const Instruction *Insn;
88 MemAcc(const Instruction *I, std::shared_ptr<ArrayShape> S)
92 using MapInsnToMemAcc = std::map<const Instruction *, MemAcc>;
93 using PairInstSCEV = std::pair<const Instruction *, const SCEV *>;
381 bool isValidAccess(Instruction *Inst, const SCEV *AF, const SCEVUnknown *BP,
400 bool hasScalarDependency(Instruction &Inst, Region &RefRegion) const;
408 bool isValidInstruction(Instruction &Inst, DetectionContext &Context) const;
tools/polly/include/polly/ScopDetectionDiagnostic.h 278 const Instruction *Inst;
281 ReportAffFunc(const RejectReasonKind K, const Instruction *Inst);
301 ReportUndefCond(const Instruction *Inst, BasicBlock *BB)
326 ReportInvalidCond(const Instruction *Inst, BasicBlock *BB)
349 ReportUndefOperand(BasicBlock *BB, const Instruction *Inst)
379 const Instruction *Inst)
403 ReportNoBasePtr(const Instruction *Inst)
423 ReportUndefBasePtr(const Instruction *Inst)
446 ReportVariantBasePtr(Value *BaseValue, const Instruction *Inst)
474 ReportNonAffineAccess(const SCEV *AccessFunction, const Instruction *Inst,
502 ReportDifferentArrayElementSize(const Instruction *Inst, const Value *V)
640 Instruction *Inst;
643 ReportFuncCall(Instruction *Inst);
674 Instruction *Inst;
680 ReportAlias(Instruction *Inst, AliasSet &AS);
721 Instruction *BaseValue;
724 ReportIntToPtr(Instruction *BaseValue);
743 Instruction *Inst;
746 ReportAlloca(Instruction *Inst);
765 Instruction *Inst;
768 ReportUnknownInst(Instruction *Inst);
834 Instruction *Inst;
837 ReportNonSimpleMemoryAccess(Instruction *Inst);
tools/polly/include/polly/ScopInfo.h 572 Instruction *AccessInstruction = nullptr;
720 MemoryAccess(ScopStmt *Stmt, Instruction *AccessInst, AccessType AccType,
895 Instruction *getAccessInstruction() const { return AccessInstruction; }
1159 std::vector<Instruction *> Instructions);
1170 std::vector<Instruction *> EntryBlockInstructions);
1228 DenseMap<const Instruction *, MemoryAccessList> InstructionToAccess;
1236 DenseMap<Instruction *, MemoryAccess *> ValueWrites;
1279 std::vector<Instruction *> Instructions;
1373 bool contains(Instruction *Inst) const {
1411 lookupArrayAccessesFor(const Instruction *Inst) const {
1425 MemoryAccess *getArrayAccessOrNULLFor(const Instruction *Inst) const {
1448 MemoryAccess &getArrayAccessFor(const Instruction *Inst) const {
1458 MemoryAccess *lookupValueWriteOf(Instruction *Inst) const {
1545 const std::vector<Instruction *> &getInstructions() const {
1551 void setInstructions(ArrayRef<Instruction *> Range) {
1555 std::vector<Instruction *>::const_iterator insts_begin() const {
1559 std::vector<Instruction *>::const_iterator insts_end() const {
1564 iterator_range<std::vector<Instruction *>::const_iterator> insts() const {
1569 void prependInstruction(Instruction *Inst) {
1654 Instruction *TI, Loop *L, __isl_keep isl_set *Domain,
1678 bool buildConditionSets(Scop &S, BasicBlock *BB, Instruction *TI, Loop *L,
1790 DenseMap<Instruction *, ScopStmt *> InstStmtMap;
1984 std::vector<Instruction *> Instructions);
1998 std::vector<Instruction *> EntryBlockInstructions);
2202 bool contains(const Instruction *I) const { return R.contains(I); }
2435 ScopStmt *getStmtFor(Instruction *Inst) const {
2739 bool isEscaping(Instruction *Inst);
tools/polly/include/polly/Support/SCEVAffinator.h 110 PWACtx visitSDivInstruction(llvm::Instruction *SDiv);
111 PWACtx visitSRemInstruction(llvm::Instruction *SRem);
tools/polly/include/polly/Support/ScopHelper.h 75 llvm::Instruction *I;
86 explicit MemAccInst(llvm::Instruction &I) : I(&I) { assert(isa(I)); }
87 explicit MemAccInst(llvm::Instruction *I) : I(I) { assert(isa(I)); }
98 return MemAccInst(llvm::cast<llvm::Instruction>(V));
101 return MemAccInst(llvm::cast<llvm::Instruction>(V));
104 return MemAccInst(llvm::cast<llvm::Instruction>(V));
109 return MemAccInst(llvm::cast<llvm::Instruction>(V));
113 return MemAccInst(llvm::cast<llvm::Instruction>(V));
119 return MemAccInst(llvm::cast<llvm::Instruction>(V));
160 llvm::Instruction *get() const {
164 operator llvm::Instruction *() const { return asInstruction(); }
165 llvm::Instruction *operator->() const { return get(); }
256 llvm::Instruction *asInstruction() const { return I; }
287 typedef Instruction *SimpleType;
350 llvm::Instruction *IP, ValueMapT *VMap,
381 llvm::Value *getConditionFromTerminator(llvm::Instruction *TI);
494 bool isDebugCall(llvm::Instruction *Inst);
tools/polly/include/polly/Support/VirtualInstruction.h 238 Instruction *Inst = nullptr;
244 VirtualInstruction(ScopStmt *Stmt, Instruction *Inst)
272 Instruction *getInstruction() const { return Inst; }
319 DenseMapInfo<Instruction *>::isEqual(LHS.getInstruction(),
326 TombstoneKey.Inst = DenseMapInfo<Instruction *>::getTombstoneKey();
333 EmptyKey.Inst = DenseMapInfo<Instruction *>::getEmptyKey();
338 return DenseMapInfo<std::pair<polly::ScopStmt *, Instruction *>>::
tools/polly/lib/Analysis/ScopBuilder.cpp 169 getRegionNodeSuccessor(RegionNode *RN, Instruction *TI, unsigned idx) {
428 BasicBlock *BB, Value *Condition, Instruction *TI, Loop *L,
475 if (Opcode == Instruction::And)
562 BasicBlock *BB, Instruction *TI, Loop *L, __isl_keep isl_set *Domain,
749 Instruction *TI = LatchBB->getTerminator();
897 Instruction *TI = BB->getTerminator();
1034 auto *TI = BB->getTerminator();
1102 auto *OpInst = dyn_cast<Instruction>(Op);
1102 auto *OpInst = dyn_cast<Instruction>(Op);
1118 Instruction *Inst) {
1299 void ScopBuilder::buildEscapingDependences(Instruction *Inst) {
1557 auto *TI = InScop ? CI->getParent()->getTerminator() : nullptr;
1919 for (Instruction &Inst : *BB)
1924 bool ScopBuilder::shouldModelInst(Instruction *Inst, Loop *L) {
1967 std::vector<Instruction *> Instructions;
1968 for (Instruction &Inst : *BB) {
1989 static bool isOrderedInstruction(Instruction *Inst) {
1995 static void joinOperandTree(EquivalenceClasses<Instruction *> &UnionFind,
1996 ArrayRef<Instruction *> ModeledInsts) {
1997 for (Instruction *Inst : ModeledInsts) {
2002 Instruction *OpInst = dyn_cast<Instruction>(Op.get());
2002 Instruction *OpInst = dyn_cast<Instruction>(Op.get());
2022 joinOrderedInstructions(EquivalenceClasses<Instruction *> &UnionFind,
2023 ArrayRef<Instruction *> ModeledInsts) {
2024 SetVector<Instruction *> SeenLeaders;
2025 for (Instruction *Inst : ModeledInsts) {
2029 Instruction *Leader = UnionFind.getLeaderValue(Inst);
2042 for (Instruction *Prev : reverse(SeenLeaders)) {
2073 static void joinOrderedPHIs(EquivalenceClasses<Instruction *> &UnionFind,
2074 ArrayRef<Instruction *> ModeledInsts) {
2075 for (Instruction *Inst : ModeledInsts) {
2084 Instruction *IncomingVal =
2085 dyn_cast<Instruction>(PHI->getIncomingValue(Idx));
2098 SmallVector<Instruction *, 32> ModeledInsts;
2099 EquivalenceClasses<Instruction *> UnionFind;
2100 Instruction *MainInst = nullptr, *MainLeader = nullptr;
2101 for (Instruction &Inst : *BB) {
2123 MapVector<Instruction *, std::vector<Instruction *>> LeaderToInstList;
2123 MapVector<Instruction *, std::vector<Instruction *>> LeaderToInstList;
2128 for (Instruction &Inst : *BB) {
2142 for (Instruction &Inst : *BB) {
2149 std::vector<Instruction *> &InstList = LeaderToInstList[*LeaderIt];
2157 std::vector<Instruction *> &InstList = Instructions.second;
2179 std::vector<Instruction *> Instructions;
2182 for (Instruction &Inst : *SR.getEntry())
2244 for (Instruction *Inst : Stmt->getInstructions())
2249 for (Instruction &Inst : BB) {
2263 ScopStmt *Stmt, Instruction *Inst, MemoryAccess::AccessType AccType,
2510 void ScopBuilder::ensureValueWrite(Instruction *Inst) {
2576 ensureValueWrite(cast<Instruction>(V));
2652 const Instruction *Load) {
2656 case Instruction::FAdd:
2660 case Instruction::Add:
2662 case Instruction::Or:
2664 case Instruction::Xor:
2666 case Instruction::And:
2668 case Instruction::FMul:
2672 case Instruction::Mul:
2808 if (auto *BasePtrInst = dyn_cast<Instruction>(BaseAddr))
2808 if (auto *BasePtrInst = dyn_cast<Instruction>(BaseAddr))
2982 auto *AccInst = InvMAs.front().MA->getAccessInstruction();
2994 Instruction *AccInst = MA->getAccessInstruction();
3114 (BinOp->getOpcode() == Instruction::Mul ||
3115 BinOp->getOpcode() == Instruction::FMul))
3551 for (auto &Inst : *BB) {
3588 for (auto &Inst : *S->getRegion().getExit()) {
3612 for (Instruction &Inst : *BB) {
3640 for (Instruction &Inst : *R.getExit()) {
3653 Instruction *GlobalRead = GlobalReadPair.second;
tools/polly/lib/Analysis/ScopDetection.cpp 565 if (Opcode == Instruction::And || Opcode == Instruction::Or) {
565 if (Opcode == Instruction::And || Opcode == Instruction::Or) {
641 Instruction *TI = BB.getTerminator();
792 Instruction *I = dyn_cast<Instruction>(&Val);
792 Instruction *I = dyn_cast<Instruction>(&Val);
881 if (auto *Inst = dyn_cast<Instruction>(Unknown->getValue())) {
881 if (auto *Inst = dyn_cast<Instruction>(Unknown->getValue())) {
945 const Instruction *Insn = Pair.first;
973 const Instruction *Insn = Pair.first;
1054 bool ScopDetection::isValidAccess(Instruction *Inst, const SCEV *AF,
1148 Instruction *Inst = dyn_cast<Instruction>(Ptr.getValue());
1148 Instruction *Inst = dyn_cast<Instruction>(Ptr.getValue());
1192 bool ScopDetection::isValidInstruction(Instruction &Inst,
1195 auto *OpInst = dyn_cast<Instruction>(&Op);
1195 auto *OpInst = dyn_cast<Instruction>(&Op);
1204 auto *UI = dyn_cast<Instruction>(U);
1204 auto *UI = dyn_cast<Instruction>(U);
1592 for (auto &I : *LBB)
1742 const Instruction *TInst = CurrBB->getTerminator();
tools/polly/lib/Analysis/ScopDetectionDiagnostic.cpp 87 template <typename T> std::string operator+(Twine LHS, const T &RHS) {
123 for (const Instruction &Inst : *BB) {
270 ReportAffFunc::ReportAffFunc(const RejectReasonKind K, const Instruction *Inst)
549 ReportFuncCall::ReportFuncCall(Instruction *Inst)
576 ReportNonSimpleMemoryAccess::ReportNonSimpleMemoryAccess(Instruction *Inst)
607 ReportAlias::ReportAlias(Instruction *Inst, AliasSet &AS)
679 ReportIntToPtr::ReportIntToPtr(Instruction *BaseValue)
703 ReportAlloca::ReportAlloca(Instruction *Inst)
725 ReportUnknownInst::ReportUnknownInst(Instruction *Inst)
792 for (const Instruction &Inst : *BB)
tools/polly/lib/Analysis/ScopInfo.cpp 885 MemoryAccess::MemoryAccess(ScopStmt *Stmt, Instruction *AccessInst,
1145 Instruction *AccessInst = Access->getAccessInstruction();
1151 Instruction *AccessVal = cast<Instruction>(Access->getAccessValue());
1151 Instruction *AccessVal = cast<Instruction>(Access->getAccessValue());
1190 std::vector<Instruction *> EntryBlockInstructions)
1197 std::vector<Instruction *> Instructions)
1261 for (Instruction *Inst : Instructions)
1301 bool Found = ValueWrites.erase(cast<Instruction>(MA->getAccessValue()));
1439 if (Instruction *I = dyn_cast<Instruction>(Unknown->getValue()))
1439 if (Instruction *I = dyn_cast<Instruction>(Unknown->getValue()))
1713 for (Instruction *Inst : Stmt.getInstructions())
1723 for (Instruction &Inst : *BB)
1732 for (Instruction *Inst : Stmt.getInstructions())
1988 auto *PointerBaseInst = dyn_cast<Instruction>(PointerBase);
1988 auto *PointerBaseInst = dyn_cast<Instruction>(PointerBase);
2370 std::vector<Instruction *> Instructions) {
2375 for (Instruction *Inst : Instructions) {
2383 std::vector<Instruction *> Instructions) {
2388 for (Instruction *Inst : Instructions) {
2398 for (Instruction &Inst : *BB) {
2434 if (auto *IncomingInst = dyn_cast<Instruction>(U.get())) {
2434 if (auto *IncomingInst = dyn_cast<Instruction>(U.get())) {
2514 Instruction *Val = dyn_cast<Instruction>(SAI->getBasePtr());
2514 Instruction *Val = dyn_cast<Instruction>(SAI->getBasePtr());
2547 bool Scop::isEscaping(Instruction *Inst) {
tools/polly/lib/CodeGen/BlockGenerators.cpp 214 void BlockGenerator::copyInstScalar(ScopStmt &Stmt, Instruction *Inst,
222 Instruction *NewInst = Inst->clone();
350 bool BlockGenerator::canSyntheziseInStmt(ScopStmt &Stmt, Instruction *Inst) {
356 void BlockGenerator::copyInstruction(ScopStmt &Stmt, Instruction *Inst,
401 Instruction *NewInst = &*I;
462 for (Instruction *Inst : Stmt.getInstructions())
465 for (Instruction &Inst : *BB)
523 Instruction *Inst = cast<Instruction>(Array->getBasePtr());
523 Instruction *Inst = cast<Instruction>(Array->getBasePtr());
535 Instruction *UI = dyn_cast<Instruction>(U);
535 Instruction *UI = dyn_cast<Instruction>(U);
641 if (auto *CondInst = dyn_cast<Instruction>(Cond))
641 if (auto *CondInst = dyn_cast<Instruction>(Cond))
701 DenseSet<Instruction *> Encountered;
706 for (Instruction *Inst : Stmt.insts()) {
721 auto *OpInst = dyn_cast<Instruction>(Op);
721 auto *OpInst = dyn_cast<Instruction>(Op);
842 auto *Inst = dyn_cast<Instruction>(Array->getBasePtr());
842 auto *Inst = dyn_cast<Instruction>(Array->getBasePtr());
874 Instruction *EscapeInst = EscapeMapping.first;
900 for (Instruction *EUser : EscapeUsers)
914 auto *Inst = dyn_cast<Instruction>(Array->getBasePtr());
914 auto *Inst = dyn_cast<Instruction>(Array->getBasePtr());
981 for (auto &Inst : *Stmt.getBasicBlock())
985 for (auto &Inst : *BB)
993 for (Instruction *EUser : EscapeUsers) {
1223 bool VectorBlockGenerator::hasVectorOperands(const Instruction *Inst,
1231 bool VectorBlockGenerator::extractScalarValues(const Instruction *Inst,
1264 ScopStmt &Stmt, Instruction *Inst, ValueMapT &VectorMap,
1292 ScopStmt &Stmt, Instruction *Inst, ValueMapT &VectorMap,
1394 for (Instruction &Inst : *BB)
1560 Instruction *TI = BB->getTerminator();
1568 Instruction *BICopy = BBCopyEnd->getTerminator();
1589 Instruction *LoopPHIInc = BinaryOperator::CreateAdd(
tools/polly/lib/CodeGen/CodeGeneration.cpp 78 auto *OrigTerminator = Block.getTerminator();
251 auto *SplitBBTerm = Builder.GetInsertBlock()->getTerminator();
tools/polly/lib/CodeGen/IRBuilder.cpp 151 static llvm::Value *getMemAccInstPointerOperand(Instruction *Inst) {
159 void ScopAnnotator::annotateSecondLevel(llvm::Instruction *Inst,
193 void ScopAnnotator::annotate(Instruction *Inst) {
tools/polly/lib/CodeGen/IslExprBuilder.cpp 104 case Instruction::Add:
106 case Instruction::Sub:
108 case Instruction::Mul:
118 case Instruction::Add:
122 case Instruction::Sub:
126 case Instruction::Mul:
153 return createBinOp(Instruction::Add, LHS, RHS, Name);
157 return createBinOp(Instruction::Sub, LHS, RHS, Name);
161 return createBinOp(Instruction::Mul, LHS, RHS, Name);
tools/polly/lib/CodeGen/IslNodeBuilder.cpp 210 for (Instruction &Inst : *BB) {
251 if (Instruction *OpInst = dyn_cast<Instruction>(BasePtr))
251 if (Instruction *OpInst = dyn_cast<Instruction>(BasePtr))
850 auto *BasePtr =
851 dyn_cast<Instruction>(MA->getLatestScopArrayInfo()->getBasePtr());
1050 if (auto *Inst = dyn_cast<Instruction>(Val)) {
1050 if (auto *Inst = dyn_cast<Instruction>(Val)) {
1198 Instruction *AccInst) {
1244 Instruction *AccInst = MA.getAccessInstruction();
1290 auto *CondBBTerminator = CondBB->getTerminator();
1377 Instruction *AccInst = MA->getAccessInstruction();
1385 Instruction *MAAccInst = MA->getAccessInstruction();
1426 Instruction *MAAccInst = MA->getAccessInstruction();
1430 if (Instruction *UI = dyn_cast<Instruction>(U))
1430 if (Instruction *UI = dyn_cast<Instruction>(U))
1481 auto *CreatedArray = CallInst::CreateMalloc(
1567 Instruction *InsertLocation = &*Builder.GetInsertPoint();
tools/polly/lib/CodeGen/LoopGenerators.cpp 230 Instruction *IP = &*EntryBB.getFirstInsertionPt();
tools/polly/lib/CodeGen/PerfMonitor.cpp 263 void PerfMonitor::insertRegionStart(Instruction *InsertBefore) {
274 void PerfMonitor::insertRegionEnd(Instruction *InsertBefore) {
tools/polly/lib/Support/SCEVAffinator.cpp 496 PWACtx SCEVAffinator::visitSDivInstruction(Instruction *SDiv) {
513 PWACtx SCEVAffinator::visitSRemInstruction(Instruction *SRem) {
531 if (Instruction *I = dyn_cast<Instruction>(Expr->getValue())) {
531 if (Instruction *I = dyn_cast<Instruction>(Expr->getValue())) {
533 case Instruction::IntToPtr:
535 case Instruction::PtrToInt:
537 case Instruction::SDiv:
539 case Instruction::SRem:
tools/polly/lib/Support/SCEVValidator.cpp 342 ValidatorResult visitGenericInst(Instruction *I, const SCEV *S) {
352 ValidatorResult visitCallInstruction(Instruction *I, const SCEV *S) {
364 ValidatorResult visitLoadInstruction(Instruction *I, const SCEV *S) {
375 Instruction *SDiv = nullptr) {
407 ValidatorResult visitSDivInstruction(Instruction *SDiv, const SCEV *Expr) {
416 ValidatorResult visitSRemInstruction(Instruction *SRem, const SCEV *S) {
443 if (Instruction *I = dyn_cast<Instruction>(Expr->getValue())) {
443 if (Instruction *I = dyn_cast<Instruction>(Expr->getValue())) {
445 case Instruction::IntToPtr:
447 case Instruction::PtrToInt:
449 case Instruction::Load:
451 case Instruction::SDiv:
453 case Instruction::SRem:
455 case Instruction::Call:
509 Instruction *Inst = dyn_cast<Instruction>(Unknown->getValue());
509 Instruction *Inst = dyn_cast<Instruction>(Unknown->getValue());
592 Instruction *Inst = dyn_cast<Instruction>(Unknown->getValue());
592 Instruction *Inst = dyn_cast<Instruction>(Unknown->getValue());
593 if (!Inst || (Inst->getOpcode() != Instruction::SRem &&
594 Inst->getOpcode() != Instruction::SDiv))
685 if (Opcode == Instruction::And || Opcode == Instruction::Or)
685 if (Opcode == Instruction::And || Opcode == Instruction::Or)
tools/polly/lib/Support/ScopHelper.cpp 171 static BasicBlock *splitBlock(BasicBlock *Old, Instruction *SplitPt,
239 Value *expandCodeFor(const SCEV *E, Type *Ty, Instruction *I) {
268 const SCEV *visitGenericInst(const SCEVUnknown *E, Instruction *Inst,
269 Instruction *IP) {
276 auto *InstClone = Inst->clone();
302 Instruction *Inst = dyn_cast<Instruction>(E->getValue());
302 Instruction *Inst = dyn_cast<Instruction>(E->getValue());
303 Instruction *IP;
311 if (!Inst || (Inst->getOpcode() != Instruction::SRem &&
312 Inst->getOpcode() != Instruction::SDiv))
396 Instruction *IP, ValueMapT *VMap,
429 for (Instruction &Inst : BB)
450 Value *polly::getConditionFromTerminator(Instruction *TI) {
580 auto *UserI = dyn_cast<Instruction>(User);
580 auto *UserI = dyn_cast<Instruction>(User);
651 Instruction *UI = dyn_cast<Instruction>(U.getUser());
651 Instruction *UI = dyn_cast<Instruction>(U.getUser());
724 bool polly::isDebugCall(Instruction *Inst) {
738 for (Instruction &Inst : *BB) {
753 for (Instruction *Inst : Stmt->getInstructions())
tools/polly/lib/Support/ScopLocation.cpp 27 for (const Instruction &Inst : *BB) {
tools/polly/lib/Support/VirtualInstruction.cpp 23 Instruction *UI = dyn_cast<Instruction>(U.getUser());
23 Instruction *UI = dyn_cast<Instruction>(U.getUser());
92 auto Inst = cast<Instruction>(Val);
171 static bool isRoot(const Instruction *Inst) {
194 return S->isEscaping(cast<Instruction>(MA->getAccessValue()));
209 for (Instruction &Inst : *BB)
214 for (Instruction *Inst : Stmt->getInstructions())
309 cast<Instruction>(VUse.getValue()));
374 Instruction *Inst = VInst.getInstruction();
tools/polly/lib/Transform/DeLICM.cpp 569 if (!isa<Instruction>(User))
571 auto UserInst = cast<Instruction>(User);
671 auto *DefInst = DefMA->getAccessInstruction();
tools/polly/lib/Transform/ForwardOpTree.cpp 391 ForwardingDecision forwardKnownLoad(ScopStmt *TargetStmt, Instruction *Inst,
543 ForwardingDecision reloadKnownContent(ScopStmt *TargetStmt, Instruction *Inst,
614 Instruction *UseInst,
761 Instruction *Inst = cast<Instruction>(UseVal);
761 Instruction *Inst = cast<Instruction>(UseVal);
tools/polly/lib/Transform/MaximalStaticExpansion.cpp 63 void emitRemark(StringRef Msg, Instruction *Inst);
427 void MaximalStaticExpander::emitRemark(StringRef Msg, Instruction *Inst) {
tools/polly/lib/Transform/RewriteByReferenceParameters.cpp 38 void tryRewriteInstruction(Instruction &Inst) {
83 for (Instruction &Inst : BB)
tools/polly/lib/Transform/Simplify.cpp 561 SmallVector<Instruction *, 32> AllInsts(Stmt.insts_begin(),
563 SmallVector<Instruction *, 32> RemainInsts;
565 for (Instruction *Inst : AllInsts) {
tools/polly/lib/Transform/ZoneAlgo.cpp 421 Instruction *AccInst = MA->getAccessInstruction();
805 auto *Inst = cast<Instruction>(Val);
805 auto *Inst = cast<Instruction>(Val);
887 Instruction *AccInst = MA->getAccessInstruction();
tools/verify-uselistorder/verify-uselistorder.cpp 221 for (const Instruction &I : BB)
226 for (const Instruction &I : BB)
497 for (Instruction &I : BB)
502 for (Instruction &I : BB)
unittests/Analysis/AliasAnalysisTest.cpp 51 for (Instruction &I : instructions(F))
unittests/Analysis/AliasSetTrackerTest.cpp 77 for (auto &Inst : *Test->begin()) {
unittests/Analysis/CFGTest.cpp 73 IsPotentiallyReachableTestPass(bool ExpectedResult, Instruction *A,
74 Instruction *B,
113 Instruction *A, *B;
129 Instruction *A, *B;
unittests/Analysis/CGSCCPassManagerTest.cpp 83 for (Instruction &I : instructions(F)) {
unittests/Analysis/CaptureTrackingTest.cpp 67 Instruction *Ret = EntryBB->getTerminator();
unittests/Analysis/IVDescriptorsTest.cpp 88 Instruction *Inst_inc = nullptr;
unittests/Analysis/MemorySSATest.cpp 633 Instruction *SI = B.CreateStore(ConstantInt::get(Int8, 0), Alloca);
634 Instruction *LI = B.CreateLoad(Int8, Alloca);
716 Instruction *FirstStore = B.CreateStore(Zero, AllocA);
718 Instruction *ALoad0 = B.CreateLoad(Int8, AllocA, "");
719 Instruction *BStore = B.CreateStore(Zero, AllocB);
722 Instruction *KillStore = B.CreateStore(Zero, AllocA);
723 Instruction *ALoad = B.CreateLoad(Int8, AllocA, "");
727 Instruction *BelowPhi = B.CreateStore(Zero, AllocA);
773 Instruction *Store = B.CreateStore(One, AllocA);
774 Instruction *Load = B.CreateLoad(Int8, AllocA);
800 Instruction *SIA = B.CreateStore(ConstantInt::get(Int8, 0), AllocaA);
802 Instruction *SIB = B.CreateStore(ConstantInt::get(Int8, 0), AllocaB);
803 Instruction *LIA = B.CreateLoad(Int8, AllocaA);
1241 Instruction *LifetimeStart = B.CreateCall(
1244 Instruction *FooStore = B.CreateStore(B.getInt8(0), Foo);
1245 Instruction *BarStore = B.CreateStore(B.getInt8(0), Bar);
unittests/Analysis/OrderedBasicBlockTest.cpp 41 Instruction *Add = &*I++;
42 Instruction *Ret = &*I++;
unittests/Analysis/ProfileSummaryInfoTest.cpp 191 auto *CI2 = BB2->getFirstNonPHI();
238 auto *CI2 = BB2->getFirstNonPHI();
unittests/Analysis/ScalarEvolutionTest.cpp 186 CmpInst *Cmp = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_ULT,
203 Instruction *Gep = cast<Instruction>(V)->getPrevNode();
203 Instruction *Gep = cast<Instruction>(V)->getPrevNode();
210 static Instruction *getInstructionByName(Function &F, StringRef Name) {
211 for (auto &I : instructions(F))
286 auto *IV0 = getInstructionByName(F, "iv0");
287 auto *IV0Inc = getInstructionByName(F, "iv0.inc");
343 SmallVector<Instruction*, 8> Muls(8), Acc(8), NextAcc(8);
451 Instruction *Trunc = CastInst::CreateTruncOrBitCast(A1, Ty32, "", EntryBB);
452 Instruction *Mul1 = BinaryOperator::CreateMul(Trunc, A2, "", EntryBB);
453 Instruction *Add1 = BinaryOperator::CreateAdd(Mul1, Trunc, "", EntryBB);
455 Instruction *Add2 = BinaryOperator::CreateAdd(Mul1, Add1, "", EntryBB);
471 static Instruction &GetInstByName(Function &F, StringRef Name) {
472 for (auto &I : instructions(F))
534 auto &I0 = GetInstByName(F, "iv0");
535 auto &I1 = *I0.getNextNode();
696 auto *Cmp = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_SGT, PN,
783 Instruction *Ret = Builder.CreateRetVoid();
847 auto *Add = cast<Instruction>(
847 auto *Add = cast<Instruction>(
850 auto *Cond = cast<Instruction>(
850 auto *Cond = cast<Instruction>(
852 auto *Br = cast<Instruction>(Builder.CreateCondBr(Cond, L, Post));
852 auto *Br = cast<Instruction>(Builder.CreateCondBr(Cond, L, Post));
943 auto *Load = cast<Instruction>(Builder.CreateLoad(T_int64, Arg, "load"));
943 auto *Load = cast<Instruction>(Builder.CreateLoad(T_int64, Arg, "load"));
948 auto *Add = cast<Instruction>(
948 auto *Add = cast<Instruction>(
950 auto *Cond = cast<Instruction>(
950 auto *Cond = cast<Instruction>(
952 auto *Br = cast<Instruction>(Builder.CreateCondBr(Cond, L, Post));
952 auto *Br = cast<Instruction>(Builder.CreateCondBr(Cond, L, Post));
1173 auto *Add = cast<Instruction>(
1173 auto *Add = cast<Instruction>(
1176 auto *Cond = cast<Instruction>(
1176 auto *Cond = cast<Instruction>(
1232 auto *S1 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1232 auto *S1 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1236 auto *S2 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1236 auto *S2 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1238 auto *R = cast<Instruction>(Builder.CreateRetVoid());
1238 auto *R = cast<Instruction>(Builder.CreateRetVoid());
1244 auto *I = cast<Instruction>(Exp.expandCodeFor(S, nullptr, R));
1244 auto *I = cast<Instruction>(Exp.expandCodeFor(S, nullptr, R));
1284 auto *S1 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1284 auto *S1 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1288 auto *S2 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1288 auto *S2 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1290 auto *R = cast<Instruction>(Builder.CreateRetVoid());
1290 auto *R = cast<Instruction>(Builder.CreateRetVoid());
1296 auto *I = cast<Instruction>(Exp.expandCodeFor(S, nullptr, R));
1296 auto *I = cast<Instruction>(Exp.expandCodeFor(S, nullptr, R));
1329 auto *S1 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1329 auto *S1 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1330 auto *S2 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1330 auto *S2 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1335 auto *R = cast<Instruction>(Builder.CreateRetVoid());
1335 auto *R = cast<Instruction>(Builder.CreateRetVoid());
1347 auto *I = cast<Instruction>(Exp.expandCodeFor(SC1, nullptr, R));
1347 auto *I = cast<Instruction>(Exp.expandCodeFor(SC1, nullptr, R));
1380 auto *S1 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1380 auto *S1 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1381 auto *S2 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1381 auto *S2 = cast<Instruction>(Builder.CreateAdd(Arg, C, "add"));
1386 auto *R = cast<Instruction>(Builder.CreateRetVoid());
1386 auto *R = cast<Instruction>(Builder.CreateRetVoid());
1398 auto *I = cast<Instruction>(Exp.expandCodeFor(SC1, nullptr, R));
1398 auto *I = cast<Instruction>(Exp.expandCodeFor(SC1, nullptr, R));
1431 auto *S1 = cast<Instruction>(Builder.CreateAdd(A, C, "s1"));
1431 auto *S1 = cast<Instruction>(Builder.CreateAdd(A, C, "s1"));
1432 auto *S2 = cast<Instruction>(Builder.CreateUDiv(S1, B, "s2"));
1432 auto *S2 = cast<Instruction>(Builder.CreateUDiv(S1, B, "s2"));
1478 auto &I = GetInstByName(F, "i");
1486 auto *InsertAt = I.getNextNode();
1521 auto &I = GetInstByName(F, "i");
1536 auto *InsertAt = I.getNextNode();
1601 auto &I = GetInstByName(F, "i");
1602 auto &CanonicalIV = GetInstByName(F, "canonical.iv");
1615 auto *InsertAt = I.getNextNode();
1668 auto *I = cast<Instruction>(Exp.expandCodeFor(AndSCEV, nullptr, And));
1668 auto *I = cast<Instruction>(Exp.expandCodeFor(AndSCEV, nullptr, And));
1777 auto &I = GetInstByName(F, "i");
1785 auto *InsertAt = I.getNextNode();
1818 auto &I = GetInstByName(F, "i");
1834 auto *InsertAt = I.getNextNode();
1871 auto &I = GetInstByName(F, "i");
1872 auto &CanonicalIV = GetInstByName(F, "canonical.iv");
1886 auto *InsertAt = I.getNextNode();
unittests/Analysis/SparsePropagation.cpp 142 Instruction &I, DenseMap<TestLatticeKey, TestLatticeVal> &ChangedValues,
145 case Instruction::Call:
147 case Instruction::Ret:
149 case Instruction::Store:
165 Instruction *I = CS.getInstruction();
216 void visitInst(Instruction &I,
519 ConstantExpr::getCast(Instruction::BitCast, P, Builder.getInt8PtrTy());
unittests/Analysis/UnrollAnalyzerTest.cpp 42 for (Instruction &I : *BB)
102 Instruction *Y1 = &*BBI++;
103 Instruction *Y2 = &*BBI++;
165 Instruction *Y1 = &*BBI;
168 Instruction *Y2 = &*BBI;
210 Instruction *Y1 = &*BBI++;
211 Instruction *Y2 = &*BBI++;
257 Instruction *Y1 = &*BBI;
303 Instruction *Y1 = &*BBI++;
304 Instruction *Y2 = &*BBI++;
305 Instruction *Y3 = &*BBI++;
unittests/Analysis/ValueTrackingTest.cpp 59 Instruction *A = nullptr;
66 Instruction::CastOps CastOp;
511 for (auto &I : BB) {
unittests/Analysis/VectorUtilsTest.cpp 58 Instruction *A;
unittests/FuzzMutate/RandomIRBuilderTest.cpp 67 SmallVector<Instruction *, 32> Insts;
110 Instruction *Src = &*std::next(BB.begin());
154 Instruction *Source = &*BB.begin();
156 SmallVector<Instruction *, 1> Sinks = {&*std::next(BB.begin())};
189 Instruction *Source = &*std::next(BB.begin());
229 Instruction *Invoke = &*BB.begin();
258 Instruction *FuncPtr = &*BB.begin();
260 Instruction *OpaquePtr = &*std::next(BB.begin());
288 Instruction *Alloca = &*BB.begin();
unittests/IR/BasicBlockTest.cpp 115 Instruction *AddInst = cast<Instruction>(Builder1.CreateAdd(V, V));
115 Instruction *AddInst = cast<Instruction>(Builder1.CreateAdd(V, V));
116 Instruction *MulInst = cast<Instruction>(Builder1.CreateMul(AddInst, V));
116 Instruction *MulInst = cast<Instruction>(Builder1.CreateMul(AddInst, V));
118 Instruction *SubInst = cast<Instruction>(Builder1.CreateSub(MulInst, V));
118 Instruction *SubInst = cast<Instruction>(Builder1.CreateSub(MulInst, V));
121 SmallVector<Instruction *, 4> Exp = {Var, AddInst, MulInst, SubInst};
unittests/IR/ConstantRangeTest.cpp 1385 Instruction::Add, C, OBO::NoUnsignedWrap);
1390 Instruction::Add, C, OBO::NoSignedWrap);
1413 Instruction::Sub, C, OBO::NoUnsignedWrap);
1418 Instruction::Sub, C, OBO::NoSignedWrap);
1438 Instruction::Add, ConstantRange(32, /* isFullSet = */ true),
1444 Instruction::Sub, ConstantRange(32, /* isFullSet = */ true),
1450 Instruction::Add, ConstantRange(32, /* isFullSet = */ true),
1456 Instruction::Sub, ConstantRange(32, /* isFullSet = */ true),
1600 void TestNoWrapRegionExhaustive(Instruction::BinaryOps BinOp,
1606 if (Instruction::isShift(BinOp) && CR.getUnsignedMax().uge(Bits))
1635 Instruction::Add, OverflowingBinaryOperator::NoUnsignedWrap,
1642 Instruction::Add, OverflowingBinaryOperator::NoSignedWrap,
1649 Instruction::Sub, OverflowingBinaryOperator::NoUnsignedWrap,
1656 Instruction::Sub, OverflowingBinaryOperator::NoSignedWrap,
1663 Instruction::Mul, OverflowingBinaryOperator::NoUnsignedWrap,
1670 Instruction::Mul, OverflowingBinaryOperator::NoSignedWrap,
1676 TestNoWrapRegionExhaustive(Instruction::Shl,
1683 TestNoWrapRegionExhaustive(Instruction::Shl,
unittests/IR/ConstantsTest.cpp 496 bool result = ConstantExpr::get(Instruction::And, TheConstantExpr,
unittests/IR/DominatorTreeTest.cpp 81 Instruction *Y1 = &*BBI++;
82 Instruction *Y2 = &*BBI++;
83 Instruction *Y3 = &*BBI++;
87 Instruction *Y4 = &*BBI++;
91 Instruction *Y5 = &*BBI++;
95 Instruction *Y6 = &*BBI++;
96 Instruction *Y7 = &*BBI++;
100 Instruction *Y8 = &*BBI++;
101 Instruction *Y9 = &*BBI++;
303 const Instruction *TI = BB0->getTerminator();
unittests/IR/IRBuilderTest.cpp 53 Instruction *I;
58 I = cast<Instruction>(Builder.CreateFAdd(V, V));
333 Instruction *TI = BB->getTerminator();
381 Value *U = Builder.CreateUnOp(Instruction::FNeg, V);
388 Instruction *I = cast<Instruction>(U);
388 Instruction *I = cast<Instruction>(U);
392 Instruction *IFMF = cast<Instruction>(VFMF);
392 Instruction *IFMF = cast<Instruction>(VFMF);
401 Instruction *FDiv, *FAdd, *FCmp, *FCall;
408 FAdd = cast<Instruction>(F);
418 FAdd = cast<Instruction>(F);
445 FAdd = cast<Instruction>(F);
450 F = Builder.CreateBinOp(Instruction::FAdd, F, F);
453 FAdd = cast<Instruction>(F);
460 FDiv = cast<Instruction>(F);
468 FDiv = cast<Instruction>(F);
480 FDiv = cast<Instruction>(F);
487 FCmp = cast<Instruction>(FC);
498 FCmp = cast<Instruction>(FC);
506 FAdd = cast<Instruction>(FC);
517 FAdd = cast<Instruction>(FC);
525 FAdd = cast<Instruction>(F);
535 FAdd = cast<Instruction>(F);
573 FDiv = cast<Instruction>(F);
661 Builder.SetInsertPoint(cast<Instruction>(F));
unittests/IR/InstructionsTest.cpp 412 Instruction *I = Builder.CreatePHI(Builder.getDoubleTy(), 0);
605 auto *UI =
606 cast<Instruction>(B.CreateUDiv(Arg0, Arg0, "", /*isExact*/ true));
613 auto *ShrI =
614 cast<Instruction>(B.CreateLShr(Arg0, Arg0, "", /*isExact*/ true));
621 auto *AI = cast<Instruction>(
621 auto *AI = cast<Instruction>(
630 auto *SI = cast<Instruction>(
630 auto *SI = cast<Instruction>(
639 auto *ShlI = cast<Instruction>(
639 auto *ShlI = cast<Instruction>(
1029 auto *Term = BB.getTerminator();
1041 Instruction *I = Builder.CreatePHI(Builder.getInt32Ty(), 0);
1044 Instruction *FP = Builder.CreatePHI(Builder.getDoubleTy(), 0);
1121 Instruction *I = Builder.CreatePHI(Builder.getDoubleTy(), 0);
unittests/IR/MetadataTest.cpp 212 Instruction *I = new BitCastInst(C, Type::getInt32Ty(Context));
unittests/IR/PatternMatch.cpp 1076 cast<Instruction>(V2)->setHasNoSignedZeros(true);
1114 typedef ::testing::Types<std::tuple<Value*, Instruction*>,
1115 std::tuple<const Value*, const Instruction *>>
unittests/IR/ValueHandleTest.cpp 540 TrackingVH<Instruction> VH(BitcastV.get());
unittests/IR/ValueMapTest.cpp 37 typedef ::testing::Types<Value, Instruction, const Instruction> KeyTypes;
37 typedef ::testing::Types<Value, Instruction, const Instruction> KeyTypes;
108 SmallVector<std::pair<Instruction*, int>, 2> Elems;
unittests/IR/ValueTest.cpp 135 Instruction *I0 = &*BB.begin();
137 Instruction *I1 = &*++BB.begin();
212 Instruction *I0 = &*EntryBB.begin();
214 Instruction *I1 = &*++EntryBB.begin();
unittests/Linker/LinkModulesTest.cpp 54 Constant *OnePtr = ConstantExpr::getCast(Instruction::IntToPtr, One,
unittests/ProfileData/InstrProfTest.cpp 300 Instruction *Inst = Builder.CreateCondBr(Builder.getTrue(), TBB, FBB);
301 Instruction *Inst2 = Builder.CreateCondBr(Builder.getTrue(), TBB, FBB);
unittests/Transforms/Utils/CloningTest.cpp 70 BinaryOperator *Add = BinaryOperator::Create(Instruction::Add, V, V);
71 BinaryOperator *Sub = BinaryOperator::Create(Instruction::Sub, V, V);
72 BinaryOperator *Mul = BinaryOperator::Create(Instruction::Mul, V, V);
154 BinaryOperator *SDiv = BinaryOperator::Create(Instruction::SDiv, V, V);
224 Instruction *AddInst = cast<Instruction>(Builder2.CreateAdd(V, V));
224 Instruction *AddInst = cast<Instruction>(Builder2.CreateAdd(V, V));
225 Instruction *MulInst = cast<Instruction>(Builder2.CreateMul(AddInst, V));
225 Instruction *MulInst = cast<Instruction>(Builder2.CreateMul(AddInst, V));
226 Instruction *SubInst = cast<Instruction>(Builder2.CreateSub(MulInst, V));
226 Instruction *SubInst = cast<Instruction>(Builder2.CreateSub(MulInst, V));
240 auto AddSplit = dyn_cast<Instruction>(Mapping[AddInst]);
246 auto MulSplit = dyn_cast<Instruction>(Mapping[MulInst]);
273 Instruction *AddInst = cast<Instruction>(Builder2.CreateAdd(V, V));
273 Instruction *AddInst = cast<Instruction>(Builder2.CreateAdd(V, V));
274 Instruction *MulInst = cast<Instruction>(Builder2.CreateMul(AddInst, V));
274 Instruction *MulInst = cast<Instruction>(Builder2.CreateMul(AddInst, V));
275 Instruction *SubInst = cast<Instruction>(Builder2.CreateSub(MulInst, V));
275 Instruction *SubInst = cast<Instruction>(Builder2.CreateSub(MulInst, V));
290 auto AddSplit = dyn_cast<Instruction>(Mapping[AddInst]);
296 auto MulSplit = dyn_cast<Instruction>(Mapping[MulInst]);
302 auto SubSplit = dyn_cast<Instruction>(Mapping[SubInst]);
326 Instruction *AddInst = cast<Instruction>(Builder2.CreateAdd(V, V));
326 Instruction *AddInst = cast<Instruction>(Builder2.CreateAdd(V, V));
327 Instruction *MulInst = cast<Instruction>(Builder2.CreateMul(AddInst, V));
327 Instruction *MulInst = cast<Instruction>(Builder2.CreateMul(AddInst, V));
328 Instruction *SubInst = cast<Instruction>(Builder2.CreateSub(MulInst, V));
328 Instruction *SubInst = cast<Instruction>(Builder2.CreateSub(MulInst, V));
342 auto AddSplit = dyn_cast<Instruction>(Mapping[AddInst]);
348 auto MulSplit = dyn_cast<Instruction>(Mapping[MulInst]);
493 Instruction* Store = IBuilder.CreateStore(AllocaContent, Alloca);
574 Instruction& OldI = *OldIter;
575 Instruction& NewI = *NewIter;
611 Instruction& OldI = *OldIter;
612 Instruction& NewI = *NewIter;
unittests/Transforms/Utils/FunctionComparatorTest.cpp 23 Instruction *I;
36 I = cast<Instruction>(B.CreateAdd(LoadInst, C));
86 int testCmpOperations(const Instruction *L, const Instruction *R,
86 int testCmpOperations(const Instruction *L, const Instruction *R,
unittests/Transforms/Utils/IntegerDivisionTest.cpp 48 Instruction* Quotient = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
48 Instruction* Quotient = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
78 Instruction* Quotient = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
78 Instruction* Quotient = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
108 Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
108 Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
138 Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
138 Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
169 Instruction* Quotient = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
169 Instruction* Quotient = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
199 Instruction* Quotient = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
199 Instruction* Quotient = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
229 Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
229 Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
259 Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
259 Instruction* Remainder = dyn_cast<Instruction>(cast<User>(Ret)->getOperand(0));
unittests/Transforms/Utils/LocalTest.cpp 147 Instruction *Inst = &F->front().front();
160 for (const Instruction &I : F->front())
551 for (const Instruction &I : F->front()) {
568 Instruction *Inst = &F->front().front();
616 Instruction &A = BB.front();
623 Instruction &B = BB.front();
713 Instruction &A = BB.front();
714 Instruction &B = *A.getNextNonDebugInstruction();
715 Instruction &C = *B.getNextNonDebugInstruction();
716 Instruction &D = *C.getNextNonDebugInstruction();
717 Instruction &E = *D.getNextNonDebugInstruction();
718 Instruction &F_ = *E.getNextNonDebugInstruction();
719 Instruction &Barrier = *F_.getNextNonDebugInstruction();
720 Instruction &G = *Barrier.getNextNonDebugInstruction();
unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp 66 auto *I1 = cast<Instruction>(B.CreateAdd(AddOp1, ConstantInt::get(I32Ty, 5)));
66 auto *I1 = cast<Instruction>(B.CreateAdd(AddOp1, ConstantInt::get(I32Ty, 5)));
67 auto *I2 = cast<Instruction>(B.CreateAdd(AddOp2, ConstantInt::get(I32Ty, 6)));
67 auto *I2 = cast<Instruction>(B.CreateAdd(AddOp2, ConstantInt::get(I32Ty, 6)));
68 auto *I3 = cast<Instruction>(B.CreateAdd(SubOp1, SubOp2));
68 auto *I3 = cast<Instruction>(B.CreateAdd(SubOp1, SubOp2));
69 auto *I4 = cast<Instruction>(B.CreateSub(SubOp1, SubOp2));
69 auto *I4 = cast<Instruction>(B.CreateSub(SubOp1, SubOp2));
148 auto *I1 = cast<Instruction>(B.CreateAdd(AddOp1, ConstantInt::get(I32Ty, 3)));
148 auto *I1 = cast<Instruction>(B.CreateAdd(AddOp1, ConstantInt::get(I32Ty, 3)));
152 auto *I2 = cast<Instruction>(B.CreateAdd(AddOp2, ConstantInt::get(I32Ty, 4)));
152 auto *I2 = cast<Instruction>(B.CreateAdd(AddOp2, ConstantInt::get(I32Ty, 4)));
unittests/Transforms/Vectorize/VPlanHCFGTest.cpp 91 SmallPtrSet<Instruction *, 1> DeadInstructions;
121 SmallPtrSet<Instruction *, 1> DeadInstructions;
usr/include/c++/7.4.0/bits/move.h 72 constexpr _Tp&&
83 constexpr _Tp&&
usr/include/c++/7.4.0/bits/std_function.h 299 _M_invoke(const _Any_data& __functor, _ArgTypes&&... __args)
628 using _Invoker_type = _Res (*)(const _Any_data&, _ArgTypes&&...);
usr/include/c++/7.4.0/bits/stl_iterator_base_types.h 123 typedef _Tp value_type;
usr/include/c++/7.4.0/tuple 125 constexpr _Head_base(const _Head& __h)
132 constexpr _Head_base(_UHead&& __h)
159 static constexpr _Head&
162 static constexpr const _Head&
194 static constexpr _Head&
197 static constexpr const _Head&
210 constexpr _Tuple_impl(const _Head& __head, const _Tail&... __tail)
210 constexpr _Tuple_impl(const _Head& __head, const _Tail&... __tail)
216 constexpr _Tuple_impl(_UHead&& __head, _UTail&&... __tail)
216 constexpr _Tuple_impl(_UHead&& __head, _UTail&&... __tail)
242 _Tuple_impl(allocator_arg_t __tag, const _Alloc& __a)
248 const _Head& __head, const _Tail&... __tail)
248 const _Head& __head, const _Tail&... __tail)
350 static constexpr _Head&
353 static constexpr const _Head&
360 constexpr _Tuple_impl(const _Head& __head)
365 constexpr _Tuple_impl(_UHead&& __head)
390 const _Head& __head)
473 return __and_<is_constructible<_Elements, const _UElements&>...>::value;
479 return __and_<is_convertible<const _UElements&, _Elements>...>::value;
485 return __and_<is_constructible<_Elements, _UElements&&>...>::value;
491 return __and_<is_convertible<_UElements&&, _Elements>...>::value;
947 constexpr tuple(const _T1& __a1, const _T2& __a2)
947 constexpr tuple(const _T1& __a1, const _T2& __a2)
956 explicit constexpr tuple(const _T1& __a1, const _T2& __a2)
956 explicit constexpr tuple(const _T1& __a1, const _T2& __a2)
971 constexpr tuple(_U1&& __a1, _U2&& __a2)
971 constexpr tuple(_U1&& __a1, _U2&& __a2)
1066 tuple(allocator_arg_t __tag, const _Alloc& __a)
1078 const _T1& __a1, const _T2& __a2)
1078 const _T1& __a1, const _T2& __a2)
1090 const _T1& __a1, const _T2& __a2)
1090 const _T1& __a1, const _T2& __a2)
1302 constexpr _Head&
1307 constexpr const _Head&
1313 constexpr __tuple_element_t<__i, tuple<_Elements...>>&
1319 constexpr const __tuple_element_t<__i, tuple<_Elements...>>&
1325 constexpr __tuple_element_t<__i, tuple<_Elements...>>&&
usr/include/c++/7.4.0/type_traits 381 : public __is_pointer_helper<typename remove_cv<_Tp>::type>::type
1246 : public is_nothrow_constructible<_Tp, _Tp&&>
1554 { typedef _Tp type; };
1558 { typedef _Tp type; };
1563 { typedef _Tp type; };
1574 remove_const<typename remove_volatile<_Tp>::type>::type type;
1633 { typedef _Tp type; };
1659 { typedef _Tp&& type; };
1983 { typedef _Up type; };
2104 { typedef typename remove_cv<_Up>::type __type; };
utils/unittest/googletest/include/gtest/gtest-message.h 116 inline Message& operator <<(const T& val) {
utils/unittest/googletest/include/gtest/gtest-printers.h 223 void DefaultPrintNonContainerTo(const T& value, ::std::ostream* os) {
366 void UniversalPrint(const T& value, ::std::ostream* os);
373 const C& container, ::std::ostream* os) {
407 T* p, ::std::ostream* os) {
416 if (IsTrue(ImplicitlyConvertible<T*, const void*>::value)) {
439 const T& value, ::std::ostream* os) {
455 void PrintTo(const T& value, ::std::ostream* os) {
478 DefaultPrintTo(IsContainerTest<T>(0), is_pointer<T>(), value, os);
699 static void Print(const T& value, ::std::ostream* os) {
856 typedef T T1;
utils/unittest/googletest/include/gtest/gtest.h 1475 T* rhs) {
utils/unittest/googletest/include/gtest/internal/custom/raw-ostream.h 35 auto printable(const T &V) -> decltype(StreamSwitch<T>::printable(V)) {
35 auto printable(const T &V) -> decltype(StreamSwitch<T>::printable(V)) {
37 return StreamSwitch<T>::printable(V);
54 const T& V;
55 friend std::ostream &operator<<(std::ostream &S, const RawStreamProxy<T> &V) {
69 static const RawStreamProxy<T> printable(const T &V) { return {V}; }
69 static const RawStreamProxy<T> printable(const T &V) { return {V}; }
utils/unittest/googletest/include/gtest/internal/gtest-type-util.h 129 typedef T1 Head;
136 typedef Types2<T2, T3> Tail;
821 typedef internal::Types3<T1, T2, T3> type;
3320 typedef typename Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12,