Lines Matching defs:IVOperand

88     Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
90 bool eliminateIdentitySCEV(Instruction *UseInst, Instruction *IVOperand);
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);
129 /// IVOperand is guaranteed SCEVable, but UseInst may not be.
131 /// Return the operand of IVOperand for this induction variable if IVOperand can
134 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) {
146 if (IVOperand != UseInst->getOperand(OperIdx) ||
152 if (!isa<BinaryOperator>(IVOperand)
153 || !isa<ConstantInt>(IVOperand->getOperand(1)))
156 IVSrc = IVOperand->getOperand(0);
186 LLVM_DEBUG(dbgs() << "INDVARS: Eliminated IV operand: " << *IVOperand
197 if (IVOperand->use_empty())
198 DeadInsts.emplace_back(IVOperand);
203 Instruction *IVOperand) {
209 if (IVOperand != ICmp->getOperand(0)) {
211 assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand");
236 Rewriter.expandCodeFor(InvariantLHS, IVOperand->getType(), PHTerm);
238 Rewriter.expandCodeFor(InvariantRHS, IVOperand->getType(), PHTerm);
250 Instruction *IVOperand) {
254 if (IVOperand != ICmp->getOperand(0)) {
256 assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand");
278 } else if (makeIVComparisonInvariant(ICmp, IVOperand)) {
366 Instruction *IVOperand,
373 bool UsedAsNumerator = IVOperand == NValue;
592 /// side-effect given the range of IV values. IVOperand is guaranteed SCEVable,
595 Instruction *IVOperand) {
597 eliminateIVComparison(ICmp, IVOperand);
603 simplifyIVRemainder(Bin, IVOperand, IsSRem);
623 if (eliminateIdentitySCEV(UseInst, IVOperand))
687 Instruction *IVOperand = cast<Instruction>(UseInst->getOperand(0));
689 const SCEV *IV = SE->getSCEV(IVOperand);
708 if (IVOperand->getType() != CI->getType()) {
710 StringRef Name = IVOperand->getName();
713 if (SE->getTypeSizeInBits(IVOperand->getType()) >
715 Conv = Builder.CreateTrunc(IVOperand, CI->getType(), Name + ".trunc");
718 Conv = Builder.CreateZExt(IVOperand, CI->getType(), Name + ".zext");
720 Conv = Builder.CreateSExt(IVOperand, CI->getType(), Name + ".sext");
723 Conv = IVOperand;
740 Instruction *IVOperand) {
742 UseInst->getType() != IVOperand->getType())
746 if (UseSCEV != SE->getSCEV(IVOperand))
766 // If UseInst is not a PHI node then we know that IVOperand dominates
768 if (!DT || !DT->dominates(IVOperand, UseInst))
771 if (!LI->replacementPreservesLCSSAForm(UseInst, IVOperand))
775 if (!impliesPoison(IVOperand, UseInst)) {
777 if (!SE->canReuseInstruction(UseSCEV, IVOperand, DropPoisonGeneratingInsts))
787 UseInst->replaceAllUsesWith(IVOperand);
795 Instruction *IVOperand) {
797 strengthenOverflowingOperation(BO, IVOperand)) ||
798 (isa<ShlOperator>(BO) && strengthenRightShift(BO, IVOperand));
804 Instruction *IVOperand) {
824 /// Annotate the Shr in (X << IVOperand) >> C as exact using the
828 Instruction *IVOperand) {
831 ConstantRange IVRange = SE->getUnsignedRange(SE->getSCEV(IVOperand));
835 m_AShr(m_Shl(m_Value(), m_Specific(IVOperand)), m_APInt(C))) ||
837 m_LShr(m_Shl(m_Value(), m_Specific(IVOperand)), m_APInt(C)))) {
957 Instruction *IVOperand = UseOper.second;
958 for (unsigned N = 0; IVOperand; ++N) {
962 Value *NewOper = foldIVUser(UseInst, IVOperand);
965 IVOperand = dyn_cast<Instruction>(NewOper);
967 if (!IVOperand)
970 if (eliminateIVUser(UseInst, IVOperand)) {
971 pushIVUsers(IVOperand, Simplified, SimpleIVUsers);
976 if (strengthenBinaryOp(BO, IVOperand)) {
979 pushIVUsers(IVOperand, Simplified, SimpleIVUsers);
985 // Re-queue the potentially new direct uses of IVOperand.
986 pushIVUsers(IVOperand, Simplified, SimpleIVUsers);