Lines Matching refs:Instr

722 static bool narrowSDivOrSRem(BinaryOperator *Instr, LazyValueInfo *LVI) {  in narrowSDivOrSRem()  argument
723 assert(Instr->getOpcode() == Instruction::SDiv || in narrowSDivOrSRem()
724 Instr->getOpcode() == Instruction::SRem); in narrowSDivOrSRem()
725 if (Instr->getType()->isVectorTy()) in narrowSDivOrSRem()
730 unsigned OrigWidth = Instr->getType()->getIntegerBitWidth(); in narrowSDivOrSRem()
736 for (auto I : zip(Instr->operands(), CRs)) { in narrowSDivOrSRem()
737 std::get<1>(I) = LVI->getConstantRange(std::get<0>(I), Instr); in narrowSDivOrSRem()
756 IRBuilder<> B{Instr}; in narrowSDivOrSRem()
757 auto *TruncTy = Type::getIntNTy(Instr->getContext(), NewWidth); in narrowSDivOrSRem()
758 auto *LHS = B.CreateTruncOrBitCast(Instr->getOperand(0), TruncTy, in narrowSDivOrSRem()
759 Instr->getName() + ".lhs.trunc"); in narrowSDivOrSRem()
760 auto *RHS = B.CreateTruncOrBitCast(Instr->getOperand(1), TruncTy, in narrowSDivOrSRem()
761 Instr->getName() + ".rhs.trunc"); in narrowSDivOrSRem()
762 auto *BO = B.CreateBinOp(Instr->getOpcode(), LHS, RHS, Instr->getName()); in narrowSDivOrSRem()
763 auto *Sext = B.CreateSExt(BO, Instr->getType(), Instr->getName() + ".sext"); in narrowSDivOrSRem()
766 BinOp->setIsExact(Instr->isExact()); in narrowSDivOrSRem()
768 Instr->replaceAllUsesWith(Sext); in narrowSDivOrSRem()
769 Instr->eraseFromParent(); in narrowSDivOrSRem()
775 static bool processUDivOrURem(BinaryOperator *Instr, LazyValueInfo *LVI) { in processUDivOrURem() argument
776 assert(Instr->getOpcode() == Instruction::UDiv || in processUDivOrURem()
777 Instr->getOpcode() == Instruction::URem); in processUDivOrURem()
778 if (Instr->getType()->isVectorTy()) in processUDivOrURem()
787 for (Value *Operand : Instr->operands()) { in processUDivOrURem()
788 ConstantRange CR = LVI->getConstantRange(Operand, Instr); in processUDivOrURem()
796 if (NewWidth >= Instr->getType()->getIntegerBitWidth()) in processUDivOrURem()
800 IRBuilder<> B{Instr}; in processUDivOrURem()
801 auto *TruncTy = Type::getIntNTy(Instr->getContext(), NewWidth); in processUDivOrURem()
802 auto *LHS = B.CreateTruncOrBitCast(Instr->getOperand(0), TruncTy, in processUDivOrURem()
803 Instr->getName() + ".lhs.trunc"); in processUDivOrURem()
804 auto *RHS = B.CreateTruncOrBitCast(Instr->getOperand(1), TruncTy, in processUDivOrURem()
805 Instr->getName() + ".rhs.trunc"); in processUDivOrURem()
806 auto *BO = B.CreateBinOp(Instr->getOpcode(), LHS, RHS, Instr->getName()); in processUDivOrURem()
807 auto *Zext = B.CreateZExt(BO, Instr->getType(), Instr->getName() + ".zext"); in processUDivOrURem()
810 BinOp->setIsExact(Instr->isExact()); in processUDivOrURem()
812 Instr->replaceAllUsesWith(Zext); in processUDivOrURem()
813 Instr->eraseFromParent(); in processUDivOrURem()
925 static bool processSDivOrSRem(BinaryOperator *Instr, LazyValueInfo *LVI) { in processSDivOrSRem() argument
926 assert(Instr->getOpcode() == Instruction::SDiv || in processSDivOrSRem()
927 Instr->getOpcode() == Instruction::SRem); in processSDivOrSRem()
928 if (Instr->getType()->isVectorTy()) in processSDivOrSRem()
931 if (Instr->getOpcode() == Instruction::SDiv) in processSDivOrSRem()
932 if (processSDiv(Instr, LVI)) in processSDivOrSRem()
935 if (Instr->getOpcode() == Instruction::SRem) in processSDivOrSRem()
936 if (processSRem(Instr, LVI)) in processSDivOrSRem()
939 return narrowSDivOrSRem(Instr, LVI); in processSDivOrSRem()