Lines Matching refs:DU
916 Instruction *cloneIVUser(NarrowIVDefUse DU, const SCEVAddRecExpr *WideAR);
917 Instruction *cloneArithmeticIVUser(NarrowIVDefUse DU,
919 Instruction *cloneBitwiseIVUser(NarrowIVDefUse DU);
923 const SCEVAddRecExpr* getExtendedOperandRecurrence(NarrowIVDefUse DU);
928 Instruction *widenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter);
930 bool widenLoopCompare(NarrowIVDefUse DU);
964 Instruction *WidenIV::cloneIVUser(NarrowIVDefUse DU, in cloneIVUser() argument
966 unsigned Opcode = DU.NarrowUse->getOpcode(); in cloneIVUser()
974 return cloneArithmeticIVUser(DU, WideAR); in cloneIVUser()
982 return cloneBitwiseIVUser(DU); in cloneIVUser()
986 Instruction *WidenIV::cloneBitwiseIVUser(NarrowIVDefUse DU) { in cloneBitwiseIVUser() argument
987 Instruction *NarrowUse = DU.NarrowUse; in cloneBitwiseIVUser()
988 Instruction *NarrowDef = DU.NarrowDef; in cloneBitwiseIVUser()
989 Instruction *WideDef = DU.WideDef; in cloneBitwiseIVUser()
1015 Instruction *WidenIV::cloneArithmeticIVUser(NarrowIVDefUse DU, in cloneArithmeticIVUser() argument
1017 Instruction *NarrowUse = DU.NarrowUse; in cloneArithmeticIVUser()
1018 Instruction *NarrowDef = DU.NarrowDef; in cloneArithmeticIVUser()
1019 Instruction *WideDef = DU.WideDef; in cloneArithmeticIVUser()
1123 const SCEVAddRecExpr* WidenIV::getExtendedOperandRecurrence(NarrowIVDefUse DU) { in getExtendedOperandRecurrence() argument
1126 const unsigned OpCode = DU.NarrowUse->getOpcode(); in getExtendedOperandRecurrence()
1135 DU.NarrowUse->getOperand(0) == DU.NarrowDef ? 1 : 0; in getExtendedOperandRecurrence()
1136 assert(DU.NarrowUse->getOperand(1-ExtendOperIdx) == DU.NarrowDef && "bad DU"); in getExtendedOperandRecurrence()
1140 cast<OverflowingBinaryOperator>(DU.NarrowUse); in getExtendedOperandRecurrence()
1143 SE->getSCEV(DU.NarrowUse->getOperand(ExtendOperIdx)), WideType); in getExtendedOperandRecurrence()
1146 SE->getSCEV(DU.NarrowUse->getOperand(ExtendOperIdx)), WideType); in getExtendedOperandRecurrence()
1155 const SCEV *lhs = SE->getSCEV(DU.WideDef); in getExtendedOperandRecurrence()
1197 static void truncateIVUse(NarrowIVDefUse DU, DominatorTree *DT, LoopInfo *LI) { in truncateIVUse() argument
1198 DEBUG(dbgs() << "INDVARS: Truncate IV " << *DU.WideDef in truncateIVUse()
1199 << " for user " << *DU.NarrowUse << "\n"); in truncateIVUse()
1201 getInsertPointForUses(DU.NarrowUse, DU.NarrowDef, DT, LI)); in truncateIVUse()
1202 Value *Trunc = Builder.CreateTrunc(DU.WideDef, DU.NarrowDef->getType()); in truncateIVUse()
1203 DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, Trunc); in truncateIVUse()
1209 bool WidenIV::widenLoopCompare(NarrowIVDefUse DU) { in widenLoopCompare() argument
1210 ICmpInst *Cmp = dyn_cast<ICmpInst>(DU.NarrowUse); in widenLoopCompare()
1229 if (!(DU.NeverNegative || IsSigned == Cmp->isSigned())) in widenLoopCompare()
1232 Value *Op = Cmp->getOperand(Cmp->getOperand(0) == DU.NarrowDef ? 1 : 0); in widenLoopCompare()
1239 getInsertPointForUses(DU.NarrowUse, DU.NarrowDef, DT, LI)); in widenLoopCompare()
1240 DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, DU.WideDef); in widenLoopCompare()
1245 DU.NarrowUse->replaceUsesOfWith(Op, ExtOp); in widenLoopCompare()
1252 Instruction *WidenIV::widenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter) { in widenIVUse() argument
1255 if (PHINode *UsePhi = dyn_cast<PHINode>(DU.NarrowUse)) { in widenIVUse()
1261 truncateIVUse(DU, DT, LI); in widenIVUse()
1270 PHINode::Create(DU.WideDef->getType(), 1, UsePhi->getName() + ".wide", in widenIVUse()
1272 WidePhi->addIncoming(DU.WideDef, UsePhi->getIncomingBlock(0)); in widenIVUse()
1274 Value *Trunc = Builder.CreateTrunc(WidePhi, DU.NarrowDef->getType()); in widenIVUse()
1284 if (IsSigned ? isa<SExtInst>(DU.NarrowUse) : isa<ZExtInst>(DU.NarrowUse)) { in widenIVUse()
1285 Value *NewDef = DU.WideDef; in widenIVUse()
1286 if (DU.NarrowUse->getType() != WideType) { in widenIVUse()
1287 unsigned CastWidth = SE->getTypeSizeInBits(DU.NarrowUse->getType()); in widenIVUse()
1291 IRBuilder<> Builder(DU.NarrowUse); in widenIVUse()
1292 NewDef = Builder.CreateTrunc(DU.WideDef, DU.NarrowUse->getType()); in widenIVUse()
1299 << " not wide enough to subsume " << *DU.NarrowUse << "\n"); in widenIVUse()
1300 DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, DU.WideDef); in widenIVUse()
1301 NewDef = DU.NarrowUse; in widenIVUse()
1304 if (NewDef != DU.NarrowUse) { in widenIVUse()
1305 DEBUG(dbgs() << "INDVARS: eliminating " << *DU.NarrowUse in widenIVUse()
1306 << " replaced by " << *DU.WideDef << "\n"); in widenIVUse()
1308 DU.NarrowUse->replaceAllUsesWith(NewDef); in widenIVUse()
1309 DeadInsts.emplace_back(DU.NarrowUse); in widenIVUse()
1322 const SCEVAddRecExpr *WideAddRec = getWideRecurrence(DU.NarrowUse); in widenIVUse()
1324 WideAddRec = getExtendedOperandRecurrence(DU); in widenIVUse()
1329 if (widenLoopCompare(DU)) in widenIVUse()
1335 truncateIVUse(DU, DT, LI); in widenIVUse()
1340 assert(DU.NarrowUse != DU.NarrowUse->getParent()->getTerminator() && in widenIVUse()
1346 if (WideAddRec == WideIncExpr && Rewriter.hoistIVInc(WideInc, DU.NarrowUse)) in widenIVUse()
1349 WideUse = cloneIVUser(DU, WideAddRec); in widenIVUse()
1450 NarrowIVDefUse DU = NarrowIVUsers.pop_back_val(); in createWideIV() local
1454 Instruction *WideUse = widenIVUse(DU, Rewriter); in createWideIV()
1458 pushNarrowIVUsers(DU.NarrowUse, WideUse); in createWideIV()
1461 if (DU.NarrowDef->use_empty()) in createWideIV()
1462 DeadInsts.emplace_back(DU.NarrowDef); in createWideIV()