Lines Matching +full:reference +full:- +full:div +full:- +full:factor
1 //===- Instructions.cpp - Implement the LLVM instructions -----------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file implements all of the non-inline methods for the LLVM instruction
12 //===----------------------------------------------------------------------===//
54 "disable-i2p-p2i-opt", cl::init(false),
57 //===----------------------------------------------------------------------===//
59 //===----------------------------------------------------------------------===//
70 checkedMulUnsigned(Size.getKnownMinValue(), C->getZExtValue()); in getAllocationSize()
83 auto CheckedProd = checkedMulUnsigned(Size->getKnownMinValue(), in getAllocationSizeInBits()
87 return TypeSize::get(*CheckedProd, Size->isScalable()); in getAllocationSizeInBits()
90 //===----------------------------------------------------------------------===//
92 //===----------------------------------------------------------------------===//
94 /// areInvalidOperands - Return a string if the specified operands are invalid
97 if (Op1->getType() != Op2->getType()) in areInvalidOperands()
100 if (Op1->getType()->isTokenTy()) in areInvalidOperands()
103 if (VectorType *VT = dyn_cast<VectorType>(Op0->getType())) { in areInvalidOperands()
105 if (VT->getElementType() != Type::getInt1Ty(Op0->getContext())) in areInvalidOperands()
107 VectorType *ET = dyn_cast<VectorType>(Op1->getType()); in areInvalidOperands()
110 if (ET->getElementCount() != VT->getElementCount()) in areInvalidOperands()
113 } else if (Op0->getType() != Type::getInt1Ty(Op0->getContext())) { in areInvalidOperands()
119 //===----------------------------------------------------------------------===//
121 //===----------------------------------------------------------------------===//
132 // removeIncomingValue - Remove an incoming value. This is useful if a
146 Op<-1>().set(nullptr); in removeIncomingValue()
147 setNumHungOffUseOperands(getNumOperands() - 1); in removeIncomingValue()
178 return RemoveIndices.contains(&BB - block_begin()); in removeIncomingValueIf()
181 setNumHungOffUseOperands(getNumOperands() - RemoveIndices.size()); in removeIncomingValueIf()
191 /// growOperands - grow operands - This grows the operand list in response
204 /// hasConstantValue - If the specified PHI node always merges together the same
221 /// hasConstantOrUndefValue - Whether the specified PHI node always merges
223 /// non-undefs.
225 /// unique non-undef incoming value need not dominate the PHI node.
239 //===----------------------------------------------------------------------===//
241 //===----------------------------------------------------------------------===//
277 /// growOperands - grow operands - This grows the operand list in response to a
294 //===----------------------------------------------------------------------===//
296 //===----------------------------------------------------------------------===//
300 switch (CB->getOpcode()) { in Create()
308 llvm_unreachable("Unknown CallBase sub-class!"); in Create()
315 for (unsigned i = 0, e = CI->getNumOperandBundles(); i < e; ++i) { in Create()
316 auto ChildOB = CI->getOperandBundleAt(i); in Create()
324 Function *CallBase::getCaller() { return getParent()->getParent(); } in getCaller()
328 return cast<CallBrInst>(this)->getNumIndirectDests() + 1; in getNumSubclassExtraOperandsDynamic()
342 return CI->isMustTailCall(); in isMustTailCall()
349 return CI->isTailCall(); in isTailCall()
355 return F->getIntrinsicID(); in getIntrinsicID()
363 Mask |= F->getAttributes().getRetNoFPClass(); in getRetNoFPClass()
371 Mask |= F->getAttributes().getParamNoFPClass(i); in getParamNoFPClass()
387 !NullPointerIsDefined(getCaller(), getType()->getPointerAddressSpace())) in isReturnNonNull()
397 return getArgOperand(Index - AttributeList::FirstArgIndex); in getArgOperandWithAttribute()
399 if (F->getAttributes().hasAttrSomewhere(Kind, &Index)) in getArgOperandWithAttribute()
400 return getArgOperand(Index - AttributeList::FirstArgIndex); in getArgOperandWithAttribute()
416 if (!F->getAttributes().hasParamAttr(ArgNo, Kind)) in paramHasAttr()
434 return F->getAttributes().hasFnAttr(Kind); in hasFnAttrOnCalledFunction()
441 return F->getAttributes().hasFnAttr(Kind); in hasFnAttrOnCalledFunction()
449 // getMemoryEffects() correctly combines memory effects from the call-site, in getFnAttrOnCalledFunction()
455 return F->getAttributes().getFnAttr(Kind); in getFnAttrOnCalledFunction()
470 return F->getAttributes().getParamAttr(ArgNo, Kind); in getParamAttrOnCalledFunction()
500 BOI.Tag = ContextImpl->getOrInsertBundleTag(BI->getTag()); in populateBundleOperandInfos()
502 BOI.End = CurrentIndex + BI->input_size(); in populateBundleOperandInfos()
514 /// Else fallback to a binary-search that use the fact that bundles usually in getBundleOpInfoForOperand()
516 if (bundle_op_info_end() - bundle_op_info_begin() < 8) { in getBundleOpInfoForOperand()
525 assert(bundle_op_info_end() - bundle_op_info_begin() > 0 && in getBundleOpInfoForOperand()
526 OpIdx < std::prev(bundle_op_info_end())->End && in getBundleOpInfoForOperand()
539 NumberScaling * (std::prev(End)->End - Begin->Begin) / (End - Begin); in getBundleOpInfoForOperand()
540 Current = Begin + (((OpIdx - Begin->Begin) * NumberScaling) / in getBundleOpInfoForOperand()
546 if (OpIdx >= Current->Begin && OpIdx < Current->End) in getBundleOpInfoForOperand()
548 if (OpIdx >= Current->End) in getBundleOpInfoForOperand()
554 assert(OpIdx >= Current->Begin && OpIdx < Current->End && in getBundleOpInfoForOperand()
562 if (CB->getOperandBundle(ID)) in addOperandBundle()
566 CB->getOperandBundlesAsDefs(Bundles); in addOperandBundle()
576 for (unsigned I = 0, E = CB->getNumOperandBundles(); I != E; ++I) { in removeOperandBundle()
577 auto Bundle = CB->getOperandBundleAt(I); in removeOperandBundle()
590 // bundle semantics, where *any* non-assume operand bundle (other than in hasReadingOperandBundles()
607 MemoryEffects FnME = Fn->getMemoryEffects(); in getMemoryEffects()
675 //===----------------------------------------------------------------------===//
677 //===----------------------------------------------------------------------===//
681 this->FTy = FTy; in init()
686 assert((Args.size() == FTy->getNumParams() || in init()
687 (FTy->isVarArg() && Args.size() > FTy->getNumParams())) && in init()
691 assert((i >= FTy->getNumParams() || in init()
692 FTy->getParamType(i) == Args[i]->getType()) && in init()
696 // Set operands in order of their index to match use-list-order in init()
709 this->FTy = FTy; in init()
713 assert(FTy->getNumParams() == 0 && "Calling a function with bad signature"); in init()
720 : CallBase(Ty->getReturnType(), Instruction::Call, in CallInst()
721 OperandTraits<CallBase>::op_end(this) - 1, 1, InsertBefore) { in CallInst()
727 OperandTraits<CallBase>::op_end(this) - CI.getNumOperands(), in CallInst()
740 std::vector<Value *> Args(CI->arg_begin(), CI->arg_end()); in Create()
742 auto *NewCI = CallInst::Create(CI->getFunctionType(), CI->getCalledOperand(), in Create()
743 Args, OpB, CI->getName(), InsertPt); in Create()
744 NewCI->setTailCallKind(CI->getTailCallKind()); in Create()
745 NewCI->setCallingConv(CI->getCallingConv()); in Create()
746 NewCI->SubclassOptionalData = CI->SubclassOptionalData; in Create()
747 NewCI->setAttributes(CI->getAttributes()); in Create()
748 NewCI->setDebugLoc(CI->getDebugLoc()); in Create()
758 "div by 0. Ignoring. Likely the function " in updateProfWeight()
759 << getParent()->getParent()->getName() in updateProfWeight()
761 "with non-zero prof info."); in updateProfWeight()
767 //===----------------------------------------------------------------------===//
769 //===----------------------------------------------------------------------===//
775 this->FTy = FTy; in init()
782 assert(((Args.size() == FTy->getNumParams()) || in init()
783 (FTy->isVarArg() && Args.size() > FTy->getNumParams())) && in init()
787 assert((i >= FTy->getNumParams() || in init()
788 FTy->getParamType(i) == Args[i]->getType()) && in init()
792 // Set operands in order of their index to match use-list-order in init()
808 OperandTraits<CallBase>::op_end(this) - II.getNumOperands(), in InvokeInst()
819 std::vector<Value *> Args(II->arg_begin(), II->arg_end()); in Create()
822 II->getFunctionType(), II->getCalledOperand(), II->getNormalDest(), in Create()
823 II->getUnwindDest(), Args, OpB, II->getName(), InsertPt); in Create()
824 NewII->setCallingConv(II->getCallingConv()); in Create()
825 NewII->SubclassOptionalData = II->SubclassOptionalData; in Create()
826 NewII->setAttributes(II->getAttributes()); in Create()
827 NewII->setDebugLoc(II->getDebugLoc()); in Create()
832 return cast<LandingPadInst>(getUnwindDest()->getFirstNonPHI()); in getLandingPadInst()
838 "div by 0. Ignoring. Likely the function " in updateProfWeight()
839 << getParent()->getParent()->getName() in updateProfWeight()
841 "with non-zero prof info."); in updateProfWeight()
847 //===----------------------------------------------------------------------===//
849 //===----------------------------------------------------------------------===//
856 this->FTy = FTy; in init()
864 assert(((Args.size() == FTy->getNumParams()) || in init()
865 (FTy->isVarArg() && Args.size() > FTy->getNumParams())) && in init()
869 assert((i >= FTy->getNumParams() || in init()
870 FTy->getParamType(i) == Args[i]->getType()) && in init()
874 // Set operands in order of their index to match use-list-order in init()
892 OperandTraits<CallBase>::op_end(this) - CBI.getNumOperands(), in CallBrInst()
904 std::vector<Value *> Args(CBI->arg_begin(), CBI->arg_end()); in Create()
907 CBI->getFunctionType(), CBI->getCalledOperand(), CBI->getDefaultDest(), in Create()
908 CBI->getIndirectDests(), Args, OpB, CBI->getName(), InsertPt); in Create()
909 NewCBI->setCallingConv(CBI->getCallingConv()); in Create()
910 NewCBI->SubclassOptionalData = CBI->SubclassOptionalData; in Create()
911 NewCBI->setAttributes(CBI->getAttributes()); in Create()
912 NewCBI->setDebugLoc(CBI->getDebugLoc()); in Create()
913 NewCBI->NumIndirectDests = CBI->NumIndirectDests; in Create()
917 //===----------------------------------------------------------------------===//
919 //===----------------------------------------------------------------------===//
923 OperandTraits<ReturnInst>::op_end(this) - RI.getNumOperands(), in ReturnInst()
933 OperandTraits<ReturnInst>::op_end(this) - !!retVal, !!retVal, in ReturnInst()
939 //===----------------------------------------------------------------------===//
941 //===----------------------------------------------------------------------===//
950 : Instruction(Type::getVoidTy(Exn->getContext()), Instruction::Resume, in ResumeInst()
955 //===----------------------------------------------------------------------===//
957 //===----------------------------------------------------------------------===//
961 OperandTraits<CleanupReturnInst>::op_end(this) - in CleanupReturnInst()
983 : Instruction(Type::getVoidTy(CleanupPad->getContext()), in CleanupReturnInst()
985 OperandTraits<CleanupReturnInst>::op_end(this) - Values, in CleanupReturnInst()
990 //===----------------------------------------------------------------------===//
992 //===----------------------------------------------------------------------===//
1007 : Instruction(Type::getVoidTy(BB->getContext()), Instruction::CatchRet, in CatchReturnInst()
1013 //===----------------------------------------------------------------------===//
1015 //===----------------------------------------------------------------------===//
1021 : Instruction(ParentPad->getType(), Instruction::CatchSwitch, nullptr, 0, in CatchSwitchInst()
1055 /// growOperands - grow operands - This grows the operand list in response to a
1076 Use *EndDst = op_end() - 1; in removeHandler()
1082 setNumHungOffUseOperands(getNumOperands() - 1); in removeHandler()
1085 //===----------------------------------------------------------------------===//
1087 //===----------------------------------------------------------------------===//
1098 OperandTraits<FuncletPadInst>::op_end(this) - in FuncletPadInst()
1109 : Instruction(ParentPad->getType(), Op, in FuncletPadInst()
1110 OperandTraits<FuncletPadInst>::op_end(this) - Values, Values, in FuncletPadInst()
1115 //===----------------------------------------------------------------------===//
1117 //===----------------------------------------------------------------------===//
1124 //===----------------------------------------------------------------------===//
1126 //===----------------------------------------------------------------------===//
1130 assert(getCondition()->getType()->isIntegerTy(1) && in AssertOK()
1135 : Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br, in BranchInst()
1136 OperandTraits<BranchInst>::op_end(this) - 1, 1, in BranchInst()
1139 Op<-1>() = IfTrue; in BranchInst()
1144 : Instruction(Type::getVoidTy(IfTrue->getContext()), Instruction::Br, in BranchInst()
1145 OperandTraits<BranchInst>::op_end(this) - 3, 3, in BranchInst()
1147 // Assign in order of operand index to make use-list order predictable. in BranchInst()
1148 Op<-3>() = Cond; in BranchInst()
1149 Op<-2>() = IfFalse; in BranchInst()
1150 Op<-1>() = IfTrue; in BranchInst()
1158 OperandTraits<BranchInst>::op_end(this) - BI.getNumOperands(), in BranchInst()
1160 // Assign in order of operand index to make use-list order predictable. in BranchInst()
1163 Op<-3>() = BI.Op<-3>(); in BranchInst()
1164 Op<-2>() = BI.Op<-2>(); in BranchInst()
1166 Op<-1>() = BI.Op<-1>(); in BranchInst()
1173 Op<-1>().swap(Op<-2>()); in swapSuccessors()
1180 //===----------------------------------------------------------------------===//
1182 //===----------------------------------------------------------------------===//
1190 assert(Amt->getType()->isIntegerTy() && in getAISize()
1200 assert(BB->getParent() && in computeAllocaDefaultAlign()
1202 const DataLayout &DL = BB->getDataLayout(); in computeAllocaDefaultAlign()
1220 getAISize(Ty->getContext(), ArraySize), InsertBefore), in AllocaInst()
1223 assert(!Ty->isVoidTy() && "Cannot allocate void!"); in AllocaInst()
1229 return !CI->isOne(); in isArrayAllocation()
1233 /// isStaticAlloca - Return true if this alloca is in the entry block of the
1242 return Parent->isEntryBlock() && !isUsedWithInAlloca(); in isStaticAlloca()
1245 //===----------------------------------------------------------------------===//
1247 //===----------------------------------------------------------------------===//
1250 assert(getOperand(0)->getType()->isPointerTy() && in AssertOK()
1258 assert(BB->getParent() && in computeLoadStoreDefaultAlign()
1260 const DataLayout &DL = BB->getDataLayout(); in computeLoadStoreDefaultAlign()
1289 //===----------------------------------------------------------------------===//
1291 //===----------------------------------------------------------------------===//
1294 assert(getOperand(0) && getOperand(1) && "Both operands must be non-null!"); in AssertOK()
1295 assert(getOperand(1)->getType()->isPointerTy() && in AssertOK()
1305 computeLoadStoreDefaultAlign(val->getType(), InsertBefore), in StoreInst()
1316 : Instruction(Type::getVoidTy(val->getContext()), Store, in StoreInst()
1327 //===----------------------------------------------------------------------===//
1329 //===----------------------------------------------------------------------===//
1344 "All operands must be non-null!"); in Init()
1345 assert(getOperand(0)->getType()->isPointerTy() && in Init()
1347 assert(getOperand(1)->getType() == getOperand(2)->getType() && in Init()
1358 StructType::get(Cmp->getType(), Type::getInt1Ty(Cmp->getContext())), in AtomicCmpXchgInst()
1364 //===----------------------------------------------------------------------===//
1366 //===----------------------------------------------------------------------===//
1382 assert(getOperand(0) && getOperand(1) && "All operands must be non-null!"); in Init()
1383 assert(getOperand(0)->getType()->isPointerTy() && in Init()
1392 : Instruction(Val->getType(), AtomicRMW, in AtomicRMWInst()
1441 //===----------------------------------------------------------------------===//
1443 //===----------------------------------------------------------------------===//
1452 //===----------------------------------------------------------------------===//
1454 //===----------------------------------------------------------------------===//
1467 OperandTraits<GetElementPtrInst>::op_end(this) - in GetElementPtrInst()
1478 if (!Struct->indexValid(Idx)) in getTypeAtIndex()
1480 return Struct->getTypeAtIndex(Idx); in getTypeAtIndex()
1482 if (!Idx->getType()->isIntOrIntVectorTy()) in getTypeAtIndex()
1485 return Array->getElementType(); in getTypeAtIndex()
1487 return Vector->getElementType(); in getTypeAtIndex()
1493 if (Idx >= Struct->getNumElements()) in getTypeAtIndex()
1495 return Struct->getElementType(Idx); in getTypeAtIndex()
1498 return Array->getElementType(); in getTypeAtIndex()
1500 return Vector->getElementType(); in getTypeAtIndex()
1529 /// hasAllZeroIndices - Return true if all of the indices of this GEP are
1535 if (!CI->isZero()) return false; in hasAllZeroIndices()
1543 /// hasAllConstantIndices - Return true if all of the indices of this GEP are
1559 GEPNoWrapFlags NW = cast<GEPOperator>(this)->getNoWrapFlags(); in setIsInBounds()
1568 return cast<GEPOperator>(this)->getNoWrapFlags(); in getNoWrapFlags()
1572 return cast<GEPOperator>(this)->isInBounds(); in isInBounds()
1576 return cast<GEPOperator>(this)->hasNoUnsignedSignedWrap(); in hasNoUnsignedSignedWrap()
1580 return cast<GEPOperator>(this)->hasNoUnsignedWrap(); in hasNoUnsignedWrap()
1586 return cast<GEPOperator>(this)->accumulateConstantOffset(DL, Offset); in accumulateConstantOffset()
1594 return cast<GEPOperator>(this)->collectOffset(DL, BitWidth, VariableOffsets, in collectOffset()
1598 //===----------------------------------------------------------------------===//
1600 //===----------------------------------------------------------------------===//
1606 cast<VectorType>(Val->getType())->getElementType(), ExtractElement, in ExtractElementInst()
1616 if (!Val->getType()->isVectorTy() || !Index->getType()->isIntegerTy()) in isValidOperands()
1621 //===----------------------------------------------------------------------===//
1623 //===----------------------------------------------------------------------===//
1628 : Instruction(Vec->getType(), InsertElement, in InsertElementInst()
1641 if (!Vec->getType()->isVectorTy()) in isValidOperands()
1644 if (Elt->getType() != cast<VectorType>(Vec->getType())->getElementType()) in isValidOperands()
1647 if (!Index->getType()->isIntegerTy()) in isValidOperands()
1652 //===----------------------------------------------------------------------===//
1654 //===----------------------------------------------------------------------===//
1658 return PoisonValue::get(V->getType()); in createPlaceholderForShuffleVector()
1676 VectorType::get(cast<VectorType>(V1->getType())->getElementType(), in ShuffleVectorInst()
1677 cast<VectorType>(Mask->getType())->getElementCount()), in ShuffleVectorInst()
1695 VectorType::get(cast<VectorType>(V1->getType())->getElementType(), in ShuffleVectorInst()
1696 Mask.size(), isa<ScalableVectorType>(V1->getType())), in ShuffleVectorInst()
1708 int NumOpElts = cast<FixedVectorType>(Op<0>()->getType())->getNumElements(); in commute()
1717 assert(MaskElt >= 0 && MaskElt < 2 * NumOpElts && "Out-of-range mask"); in commute()
1718 MaskElt = (MaskElt < NumOpElts) ? MaskElt + NumOpElts : MaskElt - NumOpElts; in commute()
1728 if (!isa<VectorType>(V1->getType()) || V1->getType() != V2->getType()) in isValidOperands()
1733 cast<VectorType>(V1->getType())->getElementCount().getKnownMinValue(); in isValidOperands()
1738 if (isa<ScalableVectorType>(V1->getType())) in isValidOperands()
1748 if (!V1->getType()->isVectorTy() || V1->getType() != V2->getType()) in isValidOperands()
1753 auto *MaskTy = dyn_cast<VectorType>(Mask->getType()); in isValidOperands()
1754 if (!MaskTy || !MaskTy->getElementType()->isIntegerTy(32) || in isValidOperands()
1755 isa<ScalableVectorType>(MaskTy) != isa<ScalableVectorType>(V1->getType())) in isValidOperands()
1763 unsigned V1Size = cast<FixedVectorType>(V1->getType())->getNumElements(); in isValidOperands()
1764 for (Value *Op : MV->operands()) { in isValidOperands()
1766 if (CI->uge(V1Size*2)) in isValidOperands()
1776 unsigned V1Size = cast<FixedVectorType>(V1->getType())->getNumElements(); in isValidOperands()
1777 for (unsigned i = 0, e = cast<FixedVectorType>(MaskTy)->getNumElements(); in isValidOperands()
1779 if (CDS->getElementAsInteger(i) >= V1Size*2) in isValidOperands()
1789 ElementCount EC = cast<VectorType>(Mask->getType())->getElementCount(); in getShuffleMask()
1801 int MaskVal = isa<UndefValue>(Mask) ? -1 : 0; in getShuffleMask()
1811 Result.push_back(CDS->getElementAsInteger(i)); in getShuffleMask()
1815 Constant *C = Mask->getAggregateElement(i); in getShuffleMask()
1816 Result.push_back(isa<UndefValue>(C) ? -1 : in getShuffleMask()
1817 cast<ConstantInt>(C)->getZExtValue()); in getShuffleMask()
1828 Type *Int32Ty = Type::getInt32Ty(ResultTy->getContext()); in convertShuffleMaskForBitcode()
1851 if (I == -1) in isSingleSourceMaskImpl()
1854 "Out-of-bounds shuffle mask element"); in isSingleSourceMaskImpl()
1874 if (Mask[i] == -1) in isIdentityMaskImpl()
1901 if (Mask[I] == -1) in isReverseMask()
1903 if (Mask[I] != (NumSrcElts - 1 - I) && in isReverseMask()
1904 Mask[I] != (NumSrcElts + NumSrcElts - 1 - I)) in isReverseMask()
1916 if (Mask[I] == -1) in isZeroEltSplatMask()
1931 if (Mask[I] == -1) in isSelectMask()
1948 // 1. The number of elements in the mask must be a power-of-2 and at least 2. in isTransposeMask()
1959 if ((Mask[1] - Mask[0]) != NumSrcElts) in isTransposeMask()
1962 // 4. The difference between consecutive even-numbered and odd-numbered in isTransposeMask()
1966 if (MaskEltVal == -1) in isTransposeMask()
1968 int MaskEltPrevVal = Mask[I - 2]; in isTransposeMask()
1969 if (MaskEltVal - MaskEltPrevVal != 2) in isTransposeMask()
1980 int StartIndex = -1; in isSpliceMask()
1983 if (MaskEltVal == -1) in isSpliceMask()
1986 if (StartIndex == -1) { in isSpliceMask()
1988 // first non-undef index would access below the StartIndex. in isSpliceMask()
1989 if (MaskEltVal < I || NumSrcElts <= (MaskEltVal - I)) in isSpliceMask()
1992 StartIndex = MaskEltVal - I; in isSpliceMask()
2001 if (StartIndex == -1) in isSpliceMask()
2020 int SubIndex = -1; in isExtractSubvectorMask()
2025 int Offset = (M % NumSrcElts) - i; in isExtractSubvectorMask()
2047 // TODO: We don't recognize self-insertion/widening. in isInsertSubvectorMask()
2075 "2-source shuffle not found"); in isInsertSubvectorMask()
2081 int Src0Hi = NumMaskElts - Src0Elts.countl_zero(); in isInsertSubvectorMask()
2082 int Src1Hi = NumMaskElts - Src1Elts.countl_zero(); in isInsertSubvectorMask()
2087 int NumSub1Elts = Src1Hi - Src1Lo; in isInsertSubvectorMask()
2099 int NumSub0Elts = Src0Hi - Src0Lo; in isInsertSubvectorMask()
2117 int NumOpElts = cast<FixedVectorType>(Op<0>()->getType())->getNumElements(); in isIdentityWithPadding()
2118 int NumMaskElts = cast<FixedVectorType>(getType())->getNumElements(); in isIdentityWithPadding()
2129 if (Mask[i] != -1) in isIdentityWithPadding()
2141 int NumOpElts = cast<FixedVectorType>(Op<0>()->getType())->getNumElements(); in isIdentityWithExtract()
2142 int NumMaskElts = cast<FixedVectorType>(getType())->getNumElements(); in isIdentityWithExtract()
2159 int NumOpElts = cast<FixedVectorType>(Op<0>()->getType())->getNumElements(); in isConcat()
2160 int NumMaskElts = cast<FixedVectorType>(getType())->getNumElements(); in isConcat()
2193 // undef-less case is trivial. in isReplicationMask()
2204 // and pick one. There are bounds on replication factor: [1, mask size] in isReplicationMask()
2206 // Additionally, mask size is a replication factor multiplied by vector size, in isReplicationMask()
2210 int Largest = -1; in isReplicationMask()
2214 // Elements must be in non-decreasing order. in isReplicationMask()
2220 // Prefer larger replication factor if all else equal. in isReplicationMask()
2244 VF = cast<FixedVectorType>(Op<0>()->getType())->getNumElements(); in isReplicationMask()
2283 bool ShuffleVectorInst::isInterleave(unsigned Factor) { in isInterleave() argument
2284 FixedVectorType *OpTy = dyn_cast<FixedVectorType>(getOperand(0)->getType()); in isInterleave()
2285 // shuffle_vector can only interleave fixed length vectors - for scalable in isInterleave()
2289 unsigned OpNumElts = OpTy->getNumElements(); in isInterleave()
2291 return isInterleaveMask(ShuffleMask, Factor, OpNumElts * 2); in isInterleave()
2295 ArrayRef<int> Mask, unsigned Factor, unsigned NumInputElts, in isInterleaveMask() argument
2298 if (NumElts % Factor) in isInterleaveMask()
2301 unsigned LaneLen = NumElts / Factor; in isInterleaveMask()
2305 StartIndexes.resize(Factor); in isInterleaveMask()
2311 for (; I < Factor; I++) { in isInterleaveMask()
2316 for (J = 0; J < LaneLen - 1; J++) { in isInterleaveMask()
2318 unsigned Lane = J * Factor + I; in isInterleaveMask()
2319 unsigned NextLane = Lane + Factor; in isInterleaveMask()
2328 // If the next value is undef, save the current one as reference in isInterleaveMask()
2336 // Verify this by storing the last non-undef followed by an undef in isInterleaveMask()
2337 // Check that following non-undef masks are incremented with the in isInterleaveMask()
2347 if (J < LaneLen - 1) in isInterleaveMask()
2354 } else if (Mask[(LaneLen - 1) * Factor + I] >= 0) { in isInterleaveMask()
2356 StartMask = Mask[(LaneLen - 1) * Factor + I] - J; in isInterleaveMask()
2358 // StartMask defined by some non-zero value in the j loop in isInterleaveMask()
2359 StartMask = SavedLaneValue - (LaneLen - 1 - SavedNoUndefs); in isInterleaveMask()
2375 /// Check if the mask is a DE-interleave mask of the given factor
2376 /// \p Factor like:
2377 /// <Index, Index+Factor, ..., Index+(NumElts-1)*Factor>
2379 unsigned Factor, in isDeInterleaveMaskOfFactor() argument
2381 // Check all potential start indices from 0 to (Factor - 1). in isDeInterleaveMaskOfFactor()
2382 for (unsigned Idx = 0; Idx < Factor; Idx++) { in isDeInterleaveMaskOfFactor()
2385 // Check that elements are in ascending order by Factor. Ignore undef in isDeInterleaveMaskOfFactor()
2388 if (Mask[I] >= 0 && static_cast<unsigned>(Mask[I]) != Idx + I * Factor) in isDeInterleaveMaskOfFactor()
2403 /// Returns an element-wise left bit rotation amount or -1 if failed.
2408 int RotateAmt = -1; in matchShuffleAsBitRotate()
2415 return -1; in matchShuffleAsBitRotate()
2416 int Offset = (NumSubElts - (M - (i + j))) % NumSubElts; in matchShuffleAsBitRotate()
2418 return -1; in matchShuffleAsBitRotate()
2439 //===----------------------------------------------------------------------===//
2441 //===----------------------------------------------------------------------===//
2453 assert(ExtractValueInst::getIndexedType(Agg->getType(), Idxs) == in init()
2454 Val->getType() && "Inserted value must match indexed type!"); in init()
2471 //===----------------------------------------------------------------------===//
2473 //===----------------------------------------------------------------------===//
2492 // getIndexedType - Returns the type of the element that would be extracted
2503 // out-of-bounds indices. Since we don't allow those for extractvalue and in getIndexedType()
2508 if (Index >= AT->getNumElements()) in getIndexedType()
2510 Agg = AT->getElementType(); in getIndexedType()
2512 if (Index >= ST->getNumElements()) in getIndexedType()
2514 Agg = ST->getElementType(Index); in getIndexedType()
2523 //===----------------------------------------------------------------------===//
2525 //===----------------------------------------------------------------------===//
2537 return new UnaryOperator(Op, S, S->getType(), Name, InsertBefore); in Create()
2546 assert(getType() == LHS->getType() && in AssertOK()
2548 assert(getType()->isFPOrFPVectorTy() && in AssertOK()
2549 "Tried to create a floating-point operation on a " in AssertOK()
2550 "non-floating-point type!"); in AssertOK()
2557 //===----------------------------------------------------------------------===//
2559 //===----------------------------------------------------------------------===//
2574 assert(LHS->getType() == RHS->getType() && in AssertOK()
2580 assert(getType() == LHS->getType() && in AssertOK()
2582 assert(getType()->isIntOrIntVectorTy() && in AssertOK()
2583 "Tried to create an integer operation on a non-integer type!"); in AssertOK()
2587 assert(getType() == LHS->getType() && in AssertOK()
2589 assert(getType()->isFPOrFPVectorTy() && in AssertOK()
2590 "Tried to create a floating-point operation on a " in AssertOK()
2591 "non-floating-point type!"); in AssertOK()
2595 assert(getType() == LHS->getType() && in AssertOK()
2597 assert(getType()->isIntOrIntVectorTy() && in AssertOK()
2601 assert(getType() == LHS->getType() && in AssertOK()
2603 assert(getType()->isFPOrFPVectorTy() && in AssertOK()
2608 assert(getType() == LHS->getType() && in AssertOK()
2610 assert(getType()->isIntOrIntVectorTy() && in AssertOK()
2614 assert(getType() == LHS->getType() && in AssertOK()
2616 assert(getType()->isFPOrFPVectorTy() && in AssertOK()
2622 assert(getType() == LHS->getType() && in AssertOK()
2624 assert(getType()->isIntOrIntVectorTy() && in AssertOK()
2625 "Tried to create a shift operation on a non-integral type!"); in AssertOK()
2629 assert(getType() == LHS->getType() && in AssertOK()
2631 assert(getType()->isIntOrIntVectorTy() && in AssertOK()
2632 "Tried to create a logical operation on a non-integral type!"); in AssertOK()
2642 assert(S1->getType() == S2->getType() && in Create()
2644 return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertBefore); in Create()
2649 Value *Zero = ConstantInt::get(Op->getType(), 0); in CreateNeg()
2650 return new BinaryOperator(Instruction::Sub, Zero, Op, Op->getType(), Name, in CreateNeg()
2656 Value *Zero = ConstantInt::get(Op->getType(), 0); in CreateNSWNeg()
2662 Constant *C = Constant::getAllOnesValue(Op->getType()); in CreateNot()
2664 Op->getType(), Name, InsertBefore); in CreateNot()
2669 // instruction. If the instruction is order-dependent (SetLT f.e.), the opcode
2678 //===----------------------------------------------------------------------===//
2680 //===----------------------------------------------------------------------===//
2684 cast<Instruction>(this)->getMetadata(LLVMContext::MD_fpmath); in getFPAccuracy()
2687 ConstantFP *Accuracy = mdconst::extract<ConstantFP>(MD->getOperand(0)); in getFPAccuracy()
2688 return Accuracy->getValueAPF().convertToFloat(); in getFPAccuracy()
2691 //===----------------------------------------------------------------------===//
2693 //===----------------------------------------------------------------------===//
2695 // Just determine if this cast only deals with integral->integral conversion.
2704 return getOperand(0)->getType()->isIntegerTy() && in isIntegerCast()
2705 getType()->isIntegerTy(); in isIntegerCast()
2711 /// no code gen is necessary for the cast, hence the name no-op cast. For
2712 /// example, the following are all no-op casts:
2715 /// # ptrtoint i32* %x to i32 ; on 32-bit plaforms only
2716 /// Determine if the described cast is a no-op.
2739 return DL.getIntPtrType(SrcTy)->getScalarSizeInBits() == in isNoopCast()
2740 DestTy->getScalarSizeInBits(); in isNoopCast()
2742 return DL.getIntPtrType(DestTy)->getScalarSizeInBits() == in isNoopCast()
2743 SrcTy->getScalarSizeInBits(); in isNoopCast()
2748 return isNoopCast(getOpcode(), getOperand(0)->getType(), getType(), DL); in isNoopCast()
2771 // -------- ------------ ------------------- --------------------- in isEliminableCastPair()
2786 // NOTE: some transforms are safe, but we consider them to be non-profitable. in isEliminableCastPair()
2789 // of the produced value (we no longer know the top-part is all zeros). in isEliminableCastPair()
2794 Instruction::CastOpsEnd - Instruction::CastOpsBegin; in isEliminableCastPair()
2796 // T F F U S F F P I B A -+ in isEliminableCastPair()
2798 // U E E 2 2 2 2 R E I T C C +- secondOp in isEliminableCastPair()
2800 // C T T I I P P C T T P T T -+ in isEliminableCastPair()
2801 { 1, 0, 0,99,99, 0, 0,99,99,99, 0, 3, 0}, // Trunc -+ in isEliminableCastPair()
2806 { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0}, // UIToFP +- firstOp in isEliminableCastPair()
2813 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,13,12}, // AddrSpaceCast -+ in isEliminableCastPair()
2824 // Check if any of the casts convert scalars <-> vectors. in isEliminableCastPair()
2830 int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin] in isEliminableCastPair()
2831 [secondOp-Instruction::CastOpsBegin]; in isEliminableCastPair()
2843 // No-op cast in second op implies firstOp as long as the DestTy in isEliminableCastPair()
2845 // non-vector type. in isEliminableCastPair()
2846 if (!SrcTy->isVectorTy() && DstTy->isIntegerTy()) in isEliminableCastPair()
2850 // No-op cast in second op implies firstOp as long as the DestTy in isEliminableCastPair()
2856 // No-op cast in first op implies secondOp as long as the SrcTy in isEliminableCastPair()
2858 if (SrcTy->isIntegerTy()) in isEliminableCastPair()
2867 if (SrcTy->getPointerAddressSpace() != DstTy->getPointerAddressSpace()) in isEliminableCastPair()
2870 unsigned MidSize = MidTy->getScalarSizeInBits(); in isEliminableCastPair()
2878 // ptrtoint, inttoptr -> bitcast (ptr -> ptr) if int size is >= ptr size. in isEliminableCastPair()
2881 unsigned PtrSize = SrcIntPtrTy->getScalarSizeInBits(); in isEliminableCastPair()
2887 // ext, trunc -> bitcast, if the SrcTy and DstTy are the same in isEliminableCastPair()
2888 // ext, trunc -> ext, if sizeof(SrcTy) < sizeof(DstTy) in isEliminableCastPair()
2889 // ext, trunc -> trunc, if sizeof(SrcTy) > sizeof(DstTy) in isEliminableCastPair()
2890 unsigned SrcSize = SrcTy->getScalarSizeInBits(); in isEliminableCastPair()
2891 unsigned DstSize = DstTy->getScalarSizeInBits(); in isEliminableCastPair()
2901 // zext, sext -> zext, because sext can't sign extend after zext in isEliminableCastPair()
2904 // inttoptr, ptrtoint -> bitcast if SrcSize<=PtrSize and SrcSize==DstSize in isEliminableCastPair()
2907 unsigned PtrSize = MidIntPtrTy->getScalarSizeInBits(); in isEliminableCastPair()
2908 unsigned SrcSize = SrcTy->getScalarSizeInBits(); in isEliminableCastPair()
2909 unsigned DstSize = DstTy->getScalarSizeInBits(); in isEliminableCastPair()
2915 // addrspacecast, addrspacecast -> bitcast, if SrcAS == DstAS in isEliminableCastPair()
2916 // addrspacecast, addrspacecast -> addrspacecast, if SrcAS != DstAS in isEliminableCastPair()
2917 if (SrcTy->getPointerAddressSpace() != DstTy->getPointerAddressSpace()) in isEliminableCastPair()
2925 SrcTy->isPtrOrPtrVectorTy() && in isEliminableCastPair()
2926 MidTy->isPtrOrPtrVectorTy() && in isEliminableCastPair()
2927 DstTy->isPtrOrPtrVectorTy() && in isEliminableCastPair()
2928 SrcTy->getPointerAddressSpace() != MidTy->getPointerAddressSpace() && in isEliminableCastPair()
2929 MidTy->getPointerAddressSpace() == DstTy->getPointerAddressSpace() && in isEliminableCastPair()
2934 // bitcast, addrspacecast -> addrspacecast in isEliminableCastPair()
2941 SrcTy->isIntOrIntVectorTy() && in isEliminableCastPair()
2942 MidTy->isPtrOrPtrVectorTy() && in isEliminableCastPair()
2943 DstTy->isPtrOrPtrVectorTy() && in isEliminableCastPair()
2944 MidTy->getPointerAddressSpace() == DstTy->getPointerAddressSpace() && in isEliminableCastPair()
2953 SrcTy->isPtrOrPtrVectorTy() && in isEliminableCastPair()
2954 MidTy->isPtrOrPtrVectorTy() && in isEliminableCastPair()
2955 DstTy->isIntOrIntVectorTy() && in isEliminableCastPair()
2956 SrcTy->getPointerAddressSpace() == MidTy->getPointerAddressSpace() && in isEliminableCastPair()
2961 // (sitofp (zext x)) -> (uitofp x) in isEliminableCastPair()
2999 if (S->getType()->getScalarSizeInBits() == Ty->getScalarSizeInBits()) in CreateZExtOrBitCast()
3006 if (S->getType()->getScalarSizeInBits() == Ty->getScalarSizeInBits()) in CreateSExtOrBitCast()
3013 if (S->getType()->getScalarSizeInBits() == Ty->getScalarSizeInBits()) in CreateTruncOrBitCast()
3021 assert(S->getType()->isPtrOrPtrVectorTy() && "Invalid cast"); in CreatePointerCast()
3022 assert((Ty->isIntOrIntVectorTy() || Ty->isPtrOrPtrVectorTy()) && in CreatePointerCast()
3024 assert(Ty->isVectorTy() == S->getType()->isVectorTy() && "Invalid cast"); in CreatePointerCast()
3025 assert((!Ty->isVectorTy() || in CreatePointerCast()
3026 cast<VectorType>(Ty)->getElementCount() == in CreatePointerCast()
3027 cast<VectorType>(S->getType())->getElementCount()) && in CreatePointerCast()
3030 if (Ty->isIntOrIntVectorTy()) in CreatePointerCast()
3038 assert(S->getType()->isPtrOrPtrVectorTy() && "Invalid cast"); in CreatePointerBitCastOrAddrSpaceCast()
3039 assert(Ty->isPtrOrPtrVectorTy() && "Invalid cast"); in CreatePointerBitCastOrAddrSpaceCast()
3041 if (S->getType()->getPointerAddressSpace() != Ty->getPointerAddressSpace()) in CreatePointerBitCastOrAddrSpaceCast()
3050 if (S->getType()->isPointerTy() && Ty->isIntegerTy()) in CreateBitOrPointerCast()
3052 if (S->getType()->isIntegerTy() && Ty->isPointerTy()) in CreateBitOrPointerCast()
3061 assert(C->getType()->isIntOrIntVectorTy() && Ty->isIntOrIntVectorTy() && in CreateIntegerCast()
3063 unsigned SrcBits = C->getType()->getScalarSizeInBits(); in CreateIntegerCast()
3064 unsigned DstBits = Ty->getScalarSizeInBits(); in CreateIntegerCast()
3074 assert(C->getType()->isFPOrFPVectorTy() && Ty->isFPOrFPVectorTy() && in CreateFPCast()
3076 unsigned SrcBits = C->getType()->getScalarSizeInBits(); in CreateFPCast()
3077 unsigned DstBits = Ty->getScalarSizeInBits(); in CreateFPCast()
3078 assert((C->getType() == Ty || SrcBits != DstBits) && "Invalid cast"); in CreateFPCast()
3086 if (!SrcTy->isFirstClassType() || !DestTy->isFirstClassType()) in isBitCastable()
3094 if (SrcVecTy->getElementCount() == DestVecTy->getElementCount()) { in isBitCastable()
3096 SrcTy = SrcVecTy->getElementType(); in isBitCastable()
3097 DestTy = DestVecTy->getElementType(); in isBitCastable()
3104 return SrcPtrTy->getAddressSpace() == DestPtrTy->getAddressSpace(); in isBitCastable()
3108 TypeSize SrcBits = SrcTy->getPrimitiveSizeInBits(); // 0 for ptr in isBitCastable()
3109 TypeSize DestBits = DestTy->getPrimitiveSizeInBits(); // 0 for ptr in isBitCastable()
3119 if (DestTy->isX86_MMXTy() || SrcTy->isX86_MMXTy()) in isBitCastable()
3127 // ptrtoint and inttoptr are not allowed on non-integral pointers in isBitOrNoopPointerCastable()
3130 return (IntTy->getBitWidth() == DL.getPointerTypeSizeInBits(PtrTy) && in isBitOrNoopPointerCastable()
3134 return (IntTy->getBitWidth() == DL.getPointerTypeSizeInBits(PtrTy) && in isBitOrNoopPointerCastable()
3149 Type *SrcTy = Src->getType(); in getCastOpcode()
3151 assert(SrcTy->isFirstClassType() && DestTy->isFirstClassType() && in getCastOpcode()
3160 if (SrcVecTy->getElementCount() == DestVecTy->getElementCount()) { in getCastOpcode()
3163 SrcTy = SrcVecTy->getElementType(); in getCastOpcode()
3164 DestTy = DestVecTy->getElementType(); in getCastOpcode()
3168 unsigned SrcBits = SrcTy->getPrimitiveSizeInBits(); // 0 for ptr in getCastOpcode()
3169 unsigned DestBits = DestTy->getPrimitiveSizeInBits(); // 0 for ptr in getCastOpcode()
3172 if (DestTy->isIntegerTy()) { // Casting to integral in getCastOpcode()
3173 if (SrcTy->isIntegerTy()) { // Casting from integral in getCastOpcode()
3175 return Trunc; // int -> smaller int in getCastOpcode()
3178 return SExt; // signed -> SEXT in getCastOpcode()
3180 return ZExt; // unsigned -> ZEXT in getCastOpcode()
3182 return BitCast; // Same size, No-op cast in getCastOpcode()
3184 } else if (SrcTy->isFloatingPointTy()) { // Casting from floating pt in getCastOpcode()
3186 return FPToSI; // FP -> sint in getCastOpcode()
3188 return FPToUI; // FP -> uint in getCastOpcode()
3189 } else if (SrcTy->isVectorTy()) { in getCastOpcode()
3192 return BitCast; // Same size, no-op cast in getCastOpcode()
3194 assert(SrcTy->isPointerTy() && in getCastOpcode()
3195 "Casting from a value that is not first-class type"); in getCastOpcode()
3196 return PtrToInt; // ptr -> int in getCastOpcode()
3198 } else if (DestTy->isFloatingPointTy()) { // Casting to floating pt in getCastOpcode()
3199 if (SrcTy->isIntegerTy()) { // Casting from integral in getCastOpcode()
3201 return SIToFP; // sint -> FP in getCastOpcode()
3203 return UIToFP; // uint -> FP in getCastOpcode()
3204 } else if (SrcTy->isFloatingPointTy()) { // Casting from floating pt in getCastOpcode()
3206 return FPTrunc; // FP -> smaller FP in getCastOpcode()
3208 return FPExt; // FP -> larger FP in getCastOpcode()
3210 return BitCast; // same size, no-op cast in getCastOpcode()
3212 } else if (SrcTy->isVectorTy()) { in getCastOpcode()
3215 return BitCast; // same size, no-op cast in getCastOpcode()
3217 llvm_unreachable("Casting pointer or non-first class to float"); in getCastOpcode()
3218 } else if (DestTy->isVectorTy()) { in getCastOpcode()
3222 } else if (DestTy->isPointerTy()) { in getCastOpcode()
3223 if (SrcTy->isPointerTy()) { in getCastOpcode()
3224 if (DestTy->getPointerAddressSpace() != SrcTy->getPointerAddressSpace()) in getCastOpcode()
3226 return BitCast; // ptr -> ptr in getCastOpcode()
3227 } else if (SrcTy->isIntegerTy()) { in getCastOpcode()
3228 return IntToPtr; // int -> ptr in getCastOpcode()
3231 } else if (DestTy->isX86_MMXTy()) { in getCastOpcode()
3232 if (SrcTy->isVectorTy()) { in getCastOpcode()
3234 return BitCast; // 64-bit vector to MMX in getCastOpcode()
3238 llvm_unreachable("Casting to type that is not first-class"); in getCastOpcode()
3241 //===----------------------------------------------------------------------===//
3243 //===----------------------------------------------------------------------===//
3251 if (!SrcTy->isFirstClassType() || !DstTy->isFirstClassType() || in castIsValid()
3252 SrcTy->isAggregateType() || DstTy->isAggregateType()) in castIsValid()
3259 unsigned SrcScalarBitSize = SrcTy->getScalarSizeInBits(); in castIsValid()
3260 unsigned DstScalarBitSize = DstTy->getScalarSizeInBits(); in castIsValid()
3265 ElementCount SrcEC = SrcIsVec ? cast<VectorType>(SrcTy)->getElementCount() in castIsValid()
3267 ElementCount DstEC = DstIsVec ? cast<VectorType>(DstTy)->getElementCount() in castIsValid()
3274 return SrcTy->isIntOrIntVectorTy() && DstTy->isIntOrIntVectorTy() && in castIsValid()
3277 return SrcTy->isIntOrIntVectorTy() && DstTy->isIntOrIntVectorTy() && in castIsValid()
3280 return SrcTy->isIntOrIntVectorTy() && DstTy->isIntOrIntVectorTy() && in castIsValid()
3283 return SrcTy->isFPOrFPVectorTy() && DstTy->isFPOrFPVectorTy() && in castIsValid()
3286 return SrcTy->isFPOrFPVectorTy() && DstTy->isFPOrFPVectorTy() && in castIsValid()
3290 return SrcTy->isIntOrIntVectorTy() && DstTy->isFPOrFPVectorTy() && in castIsValid()
3294 return SrcTy->isFPOrFPVectorTy() && DstTy->isIntOrIntVectorTy() && in castIsValid()
3299 return SrcTy->isPtrOrPtrVectorTy() && DstTy->isIntOrIntVectorTy(); in castIsValid()
3303 return SrcTy->isIntOrIntVectorTy() && DstTy->isPtrOrPtrVectorTy(); in castIsValid()
3305 PointerType *SrcPtrTy = dyn_cast<PointerType>(SrcTy->getScalarType()); in castIsValid()
3306 PointerType *DstPtrTy = dyn_cast<PointerType>(DstTy->getScalarType()); in castIsValid()
3308 // BitCast implies a no-op cast of type only. No bits change. in castIsValid()
3313 // For non-pointer cases, the cast is okay if the source and destination bit in castIsValid()
3316 return SrcTy->getPrimitiveSizeInBits() == DstTy->getPrimitiveSizeInBits(); in castIsValid()
3319 if (SrcPtrTy->getAddressSpace() != DstPtrTy->getAddressSpace()) in castIsValid()
3333 PointerType *SrcPtrTy = dyn_cast<PointerType>(SrcTy->getScalarType()); in castIsValid()
3337 PointerType *DstPtrTy = dyn_cast<PointerType>(DstTy->getScalarType()); in castIsValid()
3341 if (SrcPtrTy->getAddressSpace() == DstPtrTy->getAddressSpace()) in castIsValid()
3427 //===----------------------------------------------------------------------===//
3429 //===----------------------------------------------------------------------===//
3469 Inst->copyIRFlags(FlagsSource); in CreateWithCopiedFlags()
3475 IC->swapOperands(); in swapOperands()
3477 cast<FCmpInst>(this)->swapOperands(); in swapOperands()
3482 return IC->isCommutative(); in isCommutative()
3483 return cast<FCmpInst>(this)->isCommutative(); in isCommutative()
3784 llvm_unreachable("Unexpected non-integer predicate."); in compare()
3831 "Call only with non-equality predicates!"); in getFlippedSignednessPredicate()
3904 //===----------------------------------------------------------------------===//
3906 //===----------------------------------------------------------------------===//
3918 /// SwitchInst ctor - Create a new switch instruction, specifying a value to
3924 : Instruction(Type::getVoidTy(Value->getContext()), Instruction::Switch, in SwitchInst()
3942 /// addCase - Add an entry to the switch instruction...
3957 /// removeCase - This method removes the specified case and its successor
3960 unsigned idx = I->getCaseIndex(); in removeCase()
3969 OL[2 + idx * 2] = OL[NumOps - 2]; in removeCase()
3970 OL[2 + idx * 2 + 1] = OL[NumOps - 1]; in removeCase()
3974 OL[NumOps-2].set(nullptr); in removeCase()
3975 OL[NumOps-2+1].set(nullptr); in removeCase()
3976 setNumHungOffUseOperands(NumOps-2); in removeCase()
3981 /// growOperands - grow operands - This grows the operand list in response
3998 assert(SI.getNumSuccessors() == Weights->size() && in buildProfBranchWeightsMD()
4003 if (AllZeroes || Weights->size() < 2) in buildProfBranchWeightsMD()
4006 return MDBuilder(SI.getParent()->getContext()).createBranchWeights(*Weights); in buildProfBranchWeightsMD()
4022 this->Weights = std::move(Weights); in init()
4028 assert(SI.getNumSuccessors() == Weights->size() && in removeCase()
4034 (*Weights)[I->getCaseIndex() + 1] = Weights->back(); in removeCase()
4035 Weights->pop_back(); in removeCase()
4048 (*Weights)[SI.getNumSuccessors() - 1] = *W; in addCase()
4051 Weights->push_back(W.value_or(0)); in addCase()
4054 assert(SI.getNumSuccessors() == Weights->size() && in addCase()
4063 Weights->resize(0); in eraseFromParent()
4095 if (ProfileData->getNumOperands() == SI.getNumSuccessors() + 1) in getSuccessorWeight()
4096 return mdconst::extract<ConstantInt>(ProfileData->getOperand(idx + 1)) in getSuccessorWeight()
4097 ->getValue() in getSuccessorWeight()
4103 //===----------------------------------------------------------------------===//
4105 //===----------------------------------------------------------------------===//
4108 assert(Address && Address->getType()->isPointerTy() && in init()
4118 /// growOperands - grow operands - This grows the operand list in response
4131 : Instruction(Type::getVoidTy(Address->getContext()), in IndirectBrInst()
4147 /// addDestination - Add a destination.
4159 /// removeDestination - This method removes the specified successor from the
4162 assert(idx < getNumOperands()-1 && "Successor index out of range!"); in removeDestination()
4168 OL[idx+1] = OL[NumOps-1]; in removeDestination()
4171 OL[NumOps-1].set(nullptr); in removeDestination()
4172 setNumHungOffUseOperands(NumOps-1); in removeDestination()
4175 //===----------------------------------------------------------------------===//
4177 //===----------------------------------------------------------------------===//
4180 : UnaryInstruction(S->getType(), Freeze, S, InsertBefore) { in FreezeInst()
4184 //===----------------------------------------------------------------------===//
4186 //===----------------------------------------------------------------------===//
4222 Result->setUsedWithInAlloca(isUsedWithInAlloca()); in cloneImpl()
4223 Result->setSwiftError(isSwiftError()); in cloneImpl()
4241 Result->setVolatile(isVolatile()); in cloneImpl()
4242 Result->setWeak(isWeak()); in cloneImpl()
4250 Result->setVolatile(isVolatile()); in cloneImpl()