Lines Matching refs:IVOperand
80 Value *foldIVUser(Instruction *UseInst, Instruction *IVOperand);
82 bool eliminateIdentitySCEV(Instruction *UseInst, Instruction *IVOperand);
89 bool eliminateIVUser(Instruction *UseInst, Instruction *IVOperand);
90 bool makeIVComparisonInvariant(ICmpInst *ICmp, Instruction *IVOperand);
91 void eliminateIVComparison(ICmpInst *ICmp, Instruction *IVOperand);
92 void simplifyIVRemainder(BinaryOperator *Rem, Instruction *IVOperand,
98 bool strengthenBinaryOp(BinaryOperator *BO, Instruction *IVOperand);
100 Instruction *IVOperand);
101 bool strengthenRightShift(BinaryOperator *BO, Instruction *IVOperand);
126 Value *SimplifyIndvar::foldIVUser(Instruction *UseInst, Instruction *IVOperand) { in foldIVUser() argument
138 if (IVOperand != UseInst->getOperand(OperIdx) || in foldIVUser()
144 if (!isa<BinaryOperator>(IVOperand) in foldIVUser()
145 || !isa<ConstantInt>(IVOperand->getOperand(1))) in foldIVUser()
148 IVSrc = IVOperand->getOperand(0); in foldIVUser()
178 LLVM_DEBUG(dbgs() << "INDVARS: Eliminated IV operand: " << *IVOperand in foldIVUser()
189 if (IVOperand->use_empty()) in foldIVUser()
190 DeadInsts.emplace_back(IVOperand); in foldIVUser()
195 Instruction *IVOperand) { in makeIVComparisonInvariant() argument
201 if (IVOperand != ICmp->getOperand(0)) { in makeIVComparisonInvariant()
203 assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand"); in makeIVComparisonInvariant()
228 Rewriter.expandCodeFor(InvariantLHS, IVOperand->getType(), PHTerm); in makeIVComparisonInvariant()
230 Rewriter.expandCodeFor(InvariantRHS, IVOperand->getType(), PHTerm); in makeIVComparisonInvariant()
241 Instruction *IVOperand) { in eliminateIVComparison() argument
245 if (IVOperand != ICmp->getOperand(0)) { in eliminateIVComparison()
247 assert(IVOperand == ICmp->getOperand(1) && "Can't find IVOperand"); in eliminateIVComparison()
269 } else if (makeIVComparisonInvariant(ICmp, IVOperand)) { in eliminateIVComparison()
354 Instruction *IVOperand, in simplifyIVRemainder() argument
361 bool UsedAsNumerator = IVOperand == NValue; in simplifyIVRemainder()
581 Instruction *IVOperand) { in eliminateIVUser() argument
583 eliminateIVComparison(ICmp, IVOperand); in eliminateIVUser()
589 simplifyIVRemainder(Bin, IVOperand, IsSRem); in eliminateIVUser()
609 if (eliminateIdentitySCEV(UseInst, IVOperand)) in eliminateIVUser()
662 Instruction *IVOperand = cast<Instruction>(UseInst->getOperand(0)); in replaceFloatIVWithIntegerIV() local
664 const SCEV *IV = SE->getSCEV(IVOperand); in replaceFloatIVWithIntegerIV()
683 if (IVOperand->getType() != CI->getType()) { in replaceFloatIVWithIntegerIV()
685 StringRef Name = IVOperand->getName(); in replaceFloatIVWithIntegerIV()
688 if (SE->getTypeSizeInBits(IVOperand->getType()) > in replaceFloatIVWithIntegerIV()
690 Conv = Builder.CreateTrunc(IVOperand, CI->getType(), Name + ".trunc"); in replaceFloatIVWithIntegerIV()
693 Conv = Builder.CreateZExt(IVOperand, CI->getType(), Name + ".zext"); in replaceFloatIVWithIntegerIV()
695 Conv = Builder.CreateSExt(IVOperand, CI->getType(), Name + ".sext"); in replaceFloatIVWithIntegerIV()
698 Conv = IVOperand; in replaceFloatIVWithIntegerIV()
715 Instruction *IVOperand) { in eliminateIdentitySCEV() argument
717 UseInst->getType() != IVOperand->getType()) in eliminateIdentitySCEV()
721 if (UseSCEV != SE->getSCEV(IVOperand)) in eliminateIdentitySCEV()
743 if (!DT || !DT->dominates(IVOperand, UseInst)) in eliminateIdentitySCEV()
746 if (!LI->replacementPreservesLCSSAForm(UseInst, IVOperand)) in eliminateIdentitySCEV()
750 if (!impliesPoison(IVOperand, UseInst)) { in eliminateIdentitySCEV()
752 if (!SE->canReuseInstruction(UseSCEV, IVOperand, DropPoisonGeneratingInsts)) in eliminateIdentitySCEV()
762 UseInst->replaceAllUsesWith(IVOperand); in eliminateIdentitySCEV()
770 Instruction *IVOperand) { in strengthenBinaryOp() argument
772 strengthenOverflowingOperation(BO, IVOperand)) || in strengthenBinaryOp()
773 (isa<ShlOperator>(BO) && strengthenRightShift(BO, IVOperand)); in strengthenBinaryOp()
779 Instruction *IVOperand) { in strengthenOverflowingOperation() argument
803 Instruction *IVOperand) { in strengthenRightShift() argument
806 ConstantRange IVRange = SE->getUnsignedRange(SE->getSCEV(IVOperand)); in strengthenRightShift()
810 m_AShr(m_Shl(m_Value(), m_Specific(IVOperand)), m_APInt(C))) || in strengthenRightShift()
812 m_LShr(m_Shl(m_Value(), m_Specific(IVOperand)), m_APInt(C)))) { in strengthenRightShift()
934 Instruction *IVOperand = UseOper.second; in simplifyUsers() local
935 for (unsigned N = 0; IVOperand; ++N) { in simplifyUsers()
939 Value *NewOper = foldIVUser(UseInst, IVOperand); in simplifyUsers()
942 IVOperand = dyn_cast<Instruction>(NewOper); in simplifyUsers()
944 if (!IVOperand) in simplifyUsers()
947 if (eliminateIVUser(UseInst, IVOperand)) { in simplifyUsers()
948 pushIVUsers(IVOperand, L, Simplified, SimpleIVUsers); in simplifyUsers()
953 if (strengthenBinaryOp(BO, IVOperand)) { in simplifyUsers()
956 pushIVUsers(IVOperand, L, Simplified, SimpleIVUsers); in simplifyUsers()
963 pushIVUsers(IVOperand, L, Simplified, SimpleIVUsers); in simplifyUsers()