Lines Matching refs:DU
1146 Instruction *cloneIVUser(NarrowIVDefUse DU, const SCEVAddRecExpr *WideAR);
1147 Instruction *cloneArithmeticIVUser(NarrowIVDefUse DU,
1149 Instruction *cloneBitwiseIVUser(NarrowIVDefUse DU);
1155 WidenedRecTy getWideRecurrence(NarrowIVDefUse DU);
1157 WidenedRecTy getExtendedOperandRecurrence(NarrowIVDefUse DU);
1162 Instruction *widenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter,
1164 void truncateIVUse(NarrowIVDefUse DU);
1166 bool widenLoopCompare(NarrowIVDefUse DU);
1167 bool widenWithVariantUse(NarrowIVDefUse DU);
1255 Instruction *WidenIV::cloneIVUser(WidenIV::NarrowIVDefUse DU, in cloneIVUser() argument
1257 unsigned Opcode = DU.NarrowUse->getOpcode(); in cloneIVUser()
1265 return cloneArithmeticIVUser(DU, WideAR); in cloneIVUser()
1273 return cloneBitwiseIVUser(DU); in cloneIVUser()
1277 Instruction *WidenIV::cloneBitwiseIVUser(WidenIV::NarrowIVDefUse DU) { in cloneBitwiseIVUser() argument
1278 Instruction *NarrowUse = DU.NarrowUse; in cloneBitwiseIVUser()
1279 Instruction *NarrowDef = DU.NarrowDef; in cloneBitwiseIVUser()
1280 Instruction *WideDef = DU.WideDef; in cloneBitwiseIVUser()
1307 Instruction *WidenIV::cloneArithmeticIVUser(WidenIV::NarrowIVDefUse DU, in cloneArithmeticIVUser() argument
1309 Instruction *NarrowUse = DU.NarrowUse; in cloneArithmeticIVUser()
1310 Instruction *NarrowDef = DU.NarrowDef; in cloneArithmeticIVUser()
1311 Instruction *WideDef = DU.WideDef; in cloneArithmeticIVUser()
1478 WidenIV::getExtendedOperandRecurrence(WidenIV::NarrowIVDefUse DU) { in getExtendedOperandRecurrence() argument
1479 auto Op = matchBinaryOp(DU.NarrowUse); in getExtendedOperandRecurrence()
1489 const unsigned ExtendOperIdx = Op->Operands[0] == DU.NarrowDef ? 1 : 0; in getExtendedOperandRecurrence()
1490 assert(Op->Operands[1 - ExtendOperIdx] == DU.NarrowDef && "bad DU"); in getExtendedOperandRecurrence()
1492 ExtendKind ExtKind = getExtendKind(DU.NarrowDef); in getExtendedOperandRecurrence()
1501 if (DU.NeverNegative) { in getExtendedOperandRecurrence()
1523 const SCEV *lhs = SE->getSCEV(DU.WideDef); in getExtendedOperandRecurrence()
1544 WidenIV::WidenedRecTy WidenIV::getWideRecurrence(WidenIV::NarrowIVDefUse DU) { in getWideRecurrence() argument
1545 if (!DU.NarrowUse->getType()->isIntegerTy()) in getWideRecurrence()
1548 const SCEV *NarrowExpr = SE->getSCEV(DU.NarrowUse); in getWideRecurrence()
1558 if (DU.NeverNegative) { in getWideRecurrence()
1566 } else if (getExtendKind(DU.NarrowDef) == ExtendKind::Sign) { in getWideRecurrence()
1581 void WidenIV::truncateIVUse(NarrowIVDefUse DU) { in truncateIVUse() argument
1582 auto *InsertPt = getInsertPointForUses(DU.NarrowUse, DU.NarrowDef, DT, LI); in truncateIVUse()
1585 LLVM_DEBUG(dbgs() << "INDVARS: Truncate IV " << *DU.WideDef << " for user " in truncateIVUse()
1586 << *DU.NarrowUse << "\n"); in truncateIVUse()
1587 ExtendKind ExtKind = getExtendKind(DU.NarrowDef); in truncateIVUse()
1590 Builder.CreateTrunc(DU.WideDef, DU.NarrowDef->getType(), "", in truncateIVUse()
1591 DU.NeverNegative || ExtKind == ExtendKind::Zero, in truncateIVUse()
1592 DU.NeverNegative || ExtKind == ExtendKind::Sign); in truncateIVUse()
1593 DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, Trunc); in truncateIVUse()
1599 bool WidenIV::widenLoopCompare(WidenIV::NarrowIVDefUse DU) { in widenLoopCompare() argument
1600 ICmpInst *Cmp = dyn_cast<ICmpInst>(DU.NarrowUse); in widenLoopCompare()
1618 bool IsSigned = getExtendKind(DU.NarrowDef) == ExtendKind::Sign; in widenLoopCompare()
1619 if (!(DU.NeverNegative || IsSigned == Cmp->isSigned())) in widenLoopCompare()
1622 Value *Op = Cmp->getOperand(Cmp->getOperand(0) == DU.NarrowDef ? 1 : 0); in widenLoopCompare()
1628 DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, DU.WideDef); in widenLoopCompare()
1633 DU.NarrowUse->replaceUsesOfWith(Op, ExtOp); in widenLoopCompare()
1658 bool WidenIV::widenWithVariantUse(WidenIV::NarrowIVDefUse DU) { in widenWithVariantUse() argument
1659 Instruction *NarrowUse = DU.NarrowUse; in widenWithVariantUse()
1660 Instruction *NarrowDef = DU.NarrowDef; in widenWithVariantUse()
1661 Instruction *WideDef = DU.WideDef; in widenWithVariantUse()
1835 Instruction *WidenIV::widenIVUse(WidenIV::NarrowIVDefUse DU, in widenIVUse() argument
1838 assert(ExtendKindMap.count(DU.NarrowDef) && in widenIVUse()
1844 DU.NeverNegative || getExtendKind(DU.NarrowDef) == ExtendKind::Sign; in widenIVUse()
1846 DU.NeverNegative || getExtendKind(DU.NarrowDef) == ExtendKind::Zero; in widenIVUse()
1849 if (PHINode *UsePhi = dyn_cast<PHINode>(DU.NarrowUse)) { in widenIVUse()
1855 truncateIVUse(DU); in widenIVUse()
1864 PHINode::Create(DU.WideDef->getType(), 1, UsePhi->getName() + ".wide", in widenIVUse()
1866 WidePhi->addIncoming(DU.WideDef, UsePhi->getIncomingBlock(0)); in widenIVUse()
1869 Value *Trunc = Builder.CreateTrunc(WidePhi, DU.NarrowDef->getType(), "", in widenIVUse()
1881 if ((match(DU.NarrowUse, m_SExtLike(m_Value())) && CanWidenBySExt) || in widenIVUse()
1882 (isa<ZExtInst>(DU.NarrowUse) && CanWidenByZExt)) { in widenIVUse()
1883 Value *NewDef = DU.WideDef; in widenIVUse()
1884 if (DU.NarrowUse->getType() != WideType) { in widenIVUse()
1885 unsigned CastWidth = SE->getTypeSizeInBits(DU.NarrowUse->getType()); in widenIVUse()
1889 IRBuilder<> Builder(DU.NarrowUse); in widenIVUse()
1890 NewDef = Builder.CreateTrunc(DU.WideDef, DU.NarrowUse->getType(), "", in widenIVUse()
1898 << " not wide enough to subsume " << *DU.NarrowUse in widenIVUse()
1900 DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, DU.WideDef); in widenIVUse()
1901 NewDef = DU.NarrowUse; in widenIVUse()
1904 if (NewDef != DU.NarrowUse) { in widenIVUse()
1905 LLVM_DEBUG(dbgs() << "INDVARS: eliminating " << *DU.NarrowUse in widenIVUse()
1906 << " replaced by " << *DU.WideDef << "\n"); in widenIVUse()
1908 DU.NarrowUse->replaceAllUsesWith(NewDef); in widenIVUse()
1909 DeadInsts.emplace_back(DU.NarrowUse); in widenIVUse()
1923 WidenedRecTy WideAddRec = getExtendedOperandRecurrence(DU); in widenIVUse()
1925 WideAddRec = getWideRecurrence(DU); in widenIVUse()
1940 OrigPhi, WidePhi, DU.NarrowUse, WideInc) || in widenIVUse()
1941 DU.NarrowUse->hasNoUnsignedWrap() != WideInc->hasNoUnsignedWrap() || in widenIVUse()
1942 DU.NarrowUse->hasNoSignedWrap() != WideInc->hasNoSignedWrap(); in widenIVUse()
1944 Rewriter.hoistIVInc(WideInc, DU.NarrowUse, NeedToRecomputeFlags); in widenIVUse()
1951 WideUse = cloneIVUser(DU, WideAddRec.first); in widenIVUse()
1970 replaceAllDbgUsesWith(*DU.NarrowUse, *WideUse, *WideUse, *DT); in widenIVUse()
1972 ExtendKindMap[DU.NarrowUse] = WideAddRec.second; in widenIVUse()
1982 if (widenLoopCompare(DU)) in widenIVUse()
1990 if (widenWithVariantUse(DU)) in widenIVUse()
1996 truncateIVUse(DU); in widenIVUse()
2137 WidenIV::NarrowIVDefUse DU = NarrowIVUsers.pop_back_val(); in createWideIV() local
2141 Instruction *WideUse = widenIVUse(DU, Rewriter, OrigPhi, WidePhi); in createWideIV()
2145 pushNarrowIVUsers(DU.NarrowUse, WideUse); in createWideIV()
2148 if (DU.NarrowDef->use_empty()) in createWideIV()
2149 DeadInsts.emplace_back(DU.NarrowDef); in createWideIV()