54 if (Negated && Opcode == Instruction::FAdd)
55 Opcode = Instruction::FSub;
81 case Instruction::Sub:
82 return Instruction::Add;
83 case Instruction::FSub:
84 return Instruction::FAdd;
91 if (
I->getOpcode() == Instruction::Sub)
93 if (
I->getOpcode() == Instruction::FSub)
94 return I->hasAllowReassoc();
95 return I->isAssociative();
103 switch (
I->getOpcode()) {
104 case Instruction::ExtractValue:
105 case Instruction::InsertValue:
107 case Instruction::ExtractElement:
110 case Instruction::InsertElement:
120 "ScalableVectorType is not supported.");
131 return std::min<unsigned>(PartNumElems,
Size - Part * PartNumElems);
139 OS <<
"Idx: " << Idx <<
", ";
140 OS <<
"n=" << VL.
size() <<
" [" << *VL.
front() <<
", ..]";
155 return !isa<PoisonValue>(V);
161 if (BB !=
II->getParent())
174 Value *FirstNonUndef =
nullptr;
177 if (!FirstNonUndef) {
181 if (V != FirstNonUndef)
184 return FirstNonUndef !=
nullptr;
190 if ((LHS == Intrinsic::fma || LHS == Intrinsic::fmuladd) &&
191 (RHS == Intrinsic::fma || RHS == Intrinsic::fmuladd))
192 return Intrinsic::fma;
200 return isa<CmpInst>(ValWithUses) && Cmp->isCommutative();
202 return BO->isCommutative() ||
203 (BO->getOpcode() == Instruction::Sub && ValWithUses->
hasUseList() &&
210 if (match(U.getUser(),
211 m_ICmp(Pred, m_Specific(U.get()), m_Zero())) &&
212 (Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_NE))
218 auto *I = dyn_cast<OverflowingBinaryOperator>(U.get());
219 return match(U.getUser(),
220 m_Intrinsic<Intrinsic::abs>(
221 m_Specific(U.get()), m_ConstantInt(Flag))) &&
222 ((!IsCopyable && I && !I->hasNoSignedWrap()) ||
225 (BO->getOpcode() == Instruction::FSub && ValWithUses->
hasUseList() &&
228 return match(U.getUser(),
229 m_Intrinsic<Intrinsic::fabs>(m_Specific(U.get())));
231 return I->isCommutative();
239 "The instruction is not commutative.");
243 switch (BO->getOpcode()) {
244 case Instruction::Sub:
245 case Instruction::FSub:
251 return I->isCommutableOperand(
Op);
258 constexpr unsigned IntrinsicNumOperands = 2;
259 return IntrinsicNumOperands;
261 return I->getNumOperands();
276 Type *CurrentType =
IV->getType();
277 for (
unsigned I :
IV->indices()) {
279 Index *= ST->getNumElements();
280 CurrentType = ST->getElementType(
I);
282 Index *= AT->getNumElements();
283 CurrentType = AT->getElementType();
302 if (auto *CI = dyn_cast<CmpInst>(V))
303 return BasePred == CI->getPredicate();
304 if (auto *I = dyn_cast<Instruction>(V))
305 return I->getOpcode() == Opcode;
306 return isa<PoisonValue>(V);
311 unsigned Opcode = E->getOpcode();
312 assert((Opcode == Instruction::ExtractElement ||
313 Opcode == Instruction::ExtractValue) &&
314 "Expected extractelement or extractvalue instruction.");
315 if (Opcode == Instruction::ExtractElement)
318 if (EI->getNumIndices() != 1)
320 return *EI->idx_begin();
326 const unsigned E = Indices.
size();
328 for (
unsigned I = 0;
I < E; ++
I)
329 Mask[Indices[
I]] =
I;
333 assert(!Mask.empty() &&
"Expected non-empty mask.");
337 for (
unsigned I = 0, E = Prev.
size();
I < E; ++
I)
339 Scalars[Mask[
I]] = Prev[
I];
343 assert(!Mask.empty() && Reuses.
size() == Mask.size() &&
344 "Expected non-empty mask.");
347 for (
unsigned I = 0, E = Prev.
size();
I < E; ++
I)
349 Reuses[Mask[
I]] = Prev[
I];
354 assert(!Mask.empty() &&
"Expected non-empty mask.");
355 unsigned Sz = Mask.size();
360 std::iota(PrevOrder.
begin(), PrevOrder.
end(), 0);
362 PrevOrder.
swap(Order);
365 for (
unsigned I = 0;
I < Sz; ++
I)
367 Order[
I] = PrevOrder[Mask[
I]];
369 return Data.value() == Sz ||
Data.index() ==
Data.value();
380 std::iota(MaskOrder.
begin(), MaskOrder.
end(), 0);
390 for (
unsigned I = 0;
I < Sz; ++
I)
392 Order[MaskOrder[
I]] =
I;
398 "Order is empty. Please check it before using isReverseOrder.");
399 unsigned Sz = Order.
size();
401 return Pair.value() == Sz || Sz - Pair.index() - 1 == Pair.value();
409 for (
unsigned I = Sz, E = Mask.size();
I < E;
I += Sz) {
420 "Expected same size of orders");
421 size_t Sz = Order.
size();
424 if (Order[Idx] != Sz)
425 UsedIndices.
set(Order[Idx]);
427 if (SecondaryOrder.
empty()) {
429 if (Order[Idx] == Sz && !UsedIndices.
test(Idx))
433 if (SecondaryOrder[Idx] != Sz && Order[Idx] == Sz &&
434 !UsedIndices.
test(SecondaryOrder[Idx]))
435 Order[Idx] = SecondaryOrder[Idx];
440 assert(!VL.
empty() &&
"Expected non-empty list of values.");
442 return all_of(VL, [&](
Value *V) {
return V->getType() == Ty; });
448 static_assert(std::is_same_v<T, InsertElementInst> ||
449 std::is_same_v<T, ExtractElementInst>,
456 constexpr bool IsInsert = std::is_same_v<T, InsertElementInst>;
457 Type *VecTy = IsInsert ? IE->getType() : IE->getOperand(0)->getType();
464 if (CI->getValue().uge(VT->getNumElements()))
467 Index *= VT->getNumElements();
468 Index += CI->getZExtValue();
474template std::optional<unsigned>
476template std::optional<unsigned>
485 return isa<PHINode>(IO) || IO->getParent() != I->getParent();
496 auto *IU = dyn_cast<Instruction>(U);
499 return IU->getParent() != I->getParent() || isa<PHINode>(IU);
500 }) && !
I->mayReadOrWriteMemory();
508 return !VL.
empty() &&
521 I * VecTyNumElements, VecTyNumElements)))
523 : Mask[
I] * VecTyNumElements + J;
533 unsigned SVNumElements =
535 unsigned ShuffleMaskSize = SV->getShuffleMask().size();
536 if (SVNumElements % ShuffleMaskSize != 0)
538 unsigned GroupSize = SVNumElements / ShuffleMaskSize;
539 if (GroupSize == 0 || (VL.
size() % GroupSize) != 0)
541 unsigned NumGroup = 0;
542 for (
size_t I = 0, E = VL.
size();
I != E;
I += GroupSize) {
544 Value *Src = SV->getOperand(0);
550 if (SV->getOperand(0) != Src)
553 if (!SV->isExtractSubvectorMask(Index))
555 ExpectedIndex.
set(Index / ShuffleMaskSize);
559 if (!ExpectedIndex.
all())
563 assert(NumGroup == (VL.
size() / GroupSize) &&
"Unexpected number of groups");
570 unsigned SVNumElements =
573 unsigned AccumulateLength = 0;
574 for (
Value *V : VL) {
576 for (
int M : SV->getShuffleMask())
578 : AccumulateLength + M);
579 AccumulateLength += SVNumElements;
606std::optional<TargetTransformInfo::ShuffleKind>
613 Value *Vec1 =
nullptr;
614 Value *Vec2 =
nullptr;
617 std::optional<bool> HasNonUndefVec;
618 auto IsNonUndefVecPresent = [&]() {
625 return Cache.isGuaranteedNotToBePoison(Vec, AC);
627 return *HasNonUndefVec;
630 ShuffleMode CommonShuffleMode =
Unknown;
632 for (
unsigned I = 0, E = VL.
size();
I < E; ++
I) {
642 auto *Vec = EI->getVectorOperand();
658 unsigned IntIdx = Idx->getValue().getZExtValue();
667 if (!Vec1 || Vec1 == Vec) {
669 }
else if (!Vec2 || Vec2 == Vec) {
684 else if (Vec != Vec1)
686 if (CommonShuffleMode == Permute)
690 if (Idx %
Size !=
I) {
691 CommonShuffleMode = Permute;
694 CommonShuffleMode =
Select;
697 if (CommonShuffleMode ==
Select && Vec2)
716 auto *Begin = std::next(Mask.begin(), Index);
717 std::iota(Begin, std::next(Begin, SubVecVF), 0);
718 Vec = Builder.CreateShuffleVector(V, Mask);
721 std::iota(Mask.begin(), Mask.end(), 0);
722 std::iota(std::next(Mask.begin(), Index),
723 std::next(Mask.begin(), Index + SubVecVF), VecVF);
725 return Generator(Vec, V, Mask);
728 std::iota(ResizeMask.
begin(), std::next(ResizeMask.
begin(), SubVecVF), 0);
729 V = Builder.CreateShuffleVector(V, ResizeMask);
731 return Builder.CreateShuffleVector(Vec, V, Mask);
735 unsigned SubVecVF,
unsigned Index) {
737 std::iota(Mask.begin(), Mask.end(), Index);
738 return Builder.CreateShuffleVector(Vec, Mask);
745 "Expected reachable block.");
750 return DT.dominates(&InsertPt, U);
757 assert((Opcode == Instruction::URem || Opcode == Instruction::SRem) &&
758 "Expected remainder.");
760 if (
X->hasOneUse() ||
Y->hasOneUse())
771 const unsigned DivOpcode =
772 Opcode == Instruction::URem ? Instruction::UDiv : Instruction::SDiv;
773 for (
User *U :
Op->users()) {
776 I->getParent() == BB && Pred(
I))
798template <
bool IsPoisonOnly>
801 using T = std::conditional_t<IsPoisonOnly, PoisonValue, UndefValue>;
835 for (
unsigned I = 0, E = VecTy->getNumElements();
I != E; ++
I) {
836 if (
Constant *Elem =
C->getAggregateElement(
I))
856 case Instruction::Load: {
860 case Instruction::Store: {
862 return (
SI->getPointerOperand() == Scalar);
864 case Instruction::Call: {
868 return isVectorIntrinsicWithScalarOpAtArg(ID, Arg.index(), TTI) &&
869 Arg.value().get() == Scalar;
887 return LI->isSimple();
889 return SI->isSimple();
891 return !
MI->isVolatile();
901 uint64_t ScalarSize =
DL.getTypeStoreSize(ScalarTy);
902 Conditions.
assign(PointerOps.
size(),
nullptr);
907 APInt OffsetAP(
DL.getIndexTypeSizeInBits(
GEP->getType()), 0);
908 if (!
GEP->accumulateConstantOffset(
DL, OffsetAP) || OffsetAP.
isNegative())
911 Base =
GEP->getPointerOperand();
916 Value *
T = Sel->getTrueValue();
917 Value *
F = Sel->getFalseValue();
923 }
else if (TrueBase !=
T || FalseBase !=
F) {
928 if (
Offset !=
static_cast<uint64_t
>(Idx) * ScalarSize)
930 Conditions[Idx] = Sel->getCondition();
932 return TrueBase !=
nullptr;
938 "Expected only load lanes in a blended load.");
939 const uint64_t ScalarSize =
DL.getTypeStoreSize(VL.
front()->getType());
945 return BaseAlignment;
951 Ptr =
GEP->getPointerOperand();
958 constexpr unsigned IndexIdx = 1;
962 bool AllSameTy =
true;
963 bool HasNonConstIdx =
false;
964 bool ConstsFitVL0Ty =
true;
967 if (
Op->getType() != VL0Ty)
972 if (
Op->getType() != VL0Ty)
974 HasNonConstIdx =
true;
978 ConstsFitVL0Ty =
false;
982 if (!HasNonConstIdx || VL0Ty == PtrIdxTy)
984 return ConstsFitVL0Ty ? VL0Ty :
nullptr;
989 if (UniquePtrs.
size() != PointerOps.
size())
991 auto IsConstantOffsetPtr = [](
Value *
P) {
996 auto *RefIt =
find_if_not(PointerOps, IsConstantOffsetPtr);
997 if (RefIt == PointerOps.
end())
1000 if (!RefGEP || RefGEP->getNumOperands() != 2)
1002 Value *
Base = RefGEP->getPointerOperand();
1003 Type *PtrTy = RefGEP->getType();
1004 Type *SrcElemTy = RefGEP->getSourceElementType();
1006 Value *Stride =
nullptr;
1007 unsigned CastOpcode = 0;
1008 for (
Value *
P : PointerOps) {
1009 if (
P->getType() != PtrTy)
1014 if (!
GEP ||
GEP->getNumOperands() != 2 ||
1015 GEP->getPointerOperand() !=
Base ||
1016 GEP->getSourceElementType() != SrcElemTy)
1021 unsigned LaneCastOpcode = 0;
1023 LaneCastOpcode = Cast->getOpcode();
1024 Idx = Cast->getOperand(0);
1026 Value *LaneStride = Idx;
1029 LaneStride = BO->getOperand(0);
1031 LaneStride = BO->getOperand(1);
1034 Stride = LaneStride;
1035 CastOpcode = LaneCastOpcode;
1038 if (LaneStride != Stride || LaneCastOpcode != CastOpcode)
1041 return Stride !=
nullptr;
1045 bool ExtendingManyInputs) {
1046 if (SubMask.
empty())
1049 (!ExtendingManyInputs || SubMask.
size() > Mask.size() ||
1052 "SubMask with many inputs support must be larger than the mask.");
1054 Mask.append(SubMask.
begin(), SubMask.
end());
1058 int TermValue = std::min(Mask.size(), SubMask.
size());
1059 for (
int I = 0, E = SubMask.
size();
I < E; ++
I) {
1061 (!ExtendingManyInputs &&
1062 (SubMask[
I] >= TermValue || Mask[SubMask[
I]] >= TermValue)))
1064 NewMask[
I] = Mask[SubMask[
I]];
1070 const size_t Sz = Order.
size();
1073 for (
unsigned I = 0;
I < Sz; ++
I) {
1075 UnusedIndices.
reset(Order[
I]);
1077 MaskedIndices.
set(
I);
1079 if (MaskedIndices.
none())
1082 "Non-synced masked/available indices.");
1086 assert(Idx >= 0 &&
"Indices must be synced.");
1094 unsigned Opcode0,
unsigned Opcode1) {
1101 OpcodeMask.
set(Lane * ScalarTyNumElements,
1102 Lane * ScalarTyNumElements + ScalarTyNumElements);
1109 "Expected scalar constants.");
1112 std::fill_n(NewVal.begin() +
I * VF, VF, V);
1118 case Instruction::UDiv:
1119 return Intrinsic::masked_udiv;
1120 case Instruction::SDiv:
1121 return Intrinsic::masked_sdiv;
1122 case Instruction::URem:
1123 return Intrinsic::masked_urem;
1124 case Instruction::SRem:
1125 return Intrinsic::masked_srem;
1135 constexpr unsigned MaxIndexChainLength = 3;
1136 const User *U =
I->user_back();
1137 for ([[maybe_unused]]
unsigned _ :
seq<unsigned>(MaxIndexChainLength)) {
1153 unsigned Opcode = BO->getOpcode();
1154 Type *Ty = BO->getType();
1158 Opcode, Ty, Idx == 1) ||
1160 Opcode, Ty, Idx == 0)))
1164 const User *U =
I->user_back();
1176 if (!Wide || !Wide->hasOneUse())
1179 if (!Narrow || !Narrow->hasOneUse())
1181 Value *Src = Narrow->getOperand(0);
1184 if (MustBeElidable && !(Wide->hasAllowContract() && Wide->hasNoNaNs() &&
1185 Wide->hasNoInfs() && Narrow->hasAllowContract()))
1195struct NarrowedChainState {
1197 unsigned NarrowShift = 0;
1198 unsigned NarrowBW = 0;
1216 NarrowedChainState S,
unsigned Depth,
1220 if (
Depth < MaxDepth) {
1222 Z && Z->getSrcTy()->isIntegerTy() && !Z->getSrcTy()->isIntegerTy(1)) {
1225 Depth + 1, MaxDepth, Leaves, ChainInsts);
1228 if (BO->getOpcode() == RdxOpcode) {
1231 Depth + 1, MaxDepth, Leaves, ChainInsts);
1233 Depth + 1, MaxDepth, Leaves, ChainInsts);
1237 unsigned BW = V->getType()->getScalarSizeInBits();
1239 if (BO->getOpcode() == Instruction::Shl && Z && S.NarrowBW == 0 &&
1241 Z->getSrcTy()->isIntegerTy() && !Z->getSrcTy()->isIntegerTy(1) &&
1243 Z->getSrcTy()->getIntegerBitWidth() + Amt->
getZExtValue() <= BW) &&
1249 Depth + 1, MaxDepth, Leaves,
1256 if (BW < WideBW && (S.NarrowBW == 0 || BW == S.NarrowBW)) {
1257 if (BO->getOpcode() == Instruction::Shl &&
1260 S.Shift + S.NarrowShift + Amt->
getZExtValue() < WideBW) {
1262 if (BO->hasNoUnsignedWrap() && S.NarrowBW == 0) {
1269 if (S.NarrowBW == 0) {
1276 S,
Depth + 1, MaxDepth, Leaves,
1282 if (S.NarrowBW == 0) {
1286 S.NarrowMask &= *Amt << S.NarrowShift;
1288 MaxDepth, Leaves, ChainInsts);
1294 S.getMask(V->getType()->getScalarSizeInBits()));
1302 0, MaxDepth, Leaves, ChainInsts);
1306 assert(
F &&
"Expected function.");
1312static std::optional<std::tuple<Value *, unsigned, unsigned>>
1314 if (!V->getType()->isIntegerTy())
1315 return std::nullopt;
1318 auto GetFieldOffset = [](
const APInt *Amt,
unsigned BitWidth,
1319 unsigned FieldWidth) -> std::optional<unsigned> {
1321 if (ShAmt % FieldWidth != 0 || ShAmt + FieldWidth >
BitWidth)
1322 return std::nullopt;
1323 return ShAmt / FieldWidth;
1328 auto MatchLowField =
1330 unsigned FieldWidth) -> std::optional<std::pair<Value *, unsigned>> {
1336 if (std::optional<unsigned>
Offset = GetFieldOffset(
1337 Amt, Src->getType()->getIntegerBitWidth(), FieldWidth)) {
1340 return std::make_pair(Src, *
Offset);
1342 return std::nullopt;
1345 Src->getType()->getIntegerBitWidth() >= FieldWidth)
1346 return std::make_pair(Src, 0u);
1349 return std::make_pair(Val, 0u);
1350 return std::nullopt;
1356 unsigned FieldWidth = 0;
1358 FieldWidth = Mask->popcount();
1361 if (FieldWidth != 0) {
1362 if (std::optional<std::pair<Value *, unsigned>>
Field =
1363 MatchLowField(Val, FieldWidth))
1364 return std::make_tuple(
Field->first, FieldWidth,
Field->second);
1365 return std::nullopt;
1367 unsigned LaneWidth = V->getType()->getIntegerBitWidth();
1371 unsigned SrcWidth = Src->getType()->getIntegerBitWidth();
1374 if (std::optional<unsigned>
Offset =
1375 GetFieldOffset(Amt, SrcWidth, LaneWidth))
1376 return std::make_tuple(Src, LaneWidth, *
Offset);
1378 unsigned FieldWidth = SrcWidth - ShAmt;
1379 if (FieldWidth > 0 && FieldWidth < LaneWidth && ShAmt % FieldWidth == 0)
1380 return std::make_tuple(Src, FieldWidth, ShAmt / FieldWidth);
1381 return std::nullopt;
1386 unsigned ShfWidth = Src->getType()->getIntegerBitWidth();
1388 unsigned FieldWidth = ShfWidth - ShAmt;
1389 if (FieldWidth > 0 && ShAmt % FieldWidth == 0) {
1391 return std::make_tuple(Src, FieldWidth, ShAmt / FieldWidth);
1393 return std::nullopt;
1396 return std::make_tuple(Src, LaneWidth, 0u);
1397 return std::nullopt;
1400std::optional<std::tuple<Value *, unsigned, SmallVector<int>>>
1405 if (VL.
size() < 2 || !VL.
front()->getType()->isIntegerTy() ||
isSplat(VL) ||
1407 return std::nullopt;
1408 Value *Src =
nullptr;
1409 unsigned FieldWidth = 0;
1414 if (V->getType() != VL.
front()->getType())
1415 return std::nullopt;
1416 std::optional<std::tuple<Value *, unsigned, unsigned>>
Field =
1418 if (!
Field || (Src && (Src != std::get<0>(*
Field) ||
1419 FieldWidth != std::get<1>(*
Field))))
1420 return std::nullopt;
1421 Src = std::get<0>(*
Field);
1422 FieldWidth = std::get<1>(*
Field);
1423 Mask[Idx] = std::get<2>(*
Field);
1429 Src->getType()->getIntegerBitWidth() % FieldWidth != 0)
1430 return std::nullopt;
1436 return std::nullopt;
1437 return std::make_tuple(Src, FieldWidth, std::move(Mask));
1445 unsigned BitWidth = V->getType()->getScalarSizeInBits();
1495 unsigned NumElts = PossibleBits.
size();
1498 for (
unsigned Idx :
seq(NumElts)) {
1499 APInt Possible = PossibleBits[Idx].shl(ShlAmts[Idx]) & Masks[Idx];
1504 return std::nullopt;
1505 if (Info.FieldWidth == 0) {
1506 if (W % 8 != 0 ||
BitWidth % W != 0)
1507 return std::nullopt;
1508 Info.FieldWidth = W;
1511 if (W != Info.FieldWidth ||
Lo % W != 0)
1512 return std::nullopt;
1515 return std::nullopt;
1516 Info.LaneOfField[
Field] = Idx;
1517 Info.LShrAmts[Idx] =
Lo - ShlAmts[Idx];
1519 if (Info.FieldWidth == 0)
1520 return std::nullopt;
1525 unsigned NumElts,
unsigned BytesPerLane) {
1526 unsigned BytesPerField = Info.FieldWidth / 8;
1528 for (
unsigned J :
seq(NumBytes)) {
1529 unsigned Lane = Info.LaneOfField[J / BytesPerField];
1531 ? (
int)(NumElts * BytesPerLane)
1532 : (
int)(Lane * BytesPerLane + J % BytesPerField));
1538 Type *ResultTy,
unsigned ShiftWidth,
unsigned &NumInsts) {
1541 unsigned BitWidth = VecTy->getScalarSizeInBits();
1543 "The byte-multiple field width divides the result bit width.");
1544 unsigned NumElts = VecTy->getNumElements();
1550 Y = Z->getOperand(0);
1552 Y = Builder.CreateTrunc(
1558 if (Info.needsShift()) {
1560 for (uint64_t
A : Info.LShrAmts)
1566 unsigned InBytes = NumElts * (ShiftWidth / 8);
1574 Value *Fields = Builder.CreateTrunc(
1575 Y,
Y->getType()->getWithNewBitWidth(Info.FieldWidth));
1576 NumInsts += 1 + (Info.FieldWidth != ShiftWidth) + IsReversed;
1577 if (IsReversed && Info.FieldWidth == 8)
1578 return Builder.CreateUnaryIntrinsic(
1579 Intrinsic::bswap, Builder.CreateBitCast(Fields, ResultTy));
1581 Fields = Builder.CreateVectorReverse(Fields);
1582 return Builder.CreateBitCast(Fields, ResultTy);
1584 Value *Packed = Builder.CreateShuffleVector(
1585 Builder.CreateBitCast(
Y, ByteTy),
1591 return Builder.CreateBitCast(Packed, ResultTy);
1599 if (!DVR->isDbgValue())
1602 if (ExI && MarkedI->
getParent() != ExI->getParent())
1604 if (!ExI || ExI->comesBefore(MarkedI)) {
1605 DVR->replaceVariableLocationOp(&From, &To);
1609 auto HasSameVar = [&](
auto Records) {
1615 if (HasSameVar(
make_range(std::next(DVR->getIterator()),
1618 std::next(ExI->getIterator())),
1620 return HasSameVar(I.getDbgRecordRange());
1625 ExI->getParent()->insertDbgRecordAfter(NewDVR, ExI);
1633 const auto *I1 = IE1;
1634 const auto *I2 = IE2;
1646 if (I1 && (I1 == IE1 || I1->hasOneUse()) &&
1649 if (I2 && ((I2 == IE2 || I2->
hasOneUse())) &&
1652 }
while ((I1 && PrevI1 != I1) || (I2 && PrevI2 != I2));
1666 unsigned AggregateSize = 1;
1668 Type *CurrentType =
IV->getType();
1671 for (
auto *Elt : ST->elements())
1672 if (Elt != ST->getElementType(0))
1673 return std::nullopt;
1674 AggregateSize *= ST->getNumElements();
1675 CurrentType = ST->getElementType(0);
1677 AggregateSize *= AT->getNumElements();
1678 CurrentType = AT->getElementType();
1680 AggregateSize *= VT->getNumElements();
1681 return AggregateSize;
1683 return AggregateSize;
1685 return std::nullopt;
1691 assert(L &&
"Expected valid loop");
1696 while (L && IsLoopInvariant(L, VL))
1697 L = L->getParentLoop();
1702 unsigned LoopAwareTripCount) {
1703 if (LoopAwareTripCount == 0)
1712 if (!L->getExitingBlock())
1713 return std::min<unsigned>(LoopAwareTripCount, Scale);
1716 return LoopAwareTripCount;
1726 if (VU->
getType() != V->getType())
1729 if (!VU->
hasOneUse() && !V->hasOneUse())
1735 if (Idx1 == std::nullopt || Idx2 == std::nullopt)
1741 bool IsReusedIdx =
false;
1743 if (IE2 == VU && !IE1)
1745 if (IE1 == V && !IE2)
1746 return V->hasOneUse();
1747 if (IE1 && IE1 != V) {
1749 IsReusedIdx |= ReusedIdx.
test(Idx1);
1750 ReusedIdx.
set(Idx1);
1751 if ((IE1 != VU && !IE1->
hasOneUse()) || IsReusedIdx)
1756 if (IE2 && IE2 != VU) {
1758 IsReusedIdx |= ReusedIdx.
test(Idx2);
1759 ReusedIdx.
set(Idx2);
1760 if ((IE2 != V && !IE2->hasOneUse()) || IsReusedIdx)
1765 }
while (!IsReusedIdx && (IE1 || IE2));
const TargetLowering & TLI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Register Bank Select
This file implements a class to represent arbitrary precision integral constant values and operations...
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static MaybeAlign getAlign(Value *Ptr)
static std::pair< Value *, APInt > getMask(Value *WideMask, unsigned Factor, ElementCount LeafValueEC)
uint64_t IntrinsicInst * II
OptimizedStructLayoutField Field
Provides some synthesis utilities to produce sequences of values.
This file defines the SmallPtrSet class.
static TableGen::Emitter::Opt Y("gen-skeleton-entry", EmitSkeleton, "Generate example skeleton entry")
static const uint32_t IV[8]
Class for arbitrary precision integers.
static APInt getAllOnes(unsigned numBits)
Return an APInt of a specified width with all bits set.
LLVM_ABI APInt zext(unsigned width) const
Zero extend to a new width.
uint64_t getZExtValue() const
Get zero extended value.
unsigned getActiveBits() const
Compute the number of active bits in the value.
bool isZero() const
Determine if this value is zero, i.e. all bits are clear.
bool ult(const APInt &RHS) const
Unsigned less than comparison.
bool isNegative() const
Determine sign of this APInt.
bool isShiftedMask() const
Return true if this APInt value contains a non-empty sequence of ones with the remainder zero.
uint64_t getLimitedValue(uint64_t Limit=UINT64_MAX) const
If this value is smaller than the specified limit, return it, otherwise return the limit value.
LLVM_ABI APInt uadd_sat(const APInt &RHS) const
APInt shl(unsigned shiftAmt) const
Left-shift function.
LLVM_ABI APInt umul_sat(const APInt &RHS) const
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Constructs an APInt value that has the bottom loBitsSet bits set.
APInt lshr(unsigned shiftAmt) const
Logical right-shift function.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
const T & front() const
Get the first element.
size_t size() const
Get the array size.
bool empty() const
Check if the array is empty.
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
const T & consume_front()
consume_front() - Returns the first element and drops it from ArrayRef.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
iterator_range< User::op_iterator > args()
Iteration adapter for range-for loops.
This class represents a function call, abstracting a target machine's calling convention.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
static LLVM_ABI Constant * getBinOpAbsorber(unsigned Opcode, Type *Ty, bool AllowLHSConstant=false)
Return the absorbing element for the given binary operation, i.e.
static LLVM_ABI Constant * getBinOpIdentity(unsigned Opcode, Type *Ty, bool AllowRHSConstant=false, bool NSZ=false)
Return the identity constant for a binary opcode.
static LLVM_ABI Constant * get(ArrayRef< Constant * > V)
This is an important base class in LLVM.
static LLVM_ABI Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
A parsed version of the target data layout string in and methods for querying it.
Record of a variable value-assignment, aka a non instruction representation of the dbg....
LLVM_ABI void replaceVariableLocationOp(Value *OldValue, Value *NewValue, bool AllowEmpty=false)
LLVM_ABI DbgVariableRecord * clone() const
static DebugLoc getUnknown()
Identifies a unique instance of a whole variable (discards/ignores fragment information).
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
LLVM_ABI bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
static LLVM_ABI FixedVectorType * get(Type *ElementType, unsigned NumElts)
Common base class shared among various IRBuilders.
This instruction inserts a single (scalar) element into a VectorType value.
VectorType * getType() const
Overload to return most specific vector type.
iterator_range< simple_ilist< DbgRecord >::iterator > getDbgRecordRange() const
Return a range over the DbgRecords attached to this instruction.
const DebugLoc & getDebugLoc() const
Return the debug location for this node as a DebugLoc.
LLVM_ABI bool comesBefore(const Instruction *Other) const
Given an instruction Other in the same basic block as this instruction, return true if this instructi...
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
static LLVM_ABI IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
An instruction for reading from memory.
Value * getPointerOperand()
Represents a single loop in the control flow graph.
This is the common base class for memset/memcpy/memmove.
Representation for a specific memory location.
static LLVM_ABI MemoryLocation get(const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
Represent a mutable reference to an array (0 or more elements consecutively in memory),...
static LLVM_ABI PoisonValue * get(Type *T)
Static factory methods - Return an 'poison' object of the specified type.
The main scalar evolution driver.
LLVM_ABI unsigned getSmallConstantTripCount(const Loop *L)
Returns the exact trip count of the loop if we can compute it, and the result is a small constant.
This class represents the LLVM 'select' instruction.
static LLVM_ABI bool isIdentityMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses elements from exactly one source vector without lane crossin...
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
int find_first() const
Returns the index of the first set bit, -1 if none of the bits are set.
bool test(unsigned Idx) const
Returns true if bit Idx is set.
int find_next(unsigned Prev) const
Returns the index of the next set bit following the "Prev" bit.
bool all() const
Returns true if all bits are set.
size_type count() const
Returns the number of bits which are set.
bool none() const
Returns true if none of the bits are set.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void assign(size_type NumElts, ValueParamT Elt)
reference emplace_back(ArgTypes &&... Args)
void swap(SmallVectorImpl &RHS)
void push_back(const T &Elt)
LLVM_NO_SANITIZE_CFI_UNRELATED_CAST iterator begin()
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
Provides information about what library functions are available for the current target.
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI unsigned getIntegerBitWidth() const
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
bool isSingleValueType() const
Return true if the type is a valid type for a register in codegen.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
A Use represents the edge between a Value definition and its users.
Value * getOperand(unsigned i) const
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
bool hasOneUse() const
Return true if there is exactly one use of this value.
bool hasUseList() const
Check if this Value has a use-list.
LLVM_ABI bool hasNUsesOrMore(unsigned N) const
Return true if this value has N uses or more.
iterator_range< use_iterator > uses()
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
constexpr ScalarTy getFixedValue() const
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
An efficient, type-erasing, non-owning reference to a callable.
const ParentTy * getParent() const
self_iterator getIterator()
A raw_ostream that writes to an std::string.
Caches the results of the expensive analyses that are queried repeatedly for the same values while th...
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const APInt & umin(const APInt &A, const APInt &B)
Determine the smaller of two APInts considered to be unsigned.
const APInt & umax(const APInt &A, const APInt &B)
Determine the larger of two APInts considered to be unsigned.
BinaryOp_match< LHS, RHS, Instruction::And > m_And(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::Add > m_Add(const LHS &L, const RHS &R)
ap_match< APInt > m_APInt(const APInt *&Res)
Match a ConstantInt or splatted ConstantVector, binding the specified pointer to the contained APInt.
BinaryOp_match< LHS, RHS, Instruction::And, true > m_c_And(const LHS &L, const RHS &R)
Matches an And with LHS and RHS in either order.
CastInst_match< OpTy, TruncInst > m_Trunc(const OpTy &Op)
Matches Trunc.
BinaryOp_match< LHS, RHS, Instruction::Xor > m_Xor(const LHS &L, const RHS &R)
bool match(Val *V, const Pattern &P)
specificval_ty m_Specific(const Value *V)
Match if we have a specific specified value.
BinOpPred_match< LHS, RHS, is_right_shift_op > m_Shr(const LHS &L, const RHS &R)
Matches logical shift operations.
ThreeOps_match< Cond, LHS, RHS, Instruction::Select > m_Select(const Cond &C, const LHS &L, const RHS &R)
Matches SelectInst.
auto m_BinOp()
Match an arbitrary binary operation and ignore it.
auto m_Value()
Match an arbitrary value and ignore it.
BinaryOp_match< LHS, RHS, Instruction::Mul > m_Mul(const LHS &L, const RHS &R)
CastInst_match< OpTy, ZExtInst > m_ZExt(const OpTy &Op)
Matches ZExt.
OverflowingBinaryOp_match< LHS, RHS, Instruction::Sub, OverflowingBinaryOperator::NoUnsignedWrap > m_NUWSub(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::LShr > m_LShr(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::Shl > m_Shl(const LHS &L, const RHS &R)
BinaryOp_match< LHS, RHS, Instruction::Or > m_Or(const LHS &L, const RHS &R)
CastInst_match< OpTy, SExtInst > m_SExt(const OpTy &Op)
Matches SExt.
A private "module" namespace for types and utilities used by this pass.
std::optional< unsigned > getExtractIndex(const Instruction *E)
template SmallBitVector isUndefVector< true >(const Value *, const SmallBitVector &)
Constant * getReassocIdentity(unsigned Opcode, Type *Ty, bool Negated)
Value * createInsertVector(IRBuilderBase &Builder, Value *Vec, Value *V, unsigned Index, function_ref< Value *(Value *, Value *, ArrayRef< int >)> Generator)
Creates subvector insert.
bool areAllOperandsNonInsts(Value *V)
Checks if the provided value does not require scheduling.
Instruction * findPairedDivision(unsigned Opcode, Value *X, Value *Y, const BasicBlock *BB, function_ref< bool(Instruction *)> Pred)
std::optional< unsigned > getElementIndex(const Value *Inst, unsigned Offset)
DebugLoc getDebugLocFromPHI(const PHINode &PN)
bool isBinOpIdentityConstant(const Value *V, unsigned Opcode, bool Negated)
bool doesInTreeUserNeedToExtract(Value *Scalar, Instruction *UserInst, TargetLibraryInfo *TLI, const TargetTransformInfo *TTI)
bool isCopyableGEPAddressVector(ArrayRef< Value * > PointerOps)
Checks if the pointers PointerOps of the gathered loads, which are not compatible in the usual sense ...
std::optional< std::tuple< Value *, unsigned, SmallVector< int > > > matchGatheredExtractedFields(ArrayRef< Value * > VL, const DataLayout &DL)
Checks if the values in VL are zero-extended sub-fields of the same wider integer scalar.
MemoryLocation getLocation(Instruction *I)
std::optional< BitPackInfo > computeBitPackInfo(unsigned BitWidth, ArrayRef< APInt > PossibleBits, ArrayRef< uint64_t > ShlAmts, ArrayRef< APInt > Masks)
Computes the bitfield packing layout from the per-lane possibly set bits of the source values,...
bool isSelectedBaseLoad(Type *ScalarTy, ArrayRef< Value * > PointerOps, const DataLayout &DL, Value *&TrueBase, Value *&FalseBase, SmallVectorImpl< Value * > &Conditions)
Checks if the loads with scalar type ScalarTy and pointer operands PointerOps are each (optionally vi...
SmallBitVector getAltInstrMask(ArrayRef< Value * > VL, Type *ScalarTy, unsigned Opcode0, unsigned Opcode1)
SmallBitVector isUndefVector(const Value *V, const SmallBitVector &UseMask)
Checks if the given value is actually an undefined constant vector.
Intrinsic::ID getMaskedDivRemIntrinsic(unsigned Opcode)
bool isUsedOutsideBlock(Value *V)
Checks if the provided value does not require scheduling.
bool doesNotNeedToSchedule(ArrayRef< Value * > VL)
Checks if the specified array of instructions does not require scheduling.
std::optional< unsigned > getInsertExtractIndex(const Value *Inst, unsigned Offset)
void redirectDbgValues(Instruction &From, Value &To)
The debug values of the erased From are kept on its replacement To.
void reorderScalars(SmallVectorImpl< Value * > &Scalars, ArrayRef< int > Mask)
Reorders the list of scalars in accordance with the given Mask.
SmallVector< int > getBitPackMask(const BitPackInfo &Info, unsigned NumBytes, unsigned NumElts, unsigned BytesPerLane)
Returns the byte shuffle mask packing the per-lane fields of the shifted lanes (BytesPerLane bytes ea...
SelectInst * getBlendedLoadSelect(ArrayRef< Value * > VL)
Returns the select instruction picking between the candidate base pointers of the blended loads VL.
static std::optional< std::tuple< Value *, unsigned, unsigned > > matchExtractedField(Value *V)
Checks if V is a zero-extended sub-field of a wider integer scalar.
bool allSameType(ArrayRef< Value * > VL)
bool dominatesAllUses(const DominatorTree &DT, const Instruction &InsertPt, const Instruction &I)
void combineOrders(MutableArrayRef< unsigned > Order, ArrayRef< unsigned > SecondaryOrder)
Fills unset elements of Order (marked with the sentinel value equal to the order size) with the corre...
bool allSameOpcode(ArrayRef< Value * > VL)
bool isSplat(ArrayRef< Value * > VL)
unsigned getNumElements(Type *Ty)
std::string shortBundleName(ArrayRef< Value * > VL, int Idx)
Print a short descriptor of the instruction bundle suitable for debug output.
unsigned getLoopTripCount(const Loop *L, ScalarEvolution &SE, unsigned LoopAwareTripCount)
bool isOnceUsedSeed(const Instruction *I)
Returns true if I forms a vectorizable bundle on its own and its single user does not tear the vector...
unsigned getPartNumElems(unsigned Size, unsigned NumParts)
Returns power-of-2 number of elements in a single register (part), given the total number of elements...
constexpr unsigned MaxBitPackAnalysisDepth
Deeper than the standard analysis recursion depth to keep the numeric bound precise through arithmeti...
bool isCommutableOperand(const Instruction *I, Value *ValWithUses, unsigned Op, bool IsCopyable)
Checks if the operand is commutative.
Align computeBlendedLoadBaseAlignment(ArrayRef< Value * > VL, const DataLayout &DL)
Returns the alignment of the shared base pointer of a blended load for the loads VL.
TargetTransformInfo::TargetCostKind getSLPCostKind(const Function *F)
bool isReverseOrder(ArrayRef< unsigned > Order)
Check if Order represents reverse order.
Type * getCommonGEPIndexType(ArrayRef< Value * > VL, Instruction *VL0, function_ref< bool(Value *)> IsGEPLane, const DataLayout &DL)
Returns the common type for the indices of the single-index GEP lanes of a GEP node with the main op ...
void transformScalarShuffleIndiciesToVector(unsigned VecTyNumElements, SmallVectorImpl< int > &Mask)
bool areTwoInsertFromSameBuildVector(InsertElementInst *VU, InsertElementInst *V, function_ref< Value *(InsertElementInst *)> GetBaseOperand)
Check if two insertelement instructions are from the same buildvector.
SmallVector< int > calculateShufflevectorMask(ArrayRef< Value * > VL)
SmallBitVector buildUseMask(int VF, ArrayRef< int > Mask, UseMask MaskArg)
Prepares a use bitset for the given mask either for the first argument or for the second.
bool isCommutative(const Instruction *I, const Value *ValWithUses, bool IsCopyable)
template SmallBitVector isUndefVector< false >(const Value *, const SmallBitVector &)
unsigned getNumberOfPotentiallyCommutativeOps(Instruction *I)
bool allConstant(ArrayRef< Value * > VL)
template std::optional< unsigned > getInsertExtractIndex< InsertElementInst >(const Value *, unsigned)
void inversePermutation(ArrayRef< unsigned > Indices, SmallVectorImpl< int > &Mask)
Compute the inverse permutation Mask of Indices.
bool allSameBlock(ArrayRef< Value * > VL)
bool isReassocChainLink(const Instruction *I)
Intrinsic::ID isEquivalentIntrinsicID(Intrinsic::ID LHS, Intrinsic::ID RHS)
Checks if LHS and RHS are the same intrinsic, or one is llvm.fma and the other is llvm....
std::optional< TargetTransformInfo::ShuffleKind > isFixedVectorShuffle(ArrayRef< Value * > VL, SmallVectorImpl< int > &Mask, AssumptionCache *AC, SLPAnalysisCache &Cache)
Checks if the vector of instructions can be represented as a shuffle, like: x0 = extractelement <4 x ...
UseMask
Specifies the way the mask should be analyzed for undefs/poisonous elements in the shuffle mask.
@ SecondArg
The mask is expected to be for permutation of 2 vectors, check for the mask elements for the second a...
@ UndefsAsMask
Consider undef mask elements (-1) as placeholders for future shuffle elements and mark them as ones a...
@ FirstArg
The mask is expected to be for permutation of 1-2 vectors, check for the mask elements for the first ...
void reorderOrder(SmallVectorImpl< unsigned > &Order, ArrayRef< int > Mask, bool BottomOrder)
Reorders the given Order according to the given Mask.
static void collectNarrowedLeavesImpl(Value *V, unsigned RdxOpcode, unsigned WideBW, NarrowedChainState S, unsigned Depth, unsigned MaxDepth, SmallVectorImpl< NarrowedLeafInfo > &Leaves, SmallVectorImpl< Instruction * > &ChainInsts)
void reorderReuses(SmallVectorImpl< int > &Reuses, ArrayRef< int > Mask)
Reorders the given Reuses mask according to the given Mask.
void addMask(SmallVectorImpl< int > &Mask, ArrayRef< int > SubMask, bool ExtendingManyInputs)
Shuffles Mask in accordance with the given SubMask.
bool isSimple(Instruction *I)
Instruction * lookThroughCastRoundTrip(Value *V, bool MustBeElidable)
If V is a single-use fpext of a single-use fptrunc forming a round-trip back to the type of V,...
std::optional< unsigned > getAggregateSize(Instruction *InsertInst)
const LoadInst * getLoadOfUndefTolerantBinOp(const Value *V)
bool isUndefTolerantBinOp(const Value *V)
APInt getScalarMaxValue(const Value *V, unsigned Depth)
Returns a saturating unsigned upper bound of the scalar V.
Value * buildBitPack(IRBuilderBase &Builder, Value *X, const BitPackInfo &Info, Type *ResultTy, unsigned ShiftWidth, unsigned &NumInsts)
Builds the bitfield packing of X into ResultTy per the layout and the shift width.
unsigned getShufflevectorNumGroups(ArrayRef< Value * > VL)
const Loop * findInnermostNonInvariantLoop(const Loop *L, ArrayRef< Value * > VL)
SmallVector< Constant * > replicateMask(ArrayRef< Constant * > Val, unsigned VF)
Replicates the given Val VF times.
unsigned getReassocCombineOpcode(unsigned Opcode)
bool isVectorLikeInstWithConstOps(Value *V)
Checks if V is one of vector-like instructions, i.e.
bool doesNotNeedToBeScheduled(Value *V)
Checks if the specified value does not require scheduling.
unsigned getNumElems(unsigned Size, unsigned PartNumElems, unsigned Part)
Returns correct remaining number of elements, considering total amount Size, (power-of-2 number) of e...
constexpr int UsesLimit
Limit of the number of uses for potentially transformed instructions/values, used in checks to avoid ...
bool isFirstInsertElement(const InsertElementInst *IE1, const InsertElementInst *IE2)
void collectNarrowedLeaves(Value *V, unsigned RdxOpcode, unsigned WideBW, unsigned MaxDepth, SmallVectorImpl< NarrowedLeafInfo > &Leaves, SmallVectorImpl< Instruction * > &ChainInsts)
Recursively collects the narrow leaves of the widened reduction value V.
bool isRepeatedNonIdentityClusteredMask(ArrayRef< int > Mask, unsigned Sz)
Checks if the given mask is a "clustered" mask with the same clusters of size Sz, which are not ident...
bool isConstant(Value *V)
static bool isNonProfitableIndex(const Instruction *I)
Returns true if I is a part of a single-use chain, computing an address, which does not pay off the v...
Value * createExtractVector(IRBuilderBase &Builder, Value *Vec, unsigned SubVecVF, unsigned Index)
Generates subvector extract.
template std::optional< unsigned > getInsertExtractIndex< ExtractElementInst >(const Value *, unsigned)
void fixupOrderingIndices(MutableArrayRef< unsigned > Order)
Order may have elements assigned special value (size) which is out of bounds.
This is an optimization pass for GlobalISel generic memory operations.
constexpr auto not_equal_to(T &&Arg)
Functor variant of std::not_equal_to that can be used as a UnaryPredicate in functional algorithms li...
LLVM_ABI std::optional< unsigned > getLoopEstimatedTripCount(Loop *L, unsigned *EstimatedLoopInvocationWeight=nullptr)
Return either:
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
LLVM_ABI Intrinsic::ID getVectorIntrinsicIDForCall(const CallInst *CI, const TargetLibraryInfo *TLI)
Returns intrinsic ID for call.
LLVM_ABI void findDbgValues(Value *V, SmallVectorImpl< DbgVariableRecord * > &DbgVariableRecords)
Finds the dbg.values describing a value.
@ Unknown
Not known to have no common set bits.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
constexpr from_range_t from_range
auto dyn_cast_if_present(const Y &Val)
dyn_cast_if_present<X> - Functionally identical to dyn_cast, except that a null (or none in the case ...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
bool isVectorizedTy(Type *Ty)
Returns true if Ty is a vector type or a struct of vector types where all vector types share the same...
T bit_ceil(T Value)
Returns the smallest integral power of two no smaller than Value if Value is nonzero.
auto make_isa_range(RangeT &&Range)
Return a range over Range containing only elements for which isa<T> holds, casting each of them to T.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
constexpr unsigned MaxAnalysisRecursionDepth
auto reverse(ContainerTy &&C)
ElementCount getVectorizedTypeVF(Type *Ty)
Returns the number of vector elements for a vectorized type.
auto find_if_not(R &&Range, UnaryPredicate P)
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
MutableArrayRef(T &OneElt) -> MutableArrayRef< T >
constexpr int PoisonMaskElem
iterator_range(Container &&) -> iterator_range< llvm::detail::IterOfRange< Container > >
constexpr T divideCeil(U Numerator, V Denominator)
Returns the integer ceil(Numerator / Denominator).
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
DWARFExpression::Operation Op
constexpr unsigned BitWidth
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
constexpr auto seq(T Begin, T End)
Iterate over an integral type from Begin up to - but not including - End.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
Align commonAlignment(Align A, uint64_t Offset)
Returns the alignment that satisfies both alignments.
bool equal(L &&LRange, R &&RRange)
Wrapper function around std::equal to detect if pair-wise elements between two ranges are the same.
static auto filterDbgVars(iterator_range< simple_ilist< DbgRecord >::iterator > R)
Filter the DbgRecord range to DbgVariableRecord types only and downcast.
LLVM_ABI bool mayHaveNonDefUseDependency(const Instruction &I)
Returns true if the result or effects of the given instructions I depend values not reachable through...
constexpr detail::IsaCheckPredicate< Types... > IsaPred
Function object wrapper for the llvm::isa type check.
This struct is a compact representation of a valid (non-zero power of two) alignment.
Description of a bitfield packing of vector lanes into a scalar value: every lane contributes a disjo...
static constexpr unsigned NoLane
SmallVector< uint64_t, 8 > LShrAmts
Per-lane right-shift amounts bringing the field content to the low bits.