Lines Matching refs:Instruction

83     void pushIVUsers(Instruction *Def,
84 SmallPtrSet<Instruction *, 16> &Simplified,
85 SmallVectorImpl<std::pair<Instruction *, Instruction *>>
88 Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
90 bool eliminateIdentitySCEV(Instruction *UseInst, Instruction *IVOperand);
91 bool replaceIVUserWithLoopInvariant(Instruction *UseInst);
92 bool replaceFloatIVWithIntegerIV(Instruction *UseInst);
97 bool eliminateIVUser(Instruction *UseInst, Instruction *IVOperand);
98 bool makeIVComparisonInvariant(ICmpInst *ICmp, Instruction *IVOperand);
99 void eliminateIVComparison(ICmpInst *ICmp, Instruction *IVOperand);
100 void simplifyIVRemainder(BinaryOperator *Rem, Instruction *IVOperand,
106 bool strengthenBinaryOp(BinaryOperator *BO, Instruction *IVOperand);
108 Instruction *IVOperand);
109 bool strengthenRightShift(BinaryOperator *BO, Instruction *IVOperand);
116 static Instruction *findCommonDominator(ArrayRef<Instruction *> Instructions, in findCommonDominator()
118 Instruction *CommonDom = nullptr; in findCommonDominator()
134 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) { in foldIVUser()
142 case Instruction::UDiv: in foldIVUser()
143 case Instruction::LShr: in foldIVUser()
161 if (UseInst->getOpcode() == Instruction::LShr) { in foldIVUser()
203 Instruction *IVOperand) { in makeIVComparisonInvariant()
250 Instruction *IVOperand) { in eliminateIVComparison()
269 SmallVector<Instruction *, 4> Users; in eliminateIVComparison()
271 Users.push_back(cast<Instruction>(U)); in eliminateIVComparison()
272 const Instruction *CtxI = findCommonDominator(Users, *DT); in eliminateIVComparison()
366 Instruction *IVOperand, in simplifyIVRemainder()
518 if (isa<Instruction>(U) && in eliminateTrunc()
519 !DT->isReachableFromEntry(cast<Instruction>(U)->getParent())) in eliminateTrunc()
594 bool SimplifyIndvar::eliminateIVUser(Instruction *UseInst, in eliminateIVUser()
595 Instruction *IVOperand) { in eliminateIVUser()
601 bool IsSRem = Bin->getOpcode() == Instruction::SRem; in eliminateIVUser()
602 if (IsSRem || Bin->getOpcode() == Instruction::URem) { in eliminateIVUser()
607 if (Bin->getOpcode() == Instruction::SDiv) in eliminateIVUser()
629 static Instruction *GetLoopInvariantInsertPosition(Loop *L, Instruction *Hint) { in GetLoopInvariantInsertPosition()
637 bool SimplifyIndvar::replaceIVUserWithLoopInvariant(Instruction *I) { in replaceIVUserWithLoopInvariant()
669 SmallVector<Instruction *, 1> NeedsLCSSAPhis; in replaceIVUserWithLoopInvariant()
670 NeedsLCSSAPhis.push_back(cast<Instruction>(Invariant)); in replaceIVUserWithLoopInvariant()
682 bool SimplifyIndvar::replaceFloatIVWithIntegerIV(Instruction *UseInst) { in replaceFloatIVWithIntegerIV()
687 Instruction *IVOperand = cast<Instruction>(UseInst->getOperand(0)); in replaceFloatIVWithIntegerIV()
739 bool SimplifyIndvar::eliminateIdentitySCEV(Instruction *UseInst, in eliminateIdentitySCEV()
740 Instruction *IVOperand) { in eliminateIdentitySCEV()
776 SmallVector<Instruction *> DropPoisonGeneratingInsts; in eliminateIdentitySCEV()
780 for (Instruction *I : DropPoisonGeneratingInsts) in eliminateIdentitySCEV()
795 Instruction *IVOperand) { in strengthenBinaryOp()
804 Instruction *IVOperand) { in strengthenOverflowingOperation()
828 Instruction *IVOperand) { in strengthenRightShift()
829 if (BO->getOpcode() == Instruction::Shl) { in strengthenRightShift()
853 Instruction *Def, SmallPtrSet<Instruction *, 16> &Simplified, in pushIVUsers() argument
854 SmallVectorImpl<std::pair<Instruction *, Instruction *>> &SimpleIVUsers) { in pushIVUsers() argument
856 Instruction *UI = cast<Instruction>(U); in pushIVUsers()
884 static bool isSimpleIVUser(Instruction *I, const Loop *L, ScalarEvolution *SE) { in isSimpleIVUser()
916 SmallPtrSet<Instruction*,16> Simplified; in simplifyUsers()
919 SmallVector<std::pair<Instruction*, Instruction*>, 8> SimpleIVUsers; in simplifyUsers()
927 std::pair<Instruction*, Instruction*> UseOper = in simplifyUsers()
929 Instruction *UseInst = UseOper.first; in simplifyUsers()
952 Instruction *User = cast<Instruction>(U.getUser()); in simplifyUsers()
957 Instruction *IVOperand = UseOper.second; in simplifyUsers()
965 IVOperand = dyn_cast<Instruction>(NewOper); in simplifyUsers()
1070 Instruction *WideInc = nullptr;
1074 SmallPtrSet<Instruction *,16> Widened;
1082 DenseMap<AssertingVH<Instruction>, ExtendKind> ExtendKindMap;
1084 using DefUserPair = std::pair<AssertingVH<Value>, AssertingVH<Instruction>>;
1093 Instruction *UseI) { in getPostIncRangeInfo()
1102 void calculatePostIncRange(Instruction *NarrowDef, Instruction *NarrowUser);
1104 void updatePostIncRangeInfo(Value *Def, Instruction *UseI, ConstantRange R) { in updatePostIncRangeInfo()
1118 Instruction *NarrowDef = nullptr;
1119 Instruction *NarrowUse = nullptr;
1120 Instruction *WideDef = nullptr;
1127 NarrowIVDefUse(Instruction *ND, Instruction *NU, Instruction *WD, in NarrowIVDefUse()
1144 Instruction *Use);
1146 Instruction *cloneIVUser(NarrowIVDefUse DU, const SCEVAddRecExpr *WideAR);
1147 Instruction *cloneArithmeticIVUser(NarrowIVDefUse DU,
1149 Instruction *cloneBitwiseIVUser(NarrowIVDefUse DU);
1151 ExtendKind getExtendKind(Instruction *I);
1162 Instruction *widenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter,
1169 void pushNarrowIVUsers(Instruction *NarrowDef, Instruction *WideDef);
1182 static Instruction *getInsertPointForUses(Instruction *User, Value *Def, in getInsertPointForUses()
1188 Instruction *InsertPt = nullptr; in getInsertPointForUses()
1211 auto *DefI = dyn_cast<Instruction>(Def); in getInsertPointForUses()
1239 bool IsSigned, Instruction *Use) { in createExtendInst()
1255 Instruction *WidenIV::cloneIVUser(WidenIV::NarrowIVDefUse DU, in cloneIVUser()
1261 case Instruction::Add: in cloneIVUser()
1262 case Instruction::Mul: in cloneIVUser()
1263 case Instruction::UDiv: in cloneIVUser()
1264 case Instruction::Sub: in cloneIVUser()
1267 case Instruction::And: in cloneIVUser()
1268 case Instruction::Or: in cloneIVUser()
1269 case Instruction::Xor: in cloneIVUser()
1270 case Instruction::Shl: in cloneIVUser()
1271 case Instruction::LShr: in cloneIVUser()
1272 case Instruction::AShr: in cloneIVUser()
1277 Instruction *WidenIV::cloneBitwiseIVUser(WidenIV::NarrowIVDefUse DU) { in cloneBitwiseIVUser()
1278 Instruction *NarrowUse = DU.NarrowUse; in cloneBitwiseIVUser()
1279 Instruction *NarrowDef = DU.NarrowDef; in cloneBitwiseIVUser()
1280 Instruction *WideDef = DU.WideDef; in cloneBitwiseIVUser()
1307 Instruction *WidenIV::cloneArithmeticIVUser(WidenIV::NarrowIVDefUse DU, in cloneArithmeticIVUser()
1309 Instruction *NarrowUse = DU.NarrowUse; in cloneArithmeticIVUser()
1310 Instruction *NarrowDef = DU.NarrowDef; in cloneArithmeticIVUser()
1311 Instruction *WideDef = DU.WideDef; in cloneArithmeticIVUser()
1379 WidenIV::ExtendKind WidenIV::getExtendKind(Instruction *I) { in getExtendKind()
1388 case Instruction::Add: in getSCEVByOpCode()
1390 case Instruction::Sub: in getSCEVByOpCode()
1392 case Instruction::Mul: in getSCEVByOpCode()
1394 case Instruction::UDiv: in getSCEVByOpCode()
1412 explicit BinaryOp(Instruction *Op) in BinaryOp()
1421 explicit BinaryOp(Instruction::BinaryOps Opcode, Value *LHS, Value *RHS, in BinaryOp()
1428 static std::optional<BinaryOp> matchBinaryOp(Instruction *Op) { in matchBinaryOp()
1430 case Instruction::Add: in matchBinaryOp()
1431 case Instruction::Sub: in matchBinaryOp()
1432 case Instruction::Mul: in matchBinaryOp()
1434 case Instruction::Or: { in matchBinaryOp()
1437 return BinaryOp(Instruction::Add, Op->getOperand(0), Op->getOperand(1), in matchBinaryOp()
1441 case Instruction::Shl: { in matchBinaryOp()
1461 return BinaryOp(Instruction::Mul, Op->getOperand(0), X, IsNSW, IsNUW); in matchBinaryOp()
1483 assert((Op->Opcode == Instruction::Add || Op->Opcode == Instruction::Sub || in getExtendedOperandRecurrence()
1484 Op->Opcode == Instruction::Mul) && in getExtendedOperandRecurrence()
1659 Instruction *NarrowUse = DU.NarrowUse; in widenWithVariantUse()
1660 Instruction *NarrowDef = DU.NarrowDef; in widenWithVariantUse()
1661 Instruction *WideDef = DU.WideDef; in widenWithVariantUse()
1666 if (OpCode != Instruction::Add && OpCode != Instruction::Sub && in widenWithVariantUse()
1667 OpCode != Instruction::Mul) in widenWithVariantUse()
1688 SmallVector<Instruction *, 4> ExtUsers; in widenWithVariantUse()
1692 Instruction *User = cast<Instruction>(U.getUser()); in widenWithVariantUse()
1733 const Instruction *CtxI = findCommonDominator(ExtUsers, *DT); in widenWithVariantUse()
1738 if (OpCode != Instruction::Add) in widenWithVariantUse()
1786 for (Instruction *User : ExtUsers) { in widenWithVariantUse()
1835 Instruction *WidenIV::widenIVUse(WidenIV::NarrowIVDefUse DU, in widenIVUse()
1921 auto tryAddRecExpansion = [&]() -> Instruction* { in widenIVUse()
1947 Instruction *WideUse = nullptr; in widenIVUse()
2001 void WidenIV::pushNarrowIVUsers(Instruction *NarrowDef, Instruction *WideDef) { in pushNarrowIVUsers()
2007 Instruction *NarrowUser = cast<Instruction>(U); in pushNarrowIVUsers()
2077 Instruction *InsertPt = &*L->getHeader()->getFirstInsertionPt(); in createWideIV()
2086 Rewriter.isInsertedInstruction(cast<Instruction>(ExpandInst))) in createWideIV()
2097 dyn_cast<Instruction>(WidePhi->getIncomingValueForBlock(LatchBlock)); in createWideIV()
2103 cast<Instruction>(OrigPhi->getIncomingValueForBlock(LatchBlock)); in createWideIV()
2141 Instruction *WideUse = widenIVUse(DU, Rewriter, OrigPhi, WidePhi); in createWideIV()
2160 void WidenIV::calculatePostIncRange(Instruction *NarrowDef, in calculatePostIncRange()
2161 Instruction *NarrowUser) { in calculatePostIncRange()
2189 auto UpdateRangeFromGuards = [&](Instruction *Ctx) { in calculatePostIncRange()
2193 for (Instruction &I : make_range(Ctx->getIterator().getReverse(), in calculatePostIncRange()
2238 SmallPtrSet<Instruction *, 16> Visited; in calculatePostIncRanges()
2239 SmallVector<Instruction *, 6> Worklist; in calculatePostIncRanges()
2244 Instruction *NarrowDef = Worklist.pop_back_val(); in calculatePostIncRanges()
2247 auto *NarrowUser = cast<Instruction>(U.getUser()); in calculatePostIncRanges()