Lines Matching refs:DU

768   Instruction *CloneIVUser(NarrowIVDefUse DU);
772 const SCEVAddRecExpr* GetExtendedOperandRecurrence(NarrowIVDefUse DU);
777 Instruction *WidenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter);
779 bool WidenLoopCompare(NarrowIVDefUse DU);
813 Instruction *WidenIV::CloneIVUser(NarrowIVDefUse DU) { in CloneIVUser() argument
814 unsigned Opcode = DU.NarrowUse->getOpcode(); in CloneIVUser()
828 DEBUG(dbgs() << "Cloning IVUser: " << *DU.NarrowUse << "\n"); in CloneIVUser()
835 Value *LHS = (DU.NarrowUse->getOperand(0) == DU.NarrowDef) ? DU.WideDef : in CloneIVUser()
836 getExtend(DU.NarrowUse->getOperand(0), WideType, IsSigned, DU.NarrowUse); in CloneIVUser()
837 Value *RHS = (DU.NarrowUse->getOperand(1) == DU.NarrowDef) ? DU.WideDef : in CloneIVUser()
838 getExtend(DU.NarrowUse->getOperand(1), WideType, IsSigned, DU.NarrowUse); in CloneIVUser()
840 BinaryOperator *NarrowBO = cast<BinaryOperator>(DU.NarrowUse); in CloneIVUser()
844 IRBuilder<> Builder(DU.NarrowUse); in CloneIVUser()
871 const SCEVAddRecExpr* WidenIV::GetExtendedOperandRecurrence(NarrowIVDefUse DU) { in GetExtendedOperandRecurrence() argument
874 const unsigned OpCode = DU.NarrowUse->getOpcode(); in GetExtendedOperandRecurrence()
883 DU.NarrowUse->getOperand(0) == DU.NarrowDef ? 1 : 0; in GetExtendedOperandRecurrence()
884 assert(DU.NarrowUse->getOperand(1-ExtendOperIdx) == DU.NarrowDef && "bad DU"); in GetExtendedOperandRecurrence()
888 cast<OverflowingBinaryOperator>(DU.NarrowUse); in GetExtendedOperandRecurrence()
891 SE->getSCEV(DU.NarrowUse->getOperand(ExtendOperIdx)), WideType); in GetExtendedOperandRecurrence()
894 SE->getSCEV(DU.NarrowUse->getOperand(ExtendOperIdx)), WideType); in GetExtendedOperandRecurrence()
903 const SCEV *lhs = SE->getSCEV(DU.WideDef); in GetExtendedOperandRecurrence()
946 static void truncateIVUse(NarrowIVDefUse DU, DominatorTree *DT) { in truncateIVUse() argument
947 DEBUG(dbgs() << "INDVARS: Truncate IV " << *DU.WideDef in truncateIVUse()
948 << " for user " << *DU.NarrowUse << "\n"); in truncateIVUse()
949 IRBuilder<> Builder(getInsertPointForUses(DU.NarrowUse, DU.NarrowDef, DT)); in truncateIVUse()
950 Value *Trunc = Builder.CreateTrunc(DU.WideDef, DU.NarrowDef->getType()); in truncateIVUse()
951 DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, Trunc); in truncateIVUse()
957 bool WidenIV::WidenLoopCompare(NarrowIVDefUse DU) { in WidenLoopCompare() argument
958 ICmpInst *Cmp = dyn_cast<ICmpInst>(DU.NarrowUse); in WidenLoopCompare()
966 Value *Op = Cmp->getOperand(Cmp->getOperand(0) == DU.NarrowDef ? 1 : 0); in WidenLoopCompare()
972 IRBuilder<> Builder(getInsertPointForUses(DU.NarrowUse, DU.NarrowDef, DT)); in WidenLoopCompare()
973 DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, DU.WideDef); in WidenLoopCompare()
978 DU.NarrowUse->replaceUsesOfWith(Op, ExtOp); in WidenLoopCompare()
985 Instruction *WidenIV::WidenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter) { in WidenIVUse() argument
988 if (PHINode *UsePhi = dyn_cast<PHINode>(DU.NarrowUse)) { in WidenIVUse()
994 truncateIVUse(DU, DT); in WidenIVUse()
997 PHINode::Create(DU.WideDef->getType(), 1, UsePhi->getName() + ".wide", in WidenIVUse()
999 WidePhi->addIncoming(DU.WideDef, UsePhi->getIncomingBlock(0)); in WidenIVUse()
1001 Value *Trunc = Builder.CreateTrunc(WidePhi, DU.NarrowDef->getType()); in WidenIVUse()
1011 if (IsSigned ? isa<SExtInst>(DU.NarrowUse) : isa<ZExtInst>(DU.NarrowUse)) { in WidenIVUse()
1012 Value *NewDef = DU.WideDef; in WidenIVUse()
1013 if (DU.NarrowUse->getType() != WideType) { in WidenIVUse()
1014 unsigned CastWidth = SE->getTypeSizeInBits(DU.NarrowUse->getType()); in WidenIVUse()
1018 IRBuilder<> Builder(DU.NarrowUse); in WidenIVUse()
1019 NewDef = Builder.CreateTrunc(DU.WideDef, DU.NarrowUse->getType()); in WidenIVUse()
1026 << " not wide enough to subsume " << *DU.NarrowUse << "\n"); in WidenIVUse()
1027 DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, DU.WideDef); in WidenIVUse()
1028 NewDef = DU.NarrowUse; in WidenIVUse()
1031 if (NewDef != DU.NarrowUse) { in WidenIVUse()
1032 DEBUG(dbgs() << "INDVARS: eliminating " << *DU.NarrowUse in WidenIVUse()
1033 << " replaced by " << *DU.WideDef << "\n"); in WidenIVUse()
1035 DU.NarrowUse->replaceAllUsesWith(NewDef); in WidenIVUse()
1036 DeadInsts.push_back(DU.NarrowUse); in WidenIVUse()
1049 const SCEVAddRecExpr *WideAddRec = GetWideRecurrence(DU.NarrowUse); in WidenIVUse()
1051 WideAddRec = GetExtendedOperandRecurrence(DU); in WidenIVUse()
1056 if (WidenLoopCompare(DU)) in WidenIVUse()
1062 truncateIVUse(DU, DT); in WidenIVUse()
1067 assert(DU.NarrowUse != DU.NarrowUse->getParent()->getTerminator() && in WidenIVUse()
1074 && Rewriter.hoistIVInc(WideInc, DU.NarrowUse)) in WidenIVUse()
1077 WideUse = CloneIVUser(DU); in WidenIVUse()
1174 NarrowIVDefUse DU = NarrowIVUsers.pop_back_val(); in CreateWideIV() local
1178 Instruction *WideUse = WidenIVUse(DU, Rewriter); in CreateWideIV()
1182 pushNarrowIVUsers(DU.NarrowUse, WideUse); in CreateWideIV()
1185 if (DU.NarrowDef->use_empty()) in CreateWideIV()
1186 DeadInsts.push_back(DU.NarrowDef); in CreateWideIV()