43 cl::desc(
"Enable unsafe double to float " 44 "shrinking for math lib calls"));
52 return Func == LibFunc_abs || Func == LibFunc_labs ||
53 Func == LibFunc_llabs || Func == LibFunc_strlen;
73 if (!FuncTy->getReturnType()->isPointerTy() &&
74 !FuncTy->getReturnType()->isIntegerTy() &&
75 !FuncTy->getReturnType()->isVoidTy())
78 for (
auto Param : FuncTy->params()) {
79 if (!Param->isPointerTy() && !Param->isIntegerTy())
91 if (
ICmpInst *IC = dyn_cast<ICmpInst>(U))
92 if (IC->isEquality() && IC->getOperand(1) == With)
102 return OI->getType()->isFloatingPointTy();
113 std::string nptr = Str.
str();
115 long long int Result = strtoll(nptr.c_str(), &End, Base);
142 if (!TLI->
getLibFunc(*InnerCallee, Func) || !TLI->
has(Func) ||
143 Func != LibFunc_fopen)
172 return emitStrLenMemCpy(Src, Dst, Len, B);
175 Value *LibCallSimplifier::emitStrLenMemCpy(
Value *Src,
Value *Dst, uint64_t Len,
203 Len = LengthArg->getZExtValue();
216 if (SrcLen == 0 || Len == 0)
225 return emitStrLenMemCpy(Src, Dst, SrcLen, B);
305 if (HasStr1 && HasStr2)
308 if (HasStr1 && Str1.empty())
312 if (HasStr2 && Str2.empty())
321 std::min(Len1, Len2)),
336 Length = LengthArg->getZExtValue();
351 if (HasStr1 && HasStr2) {
357 if (HasStr1 && Str1.empty())
361 if (HasStr2 && Str2.empty())
427 if (
ConstantInt *LengthArg = dyn_cast<ConstantInt>(LenOp))
428 Len = LengthArg->getZExtValue();
436 if (Len > SrcLen + 1)
468 uint64_t NullTermIdx;
469 if (Slice.
Array ==
nullptr) {
472 NullTermIdx = ~((uint64_t)0);
473 for (uint64_t
I = 0,
E = Slice.
Length;
I <
E; ++
I) {
481 if (NullTermIdx == ~((uint64_t)0))
489 cast<ArrayType>(
GEP->getSourceElementType())->getNumElements();
502 (
GEP->isInBounds() && isa<GlobalVariable>(
GEP->getOperand(0)) &&
503 NullTermIdx == ArrSize - 1)) {
517 if (LenTrue && LenFalse) {
520 <<
"folded strlen(select) to select of constants";
537 return optimizeStringLength(CI, B, 8);
542 unsigned WCharSize = TLI->getWCharSize(M) * 8;
547 return optimizeStringLength(CI, B, WCharSize);
557 if ((HasS1 && S1.
empty()) || (HasS2 && S2.
empty()))
561 if (HasS1 && HasS2) {
571 if (HasS2 && S2.
size() == 1)
579 if (isa<ConstantPointerNull>(EndPtr)) {
595 if ((HasS1 && S1.
empty()) || (HasS2 && S2.
empty()))
599 if (HasS1 && HasS2) {
615 if (HasS1 && S1.
empty())
619 if (HasS1 && HasS2) {
627 if (HasS2 && S2.
empty())
648 ICmpInst *Old = cast<ICmpInst>(*UI++);
652 replaceAllUsesWith(Old, Cmp);
663 if (HasStr2 && ToFindStr.
empty())
667 if (HasStr1 && HasStr2) {
680 if (HasStr2 && ToFindStr.
size() == 1) {
682 return StrChr ? B.CreateBitCast(StrChr, CI->
getType()) :
nullptr;
693 if (LenC && LenC->isZero())
704 Str = Str.
substr(0, LenC->getZExtValue());
717 *std::max_element(reinterpret_cast<const unsigned char *>(Str.
begin()),
718 reinterpret_cast<const unsigned char *>(Str.
end()));
725 if (!DL.fitsInLegalInteger(Max + 1))
733 APInt Bitfield(Width, 0);
735 Bitfield.
setBit((
unsigned char)
C);
786 return B.
CreateSub(LHSV, RHSV,
"chardiff");
794 unsigned PrefAlignment = DL.getPrefTypeAlignment(IntType);
797 Value *LHSV =
nullptr;
798 if (
auto *LHSC = dyn_cast<Constant>(LHS)) {
802 Value *RHSV =
nullptr;
803 if (
auto *RHSC = dyn_cast<Constant>(RHS)) {
819 IntType->
getPointerTo(RHS->getType()->getPointerAddressSpace());
832 if (Len > LHSStr.
size() || Len > RHSStr.
size())
867 if (!FillValue || FillValue->getZExtValue() != 0)
875 if (!Malloc || !Malloc->hasOneUse())
879 Function *InnerCallee = Malloc->getCalledFunction();
885 Func != LibFunc_malloc)
895 const DataLayout &DL = Malloc->getModule()->getDataLayout();
898 Malloc->getArgOperand(0), Malloc->getAttributes(),
904 Malloc->eraseFromParent();
936 if (
FPExtInst *Cast = dyn_cast<FPExtInst>(Val)) {
937 Value *
Op = Cast->getOperand(0);
941 if (
ConstantFP *Const = dyn_cast<ConstantFP>(Val)) {
986 if ((FName.
size() == (CalleeName.
size() + 1)) &&
987 (FName.
back() ==
'f') &&
1085 if (UnsafeFPShrink && Name ==
"cos" && hasFloatVersion(Name))
1101 assert(Exp != 0 &&
"Incorrect exponent 0 not handled");
1103 if (InnerChain[Exp])
1104 return InnerChain[Exp];
1106 static const unsigned AddChain[33][2] = {
1110 {1, 2}, {2, 2}, {2, 3}, {3, 3}, {2, 5}, {4, 4},
1111 {1, 8}, {5, 5}, {1, 10}, {6, 6}, {4, 9}, {7, 7},
1112 {3, 12}, {8, 8}, {8, 9}, {2, 16}, {1, 18}, {10, 10},
1113 {6, 15}, {11, 11}, {3, 20}, {12, 12}, {8, 17}, {13, 13},
1114 {3, 24}, {14, 14}, {4, 25}, {15, 15}, {3, 28}, {16, 16},
1118 getPow(InnerChain, AddChain[Exp][1], B));
1119 return InnerChain[Exp];
1138 if (Pow->
hasFnAttr(Attribute::ReadNone)) {
1140 Intrinsic::sqrt, Ty);
1144 else if (
hasUnaryFloatFn(TLI, Ty, LibFunc_sqrt, LibFunc_sqrtf, LibFunc_sqrtl))
1167 Value *Shrunk =
nullptr;
1170 if (UnsafeFPShrink &&
1171 Name == TLI->getName(LibFunc_pow) && hasFloatVersion(Name))
1191 if (
ConstantFP *BaseC = dyn_cast<ConstantFP>(Base))
1193 if (BaseC->isExactlyValue(10.0) &&
1194 hasUnaryFloatFn(TLI, Ty, LibFunc_exp10, LibFunc_exp10f, LibFunc_exp10l))
1204 if (BaseFn && BaseFn->isFast() && Pow->
isFast()) {
1206 Function *CalleeFn = BaseFn->getCalledFunction();
1207 if (CalleeFn && TLI->getLibFunc(CalleeFn->
getName(), LibFn) &&
1208 (LibFn == LibFunc_exp || LibFn == LibFunc_exp2) && TLI->has(LibFn)) {
1220 if (
Value *Sqrt = replacePowWithSqrt(Pow, B))
1245 hasUnaryFloatFn(TLI, Ty, LibFunc_sqrt, LibFunc_sqrtf, LibFunc_sqrtl)) {
1275 Value *InnerChain[33] = {
nullptr};
1276 InnerChain[1] = Base;
1277 InnerChain[2] = B.
CreateFMul(Base, Base,
"square");
1297 if (UnsafeFPShrink && Name ==
"exp2" && hasFloatVersion(Name))
1303 LibFunc LdExp = LibFunc_ldexpl;
1305 LdExp = LibFunc_ldexpf;
1307 LdExp = LibFunc_ldexp;
1309 if (TLI->has(LdExp)) {
1310 Value *LdExpArg =
nullptr;
1311 if (
SIToFPInst *OpC = dyn_cast<SIToFPInst>(Op)) {
1312 if (OpC->getOperand(0)->getType()->getPrimitiveSizeInBits() <= 32)
1314 }
else if (
UIToFPInst *OpC = dyn_cast<UIToFPInst>(Op)) {
1315 if (OpC->getOperand(0)->getType()->getPrimitiveSizeInBits() < 32)
1343 if ((Name ==
"fmin" || Name ==
"fmax") && hasFloatVersion(Name))
1379 if (UnsafeFPShrink && hasFloatVersion(Name))
1388 if (!OpC || !OpC->isFast())
1393 if (Name !=
"log" && Name !=
"log2" && Name !=
"log10")
1403 if (F && ((TLI->getLibFunc(F->
getName(), Func) && TLI->has(Func) &&
1410 if (F && Name ==
"log" && TLI->getLibFunc(F->
getName(), Func) &&
1411 TLI->has(Func) && Func == LibFunc_exp2)
1413 OpC->getArgOperand(0),
1426 if (TLI->has(LibFunc_sqrtf) && (Callee->
getName() ==
"sqrt" ||
1442 Value *RepeatOp =
nullptr;
1443 Value *OtherOp =
nullptr;
1453 Value *OtherMul0, *OtherMul1;
1456 if (OtherMul0 == OtherMul1 && cast<Instruction>(Op0)->isFast()) {
1458 RepeatOp = OtherMul0;
1493 if (UnsafeFPShrink && Name ==
"tan" && hasFloatVersion(Name))
1502 if (!CI->
isFast() || !OpC->isFast())
1510 if (F && TLI->getLibFunc(F->
getName(), Func) && TLI->has(Func) &&
1511 ((Func == LibFunc_atan && Callee->
getName() ==
"tan") ||
1512 (Func == LibFunc_atanf && Callee->
getName() ==
"tanf") ||
1513 (Func == LibFunc_atanl && Callee->
getName() ==
"tanl")))
1514 Ret = OpC->getArgOperand(0);
1522 return CI->
hasFnAttr(Attribute::NoUnwind) &&
1535 Name =
"__sincospif_stret";
1544 Name =
"__sincospi_stret";
1552 if (
Instruction *ArgInst = dyn_cast<Instruction>(Arg)) {
1555 B.
SetInsertPoint(ArgInst->getParent(), ++ArgInst->getIterator());
1563 SinCos = B.
CreateCall(Callee, Arg,
"sincospi");
1594 classifyArgUse(U, F, IsFloat, SinCalls, CosCalls, SinCosCalls);
1600 Value *Sin, *Cos, *SinCos;
1606 replaceAllUsesWith(
C, Res);
1609 replaceTrigInsts(SinCalls, Sin);
1610 replaceTrigInsts(CosCalls, Cos);
1611 replaceTrigInsts(SinCosCalls, SinCos);
1616 void LibCallSimplifier::classifyArgUse(
1632 if (!Callee || !TLI->getLibFunc(*Callee, Func) || !TLI->has(Func) ||
1637 if (Func == LibFunc_sinpif)
1639 else if (Func == LibFunc_cospif)
1641 else if (Func == LibFunc_sincospif_stret)
1644 if (Func == LibFunc_sinpi)
1646 else if (Func == LibFunc_cospi)
1648 else if (Func == LibFunc_sincospi_stret)
1662 Intrinsic::cttz, ArgType);
1676 Intrinsic::ctlz, ArgType);
1779 return GV->
getName() ==
"stderr";
1789 if (FormatStr.
empty())
1799 if (FormatStr.
size() == 1 || FormatStr ==
"%%")
1807 if (ChrStr.
size() != 1)
1813 if (FormatStr[FormatStr.
size() - 1] ==
'\n' &&
1839 if (
Value *V = optimizePrintFString(CI, B)) {
1873 FormatStr.
size() + 1));
1879 if (FormatStr.
size() != 2 || FormatStr[0] !=
'%' ||
1884 if (FormatStr[1] ==
'c') {
1897 if (FormatStr[1] ==
's') {
1918 if (
Value *V = optimizeSPrintFString(CI, B)) {
1958 else if (N < FormatStr.
size() + 1)
1966 FormatStr.
size() + 1));
1972 if (FormatStr.
size() == 2 && FormatStr[0] ==
'%' &&
1976 if (FormatStr[1] ==
'c') {
1994 if (FormatStr[1] ==
's') {
2002 else if (N < Str.
size() + 1)
2016 if (
Value *V = optimizeSnPrintFString(CI, B)) {
2024 optimizeErrorReporting(CI, B, 0);
2051 if (FormatStr.
size() != 2 || FormatStr[0] !=
'%' ||
2056 if (FormatStr[1] ==
'c') {
2063 if (FormatStr[1] ==
's') {
2075 if (
Value *V = optimizeFPrintFString(CI, B)) {
2094 optimizeErrorReporting(CI, B, 3);
2099 if (SizeC && CountC) {
2100 uint64_t Bytes = SizeC->
getZExtValue() * CountC->getZExtValue();
2124 optimizeErrorReporting(CI, B, 1);
2154 optimizeErrorReporting(CI, B, 1);
2204 bool LibCallSimplifier::hasFloatVersion(
StringRef FuncName) {
2207 FloatFuncName +=
'f';
2208 if (TLI->getLibFunc(FloatFuncName, Func))
2209 return TLI->has(Func);
2213 Value *LibCallSimplifier::optimizeStringMemoryLibCall(
CallInst *CI,
2218 if (TLI->getLibFunc(*Callee, Func) && TLI->has(Func)) {
2222 "Optimizing string/memory libcall would change the calling convention");
2224 case LibFunc_strcat:
2225 return optimizeStrCat(CI, Builder);
2226 case LibFunc_strncat:
2227 return optimizeStrNCat(CI, Builder);
2228 case LibFunc_strchr:
2229 return optimizeStrChr(CI, Builder);
2230 case LibFunc_strrchr:
2231 return optimizeStrRChr(CI, Builder);
2232 case LibFunc_strcmp:
2233 return optimizeStrCmp(CI, Builder);
2234 case LibFunc_strncmp:
2235 return optimizeStrNCmp(CI, Builder);
2236 case LibFunc_strcpy:
2237 return optimizeStrCpy(CI, Builder);
2238 case LibFunc_stpcpy:
2239 return optimizeStpCpy(CI, Builder);
2240 case LibFunc_strncpy:
2241 return optimizeStrNCpy(CI, Builder);
2242 case LibFunc_strlen:
2243 return optimizeStrLen(CI, Builder);
2244 case LibFunc_strpbrk:
2245 return optimizeStrPBrk(CI, Builder);
2246 case LibFunc_strtol:
2247 case LibFunc_strtod:
2248 case LibFunc_strtof:
2249 case LibFunc_strtoul:
2250 case LibFunc_strtoll:
2251 case LibFunc_strtold:
2252 case LibFunc_strtoull:
2253 return optimizeStrTo(CI, Builder);
2254 case LibFunc_strspn:
2255 return optimizeStrSpn(CI, Builder);
2256 case LibFunc_strcspn:
2257 return optimizeStrCSpn(CI, Builder);
2258 case LibFunc_strstr:
2259 return optimizeStrStr(CI, Builder);
2260 case LibFunc_memchr:
2261 return optimizeMemChr(CI, Builder);
2262 case LibFunc_memcmp:
2263 return optimizeMemCmp(CI, Builder);
2264 case LibFunc_memcpy:
2265 return optimizeMemCpy(CI, Builder);
2266 case LibFunc_memmove:
2267 return optimizeMemMove(CI, Builder);
2268 case LibFunc_memset:
2269 return optimizeMemSet(CI, Builder);
2270 case LibFunc_realloc:
2271 return optimizeRealloc(CI, Builder);
2272 case LibFunc_wcslen:
2273 return optimizeWcslen(CI, Builder);
2281 Value *LibCallSimplifier::optimizeFloatingPointLibCall(
CallInst *CI,
2292 return optimizeCos(CI, Builder);
2293 case LibFunc_sinpif:
2295 case LibFunc_cospif:
2297 return optimizeSinCosPi(CI, Builder);
2301 return optimizePow(CI, Builder);
2305 return optimizeExp2(CI, Builder);
2313 return optimizeSqrt(CI, Builder);
2319 return optimizeLog(CI, Builder);
2323 return optimizeTan(CI, Builder);
2330 case LibFunc_nearbyint:
2353 case LibFunc_copysign:
2363 return optimizeFMinFMax(CI, Builder);
2367 return optimizeCAbs(CI, Builder);
2393 else if (isa<FPMathOperator>(CI) && CI->
isFast())
2394 UnsafeFPShrink =
true;
2398 if (!isCallingConvC)
2402 switch (II->getIntrinsicID()) {
2403 case Intrinsic::pow:
2404 return optimizePow(CI, Builder);
2405 case Intrinsic::exp2:
2406 return optimizeExp2(CI, Builder);
2407 case Intrinsic::log:
2408 return optimizeLog(CI, Builder);
2409 case Intrinsic::sqrt:
2410 return optimizeSqrt(CI, Builder);
2418 if (
Value *SimplifiedFortifiedCI = FortifiedSimplifier.optimizeCall(CI)) {
2425 if (
Value *V = optimizeStringMemoryLibCall(SimplifiedCI, TmpBuilder)) {
2432 return SimplifiedFortifiedCI;
2436 if (TLI->getLibFunc(*Callee, Func) && TLI->has(Func)) {
2440 if (
Value *V = optimizeStringMemoryLibCall(CI, Builder))
2442 if (
Value *V = optimizeFloatingPointLibCall(CI, Func, Builder))
2448 return optimizeFFS(CI, Builder);
2452 return optimizeFls(CI, Builder);
2456 return optimizeAbs(CI, Builder);
2457 case LibFunc_isdigit:
2458 return optimizeIsDigit(CI, Builder);
2459 case LibFunc_isascii:
2460 return optimizeIsAscii(CI, Builder);
2461 case LibFunc_toascii:
2462 return optimizeToAscii(CI, Builder);
2466 return optimizeAtoi(CI, Builder);
2467 case LibFunc_strtol:
2468 case LibFunc_strtoll:
2469 return optimizeStrtol(CI, Builder);
2470 case LibFunc_printf:
2471 return optimizePrintF(CI, Builder);
2472 case LibFunc_sprintf:
2473 return optimizeSPrintF(CI, Builder);
2474 case LibFunc_snprintf:
2475 return optimizeSnPrintF(CI, Builder);
2476 case LibFunc_fprintf:
2477 return optimizeFPrintF(CI, Builder);
2478 case LibFunc_fwrite:
2479 return optimizeFWrite(CI, Builder);
2481 return optimizeFRead(CI, Builder);
2483 return optimizeFPuts(CI, Builder);
2485 return optimizeFGets(CI, Builder);
2487 return optimizeFPutc(CI, Builder);
2489 return optimizeFGetc(CI, Builder);
2491 return optimizePuts(CI, Builder);
2492 case LibFunc_perror:
2493 return optimizeErrorReporting(CI, Builder);
2494 case LibFunc_vfprintf:
2495 case LibFunc_fiprintf:
2496 return optimizeErrorReporting(CI, Builder, 0);
2508 : FortifiedSimplifier(TLI), DL(DL), TLI(TLI), ORE(ORE),
2509 UnsafeFPShrink(
false), Replacer(Replacer) {}
2551 bool FortifiedLibCallSimplifier::isFortifiedCallFoldable(
CallInst *CI,
2559 if (ObjSizeCI->isMinusOne())
2562 if (OnlyLowerUnknownSize)
2570 return ObjSizeCI->getZExtValue() >= Len;
2573 return ObjSizeCI->getZExtValue() >= SizeCI->getZExtValue();
2578 Value *FortifiedLibCallSimplifier::optimizeMemCpyChk(
CallInst *CI,
2580 if (isFortifiedCallFoldable(CI, 3, 2,
false)) {
2588 Value *FortifiedLibCallSimplifier::optimizeMemMoveChk(
CallInst *CI,
2590 if (isFortifiedCallFoldable(CI, 3, 2,
false)) {
2598 Value *FortifiedLibCallSimplifier::optimizeMemSetChk(
CallInst *CI,
2602 if (isFortifiedCallFoldable(CI, 3, 2,
false)) {
2610 Value *FortifiedLibCallSimplifier::optimizeStrpCpyChk(
CallInst *CI,
2620 if (Func == LibFunc_stpcpy_chk && !OnlyLowerUnknownSize && Dst == Src) {
2630 if (isFortifiedCallFoldable(CI, 2, 1,
true))
2633 if (OnlyLowerUnknownSize)
2646 if (Ret && Func == LibFunc_stpcpy_chk)
2651 Value *FortifiedLibCallSimplifier::optimizeStrpNCpyChk(
CallInst *CI,
2656 if (isFortifiedCallFoldable(CI, 3, 2,
false)) {
2696 case LibFunc_memcpy_chk:
2697 return optimizeMemCpyChk(CI, Builder);
2698 case LibFunc_memmove_chk:
2699 return optimizeMemMoveChk(CI, Builder);
2700 case LibFunc_memset_chk:
2701 return optimizeMemSetChk(CI, Builder);
2702 case LibFunc_stpcpy_chk:
2703 case LibFunc_strcpy_chk:
2704 return optimizeStrpCpyChk(CI, Builder, Func);
2705 case LibFunc_stpncpy_chk:
2706 case LibFunc_strncpy_chk:
2707 return optimizeStrpNCpyChk(CI, Builder, Func);
2716 : TLI(TLI), OnlyLowerUnknownSize(OnlyLowerUnknownSize) {}
Value * CreateNSWNeg(Value *V, const Twine &Name="")
static Value * optimizeUnaryDoubleFP(CallInst *CI, IRBuilder<> &B, bool CheckRetType)
Shrink double -> float for unary functions like 'floor'.
Value * CreateInBoundsGEP(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &Name="")
bool isIntrinsic() const
isIntrinsic - Returns true if the function's name starts with "llvm.".
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
void push_back(const T &Elt)
A parsed version of the target data layout string in and methods for querying it. ...
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
class_match< Value > m_Value()
Match an arbitrary value and ignore it.
Value * CreateICmp(CmpInst::Predicate P, Value *LHS, Value *RHS, const Twine &Name="")
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static Value * foldMallocMemset(CallInst *Memset, IRBuilder<> &B, const TargetLibraryInfo &TLI)
Fold memset[_chk](malloc(n), 0, n) –> calloc(1, n).
void flipAllBits()
Toggle every bit to its opposite value.
bool isOnlyUsedInZeroEqualityComparison(const Instruction *CxtI)
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
LLVM_NODISCARD std::string str() const
str - Get the contents as an std::string.
void setFast(bool B=true)
Value * CreateICmpNE(Value *LHS, Value *RHS, const Twine &Name="")
Value * CreateIsNotNull(Value *Arg, const Twine &Name="")
Return an i1 value testing if Arg is not null.
Value * CreateZExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a ZExt or Trunc from the integer value V to DestTy.
C - The default llvm calling convention, compatible with C.
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
Compute iterated dominance frontiers using a linear time algorithm.
static bool callHasFloatingPointArgument(const CallInst *CI)
Type * getParamType(unsigned i) const
Parameter type accessors.
Value * CreateICmpULT(Value *LHS, Value *RHS, const Twine &Name="")
Constant * getOrInsertFunction(StringRef Name, FunctionType *T, AttributeList AttributeList)
Look up the specified function in the module symbol table.
Value * optimizeCall(CallInst *CI)
Take the given call instruction and return a more optimal value to replace the instruction with or 0 ...
A Module instance is used to store all the information related to an LLVM module. ...
static Constant * getInfinity(Type *Ty, bool Negative=false)
LLVM_NODISCARD size_t rfind(char C, size_t From=npos) const
Search for the last character C in the string.
ARM_AAPCS - ARM Architecture Procedure Calling Standard calling convention (aka EABI).
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t size() const
size - Get the string size.
Value * CreateICmpSLT(Value *LHS, Value *RHS, const Twine &Name="")
This class represents a function call, abstracting a target machine's calling convention.
static uint64_t round(uint64_t Acc, uint64_t Input)
An efficient, type-erasing, non-owning reference to a callable.
LLVMContext & getContext() const
All values hold a context through their type.
Value * CreateSExt(Value *V, Type *DestTy, const Twine &Name="")
const fltSemantics & getSemantics() const
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
CallInst * CreateMemSet(Value *Ptr, Value *Val, uint64_t Size, unsigned Align, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memset to the specified pointer and the specified value.
An instruction for reading from memory.
static bool isTrigLibCall(CallInst *CI)
CallingConv::ID getCallingConv() const
getCallingConv/setCallingConv - Get or set the calling convention of this function call...
Value * emitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilder<> &B, const TargetLibraryInfo *TLI, StringRef Name="strncpy")
Emit a call to the strncpy function to the builder, for the specified pointer arguments and length...
bool isGEPBasedOnPointerToString(const GEPOperator *GEP, unsigned CharSize=8)
Returns true if the GEP is based on a pointer to a string (array of.
Value * emitFPutSUnlocked(Value *Str, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fputs_unlocked function.
uint64_t Offset
Slice starts at this Offset.
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
Adds the attribute to the indicated argument.
LLVMContext & getContext() const
Get the context in which this basic block lives.
Value * emitMalloc(Value *Num, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the malloc function.
ARM_APCS - ARM Procedure Calling Standard calling convention (obsolete, but still used on some target...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
static bool isReportingError(Function *Callee, CallInst *CI, int StreamArg)
static Constant * getNullValue(Type *Ty)
Constructor to create a '0' constant of arbitrary type.
iterator begin()
Instruction iterator methods.
IntegerType * getInt32Ty()
Fetch the type representing a 32-bit integer.
static Value * replaceUnaryCall(CallInst *CI, IRBuilder<> &B, Intrinsic::ID IID)
specific_fpval m_SpecificFP(double V)
Match a specific floating point value or vector with all elements equal to the value.
bool match(Val *V, const Pattern &P)
Value * CreateFPExt(Value *V, Type *DestTy, const Twine &Name="")
void setBit(unsigned BitPosition)
Set a given bit to 1.
This class represents the LLVM 'select' instruction.
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
FunctionType * getFunctionType() const
bool isNonNegative() const
Determine if this APInt Value is non-negative (>= 0)
FortifiedLibCallSimplifier(const TargetLibraryInfo *TLI, bool OnlyLowerUnknownSize=false)
A Use represents the edge between a Value definition and its users.
PointerType * getPointerTo(unsigned AddrSpace=0) const
Return a pointer to the current type.
Value * emitPutChar(Value *Char, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the putchar function. This assumes that Char is an integer.
bool isIntegerTy() const
True if this is an instance of IntegerType.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
LibCallSimplifier(const DataLayout &DL, const TargetLibraryInfo *TLI, OptimizationRemarkEmitter &ORE, function_ref< void(Instruction *, Value *)> Replacer=&replaceAllUsesWithDefault)
Value * CreateAdd(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
CallInst * CreateMemMove(Value *Dst, unsigned DstAlign, Value *Src, unsigned SrcAlign, uint64_t Size, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memmove between the specified pointers.
Value * emitUnaryFloatFnCall(Value *Op, StringRef Name, IRBuilder<> &B, const AttributeList &Attrs)
Emit a call to the unary function named 'Name' (e.g.
static cl::opt< bool > EnableUnsafeFPShrink("enable-double-float-shrink", cl::Hidden, cl::init(false), cl::desc("Enable unsafe double to float " "shrinking for math lib calls"))
Value * emitFPutCUnlocked(Value *Char, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fputc_unlocked function.
static StructType * get(LLVMContext &Context, ArrayRef< Type *> Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
StoreInst * CreateStore(Value *Val, Value *Ptr, bool isVolatile=false)
static Value * convertStrToNumber(CallInst *CI, StringRef &Str, int64_t Base)
Value * CreateIntToPtr(Value *V, Type *DestTy, const Twine &Name="")
Instruction * clone() const
Create a copy of 'this' instruction that is identical in all ways except the following: ...
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Class to represent function types.
Value * CreateBitCast(Value *V, Type *DestTy, const Twine &Name="")
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags, which must be an operator which supports th...
Type * getType() const
All values are typed, get the type of this value.
Value * CreateSExtOrTrunc(Value *V, Type *DestTy, const Twine &Name="")
Create a SExt or Trunc from the integer value V to DestTy.
apfloat_match m_APFloat(const APFloat *&Res)
Match a ConstantFP or splatted ConstantVector, binding the specified pointer to the contained APFloat...
const ConstantDataArray * Array
ConstantDataArray pointer.
opStatus convert(const fltSemantics &ToSemantics, roundingMode RM, bool *losesInfo)
BasicBlock * GetInsertBlock() const
Value * emitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the __memcpy_chk function to the builder.
bool isNegative() const
Return true if the sign bit is set.
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
bool has(LibFunc F) const
Tests whether a library function is available.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
Value * emitStrCpy(Value *Dst, Value *Src, IRBuilder<> &B, const TargetLibraryInfo *TLI, StringRef Name="strcpy")
Emit a call to the strcpy function to the builder, for the specified pointer arguments.
Value * CreateSub(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
AttributeList getAttributes() const
Return the attribute list for this Function.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
static const fltSemantics & IEEEdouble() LLVM_READNONE
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef substr(size_t Start, size_t N=npos) const
Return a reference to the substring from [Start, Start + N).
static Value * valueHasFloatPrecision(Value *Val)
Return a variant of Val with float type.
Value * CreateZExt(Value *V, Type *DestTy, const Twine &Name="")
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
uint64_t GetStringLength(const Value *V, unsigned CharSize=8)
If we can compute the length of the string pointed to by the specified pointer, return 'len+1'...
void takeName(Value *V)
Transfer the name from V to this value.
Value * CreateFCmpOEQ(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
amdgpu Simplify well known AMD library false Value * Callee
Function * getDeclaration(Module *M, ID id, ArrayRef< Type *> Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
void SetInsertPoint(BasicBlock *TheBB)
This specifies that created instructions should be appended to the end of the specified block...
Value * getOperand(unsigned i) const
ConstantInt * getIntN(unsigned N, uint64_t C)
Get a constant N-bit value, zero extended or truncated from a 64-bit value.
Value * getOperand(unsigned i_nocapture) const
bool getConstantDataArrayInfo(const Value *V, ConstantDataArraySlice &Slice, unsigned ElementSize, uint64_t Offset=0)
Returns true if the value V is a pointer into a ConstantDataArray.
static Constant * getBitCast(Constant *C, Type *Ty, bool OnlyIfReduced=false)
Value * emitFPutS(Value *Str, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fputs function.
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
const BasicBlock & getEntryBlock() const
LoadInst * CreateLoad(Value *Ptr, const char *Name)
Provided to resolve 'CreateLoad(Ptr, "...")' correctly, instead of converting the string to 'bool' fo...
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
Returns an integer type with size at least as big as that of a pointer in the given address space...
bool inferLibFuncAttributes(Function &F, const TargetLibraryInfo &TLI)
Analyze the name and prototype of the given function and set any applicable attributes.
Type * getDoubleTy()
Fetch the type representing a 64-bit floating point value.
initializer< Ty > init(const Ty &Val)
static bool isLocallyOpenedFile(Value *File, CallInst *CI, IRBuilder<> &B, const TargetLibraryInfo *TLI)
uint64_t getZExtValue() const
Return the constant as a 64-bit unsigned integer value after it has been zero extended as appropriate...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Value * CreateFMul(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
bool hasFnAttr(Attribute::AttrKind Kind) const
Determine whether this call has the given attribute.
void setNoSignedZeros(bool B=true)
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
ConstantInt * getTrue()
Get the constant value for i1 true.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This is an important base class in LLVM.
Value * CreateSelect(Value *C, Value *True, Value *False, const Twine &Name="", Instruction *MDFrom=nullptr)
bool isPointerTy() const
True if this is an instance of PointerType.
LLVM_NODISCARD size_t find_first_not_of(char C, size_t From=0) const
Find the first character in the string that is not C or npos if not found.
ConstantFP - Floating Point Values [float, double].
Value * CreateFCmpOGT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
double convertToDouble() const
bool isExactlyValue(double V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
bool isFast() const
Determine whether all fast-math-flags are set.
bool any_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly...
Value * CreateNeg(Value *V, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
void setCalledFunction(Value *Fn)
Set the function called.
bool optForSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
This instruction compares its operands according to the predicate given to the constructor.
Value * getPointerOperand()
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE int compare(StringRef RHS) const
compare - Compare two strings; the result is -1, 0, or 1 if this string is lexicographically less tha...
static bool isCallingConvCCompatible(CallInst *CI)
Class to represent integer types.
ConstantInt * getInt64(uint64_t C)
Get a constant 64-bit value.
Value * castToCStr(Value *V, IRBuilder<> &B)
Return V if it is an i8*, otherwise cast it to i8*.
Represents offset+length into a ConstantDataArray.
Value * CreateExtractElement(Value *Vec, Value *Idx, const Twine &Name="")
const Function * getFunction() const
Return the function this instruction belongs to.
Constant * ConstantFoldLoadFromConstPtr(Constant *C, Type *Ty, const DataLayout &DL)
ConstantFoldLoadFromConstPtr - Return the value that a load from C would produce if it is constant an...
ARM_AAPCS_VFP - Same as ARM_AAPCS, but uses hard floating point ABI.
bool isIntN(unsigned N, int64_t x)
Checks if an signed integer fits into the given (dynamic) bit width.
uint64_t NextPowerOf2(uint64_t A)
Returns the next power of two (in 64-bits) that is strictly greater than A.
const Constant * stripPointerCasts() const
Value * emitStrChr(Value *Ptr, char C, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the strchr function to the builder, for the specified pointer and character.
bool PointerMayBeCaptured(const Value *V, bool ReturnCaptures, bool StoreCaptures)
PointerMayBeCaptured - Return true if this pointer value may be captured by the enclosing function (w...
Value * CreateExtractValue(Value *Agg, ArrayRef< unsigned > Idxs, const Twine &Name="")
LLVM_NODISCARD char back() const
back - Get the last character in the string.
Value * CreateTrunc(Value *V, Type *DestTy, const Twine &Name="")
Triple - Helper class for working with autoconf configuration names.
void setCallingConv(CallingConv::ID CC)
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE StringRef drop_back(size_t N=1) const
Return a StringRef equal to 'this' but with the last N elements dropped.
const APFloat & getValueAPF() const
Value * emitFWriteUnlocked(Value *Ptr, Value *Size, Value *N, Value *File, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the fwrite_unlocked function.
Value * CreateGEP(Value *Ptr, ArrayRef< Value *> IdxList, const Twine &Name="")
Value * CreateFCmpOLT(Value *LHS, Value *RHS, const Twine &Name="", MDNode *FPMathTag=nullptr)
Value * emitStrLen(Value *Ptr, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the strlen function to the builder, for the specified pointer.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Value * emitBinaryFloatFnCall(Value *Op1, Value *Op2, StringRef Name, IRBuilder<> &B, const AttributeList &Attrs)
Emit a call to the binary function named 'Name' (e.g.
static const fltSemantics & IEEEsingle() LLVM_READNONE
Value * emitFGetCUnlocked(Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fgetc_unlocked function. File is a pointer to FILE.
This is the shared class of boolean and integer constants.
GlobalVariable * CreateGlobalString(StringRef Str, const Twine &Name="", unsigned AddressSpace=0)
Make a new global variable with initializer type i8*.
Value * CreateIntCast(Value *V, Type *DestTy, bool isSigned, const Twine &Name="")
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
uint64_t getElementAsInteger(unsigned i) const
If this is a sequential container of integers (of any size), return the specified element in the low ...
Module.h This file contains the declarations for the Module class.
uint64_t Length
Length of the slice.
Provides information about what library functions are available for the current target.
ConstantInt * getInt32(uint32_t C)
Get a constant 32-bit value.
CallInst * CreateMemCpy(Value *Dst, unsigned DstAlign, Value *Src, unsigned SrcAlign, uint64_t Size, bool isVolatile=false, MDNode *TBAATag=nullptr, MDNode *TBAAStructTag=nullptr, MDNode *ScopeTag=nullptr, MDNode *NoAliasTag=nullptr)
Create and insert a memcpy between the specified pointers.
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
Value * CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0, const Twine &Name="")
BinaryOp_match< LHS, RHS, Instruction::FMul > m_FMul(const LHS &L, const RHS &R)
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
void setNoNaNs(bool B=true)
FunctionType * getFunctionType() const
Returns the FunctionType for me.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
Class for arbitrary precision integers.
bool ule(const APInt &RHS) const
Unsigned less or equal comparison.
iterator_range< user_iterator > users()
IntegerType * getInt8Ty()
Fetch the type representing an 8-bit integer.
Value * CreateShl(Value *LHS, Value *RHS, const Twine &Name="", bool HasNUW=false, bool HasNSW=false)
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
static Value * optimizeBinaryDoubleFP(CallInst *CI, IRBuilder<> &B)
Shrink double -> float for binary functions like 'fmin/fmax'.
Value * emitFPutC(Value *Char, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fputc function.
ConstantInt * getFalse()
Get the constant value for i1 false.
amdgpu Simplify well known AMD library false Value Value * Arg
bool isStrictFP() const
Determine if the call requires strict floating point semantics.
Value * emitFGetSUnlocked(Value *Str, Value *Size, Value *File, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the fgets_unlocked function.
Predicate getPredicate() const
Return the predicate for this instruction.
Merge contiguous icmps into a memcmp
unsigned getIntegerBitWidth() const
LLVM_NODISCARD bool empty() const
unsigned getNumArgOperands() const
Return the number of call arguments.
Value * emitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the strncmp function to the builder.
static bool isFNeg(const Value *V, bool IgnoreZeroSign=false)
StringRef getName() const
Return a constant reference to the value's name.
const Function * getParent() const
Return the enclosing method, or null if none.
LLVM_NODISCARD size_t find_first_of(char C, size_t From=0) const
Find the first character in the string that is C, or npos if not found.
APFloat abs(APFloat X)
Returns the absolute value of the argument.
This class represents a cast unsigned integer to floating point.
bool isZero() const
This is just a convenience method to make client code smaller for a common code.
Value * optimizeCall(CallInst *CI)
optimizeCall - Take the given call instruction and return a more optimal value to replace the instruc...
unsigned getKnownAlignment(Value *V, const DataLayout &DL, const Instruction *CxtI=nullptr, AssumptionCache *AC=nullptr, const DominatorTree *DT=nullptr)
Try to infer an alignment for the specified pointer.
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
static void insertSinCosCall(IRBuilder<> &B, Function *OrigCallee, Value *Arg, bool UseFloat, Value *&Sin, Value *&Cos, Value *&SinCos)
Type * getFloatTy()
Fetch the type representing a 32-bit floating point value.
Value * CreateFAdd(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
Value * CreateAnd(Value *LHS, Value *RHS, const Twine &Name="")
void getOperandBundlesAsDefs(SmallVectorImpl< OperandBundleDef > &Defs) const
Return the list of operand bundles attached to this instruction as a vector of OperandBundleDefs.
Value * CreateFDiv(Value *L, Value *R, const Twine &Name="", MDNode *FPMD=nullptr)
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
bool getConstantStringInfo(const Value *V, StringRef &Str, uint64_t Offset=0, bool TrimAtNul=true)
This function computes the length of a null-terminated C string pointed to by V.
Value * emitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the fwrite function.
InstTy * Insert(InstTy *I, const Twine &Name="") const
Insert and return the specified instruction.
Value * emitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the memcmp function.
This class represents a cast from signed integer to floating point.
static bool isOnlyUsedInEqualityComparison(Value *V, Value *With)
Return true if it is only used in equality comparisons with With.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
user_iterator user_begin()
Value * getArgOperand(unsigned i) const
getArgOperand/setArgOperand - Return/set the i-th call argument.
This class represents a truncation of floating point types.
Value * emitFReadUnlocked(Value *Ptr, Value *Size, Value *N, Value *File, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the fread_unlocked function.
unsigned getPrimitiveSizeInBits() const LLVM_READONLY
Return the basic size of this type if it is a primitive type.
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
Value * emitPutS(Value *Str, IRBuilder<> &B, const TargetLibraryInfo *TLI)
Emit a call to the puts function. This assumes that Str is some pointer.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static VectorType * get(Type *ElementType, unsigned NumElements)
This static method is the primary way to construct an VectorType.
Value * emitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilder<> &B, const DataLayout &DL, const TargetLibraryInfo *TLI)
Emit a call to the memchr function.
void setFastMathFlags(FastMathFlags NewFMF)
Set the fast-math flags to be used with generated fp-math operators.
Value * emitCalloc(Value *Num, Value *Size, const AttributeList &Attrs, IRBuilder<> &B, const TargetLibraryInfo &TLI)
Emit a call to the calloc function.
bool isExactlyValue(const APFloat &V) const
We don't rely on operator== working on double values, as it returns true for things that are clearly ...
ConstantInt * getInt8(uint8_t C)
Get a constant 8-bit value.
bool hasNoNaNs() const
Determine whether the no-NaNs flag is set.
Convenience struct for specifying and reasoning about fast-math flags.
StringRef - Represent a constant reference to a string, i.e.
int64_t getSExtValue() const
Return the constant as a 64-bit integer value after it has been sign extended as appropriate for the ...
ConstantInt * getInt(const APInt &AI)
Get a constant integer value.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE size_t find(char C, size_t From=0) const
Search for the first character C in the string.
static bool ignoreCallingConv(LibFunc Func)
This class represents an extension of floating point types.
static Constant * getFPExtend(Constant *C, Type *Ty, bool OnlyIfReduced=false)
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
bool hasUnaryFloatFn(const TargetLibraryInfo *TLI, Type *Ty, LibFunc DoubleFn, LibFunc FloatFn, LibFunc LongDoubleFn)
Check whether the overloaded unary floating point function corresponding to Ty is available...
void computeKnownBits(const Value *V, KnownBits &Known, const DataLayout &DL, unsigned Depth=0, AssumptionCache *AC=nullptr, const Instruction *CxtI=nullptr, const DominatorTree *DT=nullptr, OptimizationRemarkEmitter *ORE=nullptr)
Determine which bits of V are known to be either zero or one and return them in the KnownZero/KnownOn...
static Value * getPow(Value *InnerChain[33], unsigned Exp, IRBuilder<> &B)
bool isStructTy() const
True if this is an instance of StructType.
cmpResult compare(const APFloat &RHS) const
bool isArrayTy() const
True if this is an instance of ArrayType.
A wrapper class for inspecting calls to intrinsic functions.
CallInst * CreateCall(Value *Callee, ArrayRef< Value *> Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)