Lines Matching refs: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);
134 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) { in foldIVUser() argument
146 if (IVOperand != UseInst->getOperand(OperIdx) || in foldIVUser()
152 if (!isa<BinaryOperator>(IVOperand) in foldIVUser()
153 || !isa<ConstantInt>(IVOperand->getOperand(1))) in foldIVUser()
156 IVSrc = IVOperand->getOperand(0); in foldIVUser()
186 LLVM_DEBUG(dbgs() << "INDVARS: Eliminated IV operand: " << *IVOperand in foldIVUser()
197 if (IVOperand->use_empty()) in foldIVUser()
198 DeadInsts.emplace_back(IVOperand); in foldIVUser()
203 Instruction *IVOperand) { in makeIVComparisonInvariant() argument
209 if (IVOperand != ICmp->getOperand(0)) { in makeIVComparisonInvariant()
211 assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand"); in makeIVComparisonInvariant()
236 Rewriter.expandCodeFor(InvariantLHS, IVOperand->getType(), PHTerm); in makeIVComparisonInvariant()
238 Rewriter.expandCodeFor(InvariantRHS, IVOperand->getType(), PHTerm); in makeIVComparisonInvariant()
250 Instruction *IVOperand) { in eliminateIVComparison() argument
254 if (IVOperand != ICmp->getOperand(0)) { in eliminateIVComparison()
256 assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand"); in eliminateIVComparison()
278 } else if (makeIVComparisonInvariant(ICmp, IVOperand)) { in eliminateIVComparison()
366 Instruction *IVOperand, in simplifyIVRemainder() argument
373 bool UsedAsNumerator = IVOperand == NValue; in simplifyIVRemainder()
595 Instruction *IVOperand) { in eliminateIVUser() argument
597 eliminateIVComparison(ICmp, IVOperand); in eliminateIVUser()
603 simplifyIVRemainder(Bin, IVOperand, IsSRem); in eliminateIVUser()
623 if (eliminateIdentitySCEV(UseInst, IVOperand)) in eliminateIVUser()
687 Instruction *IVOperand = cast<Instruction>(UseInst->getOperand(0)); in replaceFloatIVWithIntegerIV() local
689 const SCEV *IV = SE->getSCEV(IVOperand); in replaceFloatIVWithIntegerIV()
708 if (IVOperand->getType() != CI->getType()) { in replaceFloatIVWithIntegerIV()
710 StringRef Name = IVOperand->getName(); in replaceFloatIVWithIntegerIV()
713 if (SE->getTypeSizeInBits(IVOperand->getType()) > in replaceFloatIVWithIntegerIV()
715 Conv = Builder.CreateTrunc(IVOperand, CI->getType(), Name + ".trunc"); in replaceFloatIVWithIntegerIV()
718 Conv = Builder.CreateZExt(IVOperand, CI->getType(), Name + ".zext"); in replaceFloatIVWithIntegerIV()
720 Conv = Builder.CreateSExt(IVOperand, CI->getType(), Name + ".sext"); in replaceFloatIVWithIntegerIV()
723 Conv = IVOperand; in replaceFloatIVWithIntegerIV()
740 Instruction *IVOperand) { in eliminateIdentitySCEV() argument
742 UseInst->getType() != IVOperand->getType()) in eliminateIdentitySCEV()
746 if (UseSCEV != SE->getSCEV(IVOperand)) in eliminateIdentitySCEV()
768 if (!DT || !DT->dominates(IVOperand, UseInst)) in eliminateIdentitySCEV()
771 if (!LI->replacementPreservesLCSSAForm(UseInst, IVOperand)) in eliminateIdentitySCEV()
775 if (!impliesPoison(IVOperand, UseInst)) { in eliminateIdentitySCEV()
777 if (!SE->canReuseInstruction(UseSCEV, IVOperand, DropPoisonGeneratingInsts)) in eliminateIdentitySCEV()
787 UseInst->replaceAllUsesWith(IVOperand); in eliminateIdentitySCEV()
795 Instruction *IVOperand) { in strengthenBinaryOp() argument
797 strengthenOverflowingOperation(BO, IVOperand)) || in strengthenBinaryOp()
798 (isa<ShlOperator>(BO) && strengthenRightShift(BO, IVOperand)); in strengthenBinaryOp()
804 Instruction *IVOperand) { in strengthenOverflowingOperation() argument
828 Instruction *IVOperand) { in strengthenRightShift() argument
831 ConstantRange IVRange = SE->getUnsignedRange(SE->getSCEV(IVOperand)); in strengthenRightShift()
835 m_AShr(m_Shl(m_Value(), m_Specific(IVOperand)), m_APInt(C))) || in strengthenRightShift()
837 m_LShr(m_Shl(m_Value(), m_Specific(IVOperand)), m_APInt(C)))) { in strengthenRightShift()
957 Instruction *IVOperand = UseOper.second; in simplifyUsers() local
958 for (unsigned N = 0; IVOperand; ++N) { in simplifyUsers()
962 Value *NewOper = foldIVUser(UseInst, IVOperand); in simplifyUsers()
965 IVOperand = dyn_cast<Instruction>(NewOper); in simplifyUsers()
967 if (!IVOperand) in simplifyUsers()
970 if (eliminateIVUser(UseInst, IVOperand)) { in simplifyUsers()
971 pushIVUsers(IVOperand, Simplified, SimpleIVUsers); in simplifyUsers()
976 if (strengthenBinaryOp(BO, IVOperand)) { in simplifyUsers()
979 pushIVUsers(IVOperand, Simplified, SimpleIVUsers); in simplifyUsers()
986 pushIVUsers(IVOperand, Simplified, SimpleIVUsers); in simplifyUsers()