reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

lib/Transforms/InstCombine/InstCombineCalls.cpp
 1797   if (!II) return visitCallBase(CI);
 1801   if (auto *MI = dyn_cast<AnyMemIntrinsic>(II)) {
 1857     if (Changed) return II;
 1861   if (II->getType()->isVectorTy()) {
 1862     auto VWidth = II->getType()->getVectorNumElements();
 1865     if (Value *V = SimplifyDemandedVectorElts(II, AllOnesEltMask, UndefElts)) {
 1866       if (V != II)
 1867         return replaceInstUsesWith(*II, V);
 1868       return II;
 1872   if (Instruction *I = SimplifyNVVMIntrinsic(II, *this))
 1882   Intrinsic::ID IID = II->getIntrinsicID();
 1886     if (Value *V = lowerObjectSizeCall(II, DL, &TLI, /*MustSucceed=*/false))
 1890     Value *IIOperand = II->getArgOperand(0);
 1904     if (Value *SimplifiedMaskedOp = simplifyMaskedLoad(*II))
 1908     return simplifyMaskedStore(*II);
 1910     return simplifyMaskedGather(*II);
 1912     return simplifyMaskedScatter(*II);
 1915     if (auto *SkippedBarrier = simplifyInvariantGroupIntrinsic(*II, *this))
 1916       return replaceInstUsesWith(*II, SkippedBarrier);
 1919     if (ConstantInt *Power = dyn_cast<ConstantInt>(II->getArgOperand(1))) {
 1925                                           II->getArgOperand(0));
 1928         return BinaryOperator::CreateFMul(II->getArgOperand(0),
 1929                                           II->getArgOperand(0));
 1935     if (auto *I = foldCttzCtlz(*II, *this))
 1940     if (auto *I = foldCtpop(*II, *this))
 1946     Value *Op0 = II->getArgOperand(0), *Op1 = II->getArgOperand(1);
 1946     Value *Op0 = II->getArgOperand(0), *Op1 = II->getArgOperand(1);
 1947     Type *Ty = II->getType();
 1950     if (match(II->getArgOperand(2), m_Constant(ShAmtC)) &&
 1956         II->setArgOperand(2, ModuloC);
 1957         return II;
 1969         Module *Mod = II->getModule();
 1989         Module *Mod = II->getModule();
 1996     if (SimplifyDemandedInstructionBits(*II))
 2006     if (SimplifyDemandedBits(II, 2, Op2Demanded, Op2Known))
 2014     if (Instruction *I = foldIntrinsicWithOverflowCommon(II))
 2022     Value *Arg0 = II->getArgOperand(0);
 2023     Value *Arg1 = II->getArgOperand(1);
 2033             *II, Builder.CreateBinaryIntrinsic(
 2046     if (Instruction *I = foldIntrinsicWithOverflowCommon(II))
 2051     if (Instruction *I = foldIntrinsicWithOverflowCommon(II))
 2055     Value *Arg0 = II->getArgOperand(0);
 2056     Value *Arg1 = II->getArgOperand(1);
 2066           *II, Builder.CreateBinaryIntrinsic(Intrinsic::sadd_with_overflow,
 2080     SaturatingInst *SI = cast<SaturatingInst>(II);
 2114           *II, Builder.CreateBinaryIntrinsic(
 2147             *II, Builder.CreateBinaryIntrinsic(
 2148                      IID, X, ConstantInt::get(II->getType(), NewVal)));
 2160     Value *Arg0 = II->getArgOperand(0);
 2161     Value *Arg1 = II->getArgOperand(1);
 2185       Value *NewCall = Builder.CreateBinaryIntrinsic(NewIID, X, Y, II);
 2187       FNeg->copyIRFlags(II);
 2218         NewCall->copyIRFlags(II);
 2219         return replaceInstUsesWith(*II, NewCall);
 2227     if (II->isFast()) {
 2229       Builder.setFastMathFlags(II->getFastMathFlags());
 2230       Value *Mul = Builder.CreateFMul(II->getArgOperand(0),
 2231                                       II->getArgOperand(1));
 2232       Value *Add = Builder.CreateFAdd(Mul, II->getArgOperand(2));
 2233       Add->takeName(II);
 2234       return replaceInstUsesWith(*II, Add);
 2238     if (Value *V = SimplifyFMulInst(II->getArgOperand(0), II->getArgOperand(1),
 2238     if (Value *V = SimplifyFMulInst(II->getArgOperand(0), II->getArgOperand(1),
 2239                                     II->getFastMathFlags(),
 2240                                     SQ.getWithInstruction(II))) {
 2241       auto *FAdd = BinaryOperator::CreateFAdd(V, II->getArgOperand(2));
 2242       FAdd->copyFastMathFlags(II);
 2253     Value *Src0 = II->getArgOperand(0);
 2254     Value *Src1 = II->getArgOperand(1);
 2257       II->setArgOperand(0, X);
 2258       II->setArgOperand(1, Y);
 2259       return II;
 2265       II->setArgOperand(0, X);
 2266       II->setArgOperand(1, X);
 2267       return II;
 2272     if (Value *V = SimplifyFMAFMul(II->getArgOperand(0), II->getArgOperand(1),
 2272     if (Value *V = SimplifyFMAFMul(II->getArgOperand(0), II->getArgOperand(1),
 2273                                    II->getFastMathFlags(),
 2274                                    SQ.getWithInstruction(II))) {
 2275       auto *FAdd = BinaryOperator::CreateFAdd(V, II->getArgOperand(2));
 2276       FAdd->copyFastMathFlags(II);
 2285     if (match(II->getArgOperand(0),
 2287       CallInst *Call0 = Builder.CreateCall(II->getCalledFunction(), {LHS});
 2288       CallInst *Call1 = Builder.CreateCall(II->getCalledFunction(), {RHS});
 2301     if (match(II->getArgOperand(0), m_OneUse(m_FPExt(m_Value(ExtSrc))))) {
 2303       Value *NarrowII = Builder.CreateUnaryIntrinsic(IID, ExtSrc, II);
 2304       return new FPExtInst(NarrowII, II->getType());
 2311     Value *Src = II->getArgOperand(0);
 2315       II->setArgOperand(0, X);
 2316       return II;
 2322     if (match(II->getArgOperand(0), m_OneUse(m_FNeg(m_Value(X))))) {
 2324       Value *NewSin = Builder.CreateUnaryIntrinsic(Intrinsic::sin, X, II);
 2326       FNeg->copyFastMathFlags(II);
 2334     if (getOrEnforceKnownAlignment(II->getArgOperand(0), 16, DL, II, &AC,
 2334     if (getOrEnforceKnownAlignment(II->getArgOperand(0), 16, DL, II, &AC,
 2336       Value *Ptr = Builder.CreateBitCast(II->getArgOperand(0),
 2337                                          PointerType::getUnqual(II->getType()));
 2338       return new LoadInst(II->getType(), Ptr);
 2344     Value *Ptr = Builder.CreateBitCast(II->getArgOperand(0),
 2345                                        PointerType::getUnqual(II->getType()));
 2346     return new LoadInst(II->getType(), Ptr, Twine(""), false, Align::None());
 2351     if (getOrEnforceKnownAlignment(II->getArgOperand(1), 16, DL, II, &AC,
 2351     if (getOrEnforceKnownAlignment(II->getArgOperand(1), 16, DL, II, &AC,
 2354         PointerType::getUnqual(II->getArgOperand(0)->getType());
 2355       Value *Ptr = Builder.CreateBitCast(II->getArgOperand(1), OpPtrTy);
 2356       return new StoreInst(II->getArgOperand(0), Ptr);
 2362     Type *OpPtrTy = PointerType::getUnqual(II->getArgOperand(0)->getType());
 2363     Value *Ptr = Builder.CreateBitCast(II->getArgOperand(1), OpPtrTy);
 2364     return new StoreInst(II->getArgOperand(0), Ptr, false, Align::None());
 2368     if (getOrEnforceKnownAlignment(II->getArgOperand(0), 16, DL, II, &AC,
 2368     if (getOrEnforceKnownAlignment(II->getArgOperand(0), 16, DL, II, &AC,
 2371                                   II->getType()->getVectorNumElements());
 2372       Value *Ptr = Builder.CreateBitCast(II->getArgOperand(0),
 2375       return new FPExtInst(Load, II->getType());
 2380     if (getOrEnforceKnownAlignment(II->getArgOperand(0), 32, DL, II, &AC,
 2380     if (getOrEnforceKnownAlignment(II->getArgOperand(0), 32, DL, II, &AC,
 2382       Value *Ptr = Builder.CreateBitCast(II->getArgOperand(0),
 2383                                          PointerType::getUnqual(II->getType()));
 2384       return new LoadInst(II->getType(), Ptr);
 2389     if (getOrEnforceKnownAlignment(II->getArgOperand(1), 16, DL, II, &AC,
 2389     if (getOrEnforceKnownAlignment(II->getArgOperand(1), 16, DL, II, &AC,
 2392           II->getArgOperand(0)->getType()->getVectorNumElements());
 2393       Value *TOp = Builder.CreateFPTrunc(II->getArgOperand(0), VTy);
 2395       Value *Ptr = Builder.CreateBitCast(II->getArgOperand(1), OpPtrTy);
 2401     if (getOrEnforceKnownAlignment(II->getArgOperand(1), 32, DL, II, &AC,
 2401     if (getOrEnforceKnownAlignment(II->getArgOperand(1), 32, DL, II, &AC,
 2404         PointerType::getUnqual(II->getArgOperand(0)->getType());
 2405       Value *Ptr = Builder.CreateBitCast(II->getArgOperand(1), OpPtrTy);
 2406       return new StoreInst(II->getArgOperand(0), Ptr);
 2415     if (auto *C = dyn_cast<ConstantInt>(II->getArgOperand(1))) {
 2419       unsigned BitWidth = II->getType()->getIntegerBitWidth();
 2422         return replaceInstUsesWith(CI, ConstantInt::get(II->getType(), 0));
 2424       if (auto *InC = dyn_cast<ConstantInt>(II->getArgOperand(0))) {
 2429         return replaceInstUsesWith(CI, ConstantInt::get(II->getType(), Result));
 2439     if (auto *C = dyn_cast<ConstantInt>(II->getArgOperand(1))) {
 2441       unsigned BitWidth = II->getType()->getIntegerBitWidth();
 2443         return replaceInstUsesWith(CI, II->getArgOperand(0));
 2445         return replaceInstUsesWith(CI, ConstantInt::get(II->getType(), 0));
 2447       if (auto *InC = dyn_cast<ConstantInt>(II->getArgOperand(0))) {
 2450         return replaceInstUsesWith(CI, ConstantInt::get(II->getType(), Result));
 2458     auto Arg = II->getArgOperand(0);
 2460     auto RetType = cast<VectorType>(II->getType());
 2472       return replaceInstUsesWith(*II, ConstantAggregateZero::get(RetType));
 2485           VectorType::get(Type::getHalfTy(II->getContext()), RetWidth);
 2489       return replaceInstUsesWith(*II, VectorFloats);
 2494       II->setArgOperand(0, V);
 2495       return II;
 2526     Value *Arg = II->getArgOperand(0);
 2529       II->setArgOperand(0, V);
 2530       return II;
 2542     if (Value *V = simplifyX86movmsk(*II, Builder))
 2543       return replaceInstUsesWith(*II, V);
 2577     Value *Arg0 = II->getArgOperand(0);
 2578     Value *Arg1 = II->getArgOperand(1);
 2581       II->setArgOperand(0, V);
 2585       II->setArgOperand(1, V);
 2589       return II;
 2599     Value *Arg0 = II->getArgOperand(0);
 2600     Value *Arg1 = II->getArgOperand(1);
 2617       II->setArgOperand(0, A);
 2618       II->setArgOperand(1, B);
 2619       return II;
 2634     if (auto *R = dyn_cast<ConstantInt>(II->getArgOperand(2))) {
 2636         Value *Arg0 = II->getArgOperand(0);
 2637         Value *Arg1 = II->getArgOperand(1);
 2660         return replaceInstUsesWith(*II, V);
 2675     if (auto *R = dyn_cast<ConstantInt>(II->getArgOperand(4))) {
 2678         Value *Arg0 = II->getArgOperand(0);
 2679         Value *Arg1 = II->getArgOperand(1);
 2705         Value *Mask = II->getArgOperand(3);
 2715           Value *Passthru = Builder.CreateExtractElement(II->getArgOperand(2),
 2723         return replaceInstUsesWith(*II, V);
 2758     if (Value *V = simplifyX86immShift(*II, Builder))
 2759       return replaceInstUsesWith(*II, V);
 2789     if (Value *V = simplifyX86immShift(*II, Builder))
 2790       return replaceInstUsesWith(*II, V);
 2794     Value *Arg1 = II->getArgOperand(1);
 2800       II->setArgOperand(1, V);
 2801       return II;
 2833     if (Value *V = simplifyX86varShift(*II, Builder))
 2834       return replaceInstUsesWith(*II, V);
 2843     if (Value *V = simplifyX86pack(*II, Builder, true))
 2844       return replaceInstUsesWith(*II, V);
 2853     if (Value *V = simplifyX86pack(*II, Builder, false))
 2854       return replaceInstUsesWith(*II, V);
 2860     if (auto *C = dyn_cast<ConstantInt>(II->getArgOperand(2))) {
 2864       Value *Arg0 = II->getArgOperand(0);
 2865       Value *Arg1 = II->getArgOperand(1);
 2873         II->setArgOperand(0, V);
 2882         II->setArgOperand(1, V);
 2889         return replaceInstUsesWith(*II,
 2890                                    ConstantAggregateZero::get(II->getType()));
 2893         return II;
 2899     if (Value *V = simplifyX86insertps(*II, Builder))
 2900       return replaceInstUsesWith(*II, V);
 2904     Value *Op0 = II->getArgOperand(0);
 2905     Value *Op1 = II->getArgOperand(1);
 2922     if (Value *V = simplifyX86extrq(*II, Op0, CILength, CIIndex, Builder))
 2923       return replaceInstUsesWith(*II, V);
 2929       II->setArgOperand(0, V);
 2933       II->setArgOperand(1, V);
 2937       return II;
 2944     Value *Op0 = II->getArgOperand(0);
 2950     ConstantInt *CILength = dyn_cast<ConstantInt>(II->getArgOperand(1));
 2951     ConstantInt *CIIndex = dyn_cast<ConstantInt>(II->getArgOperand(2));
 2954     if (Value *V = simplifyX86extrq(*II, Op0, CILength, CIIndex, Builder))
 2955       return replaceInstUsesWith(*II, V);
 2960       II->setArgOperand(0, V);
 2961       return II;
 2967     Value *Op0 = II->getArgOperand(0);
 2968     Value *Op1 = II->getArgOperand(1);
 2986       if (Value *V = simplifyX86insertq(*II, Op0, Op1, Len, Idx, Builder))
 2987         return replaceInstUsesWith(*II, V);
 2993       II->setArgOperand(0, V);
 2994       return II;
 3003     Value *Op0 = II->getArgOperand(0);
 3004     Value *Op1 = II->getArgOperand(1);
 3012     ConstantInt *CILength = dyn_cast<ConstantInt>(II->getArgOperand(2));
 3013     ConstantInt *CIIndex = dyn_cast<ConstantInt>(II->getArgOperand(3));
 3019       if (Value *V = simplifyX86insertq(*II, Op0, Op1, Len, Idx, Builder))
 3020         return replaceInstUsesWith(*II, V);
 3027       II->setArgOperand(0, V);
 3031       II->setArgOperand(1, V);
 3035       return II;
 3046     Value *Op0 = II->getArgOperand(0);
 3047     Value *Op1 = II->getArgOperand(1);
 3048     Value *Mask = II->getArgOperand(2);
 3070              II->getType()->getPrimitiveSizeInBits() &&
 3074       unsigned NumOperandElts = II->getType()->getVectorNumElements();
 3084         return new BitCastInst(Sel, II->getType());
 3094     if (Value *V = simplifyX86pshufb(*II, Builder))
 3095       return replaceInstUsesWith(*II, V);
 3104     if (Value *V = simplifyX86vpermilvar(*II, Builder))
 3105       return replaceInstUsesWith(*II, V);
 3122     if (Value *V = simplifyX86vpermv(*II, Builder))
 3123       return replaceInstUsesWith(*II, V);
 3134     if (Instruction *I = simplifyX86MaskedLoad(*II, *this))
 3147     if (simplifyX86MaskedStore(*II, *this))
 3153     if (Value *V = simplifyX86addcarry(*II, Builder))
 3154       return replaceInstUsesWith(*II, V);
 3164     if (Constant *Mask = dyn_cast<Constant>(II->getArgOperand(2))) {
 3180         Value *Op0 = Builder.CreateBitCast(II->getArgOperand(0),
 3182         Value *Op1 = Builder.CreateBitCast(II->getArgOperand(1),
 3217     unsigned MemAlign = getKnownAlignment(II->getArgOperand(0),
 3218                                           DL, II, &AC, &DT);
 3219     if (Value *V = simplifyNeonVld1(*II, MemAlign, Builder))
 3220       return replaceInstUsesWith(*II, V);
 3238         getKnownAlignment(II->getArgOperand(0), DL, II, &AC, &DT);
 3238         getKnownAlignment(II->getArgOperand(0), DL, II, &AC, &DT);
 3239     unsigned AlignArg = II->getNumArgOperands() - 1;
 3240     ConstantInt *IntrAlign = dyn_cast<ConstantInt>(II->getArgOperand(AlignArg));
 3242       II->setArgOperand(AlignArg,
 3243                         ConstantInt::get(Type::getInt32Ty(II->getContext()),
 3245       return II;
 3252     if (Value *V = simplifyNeonTbl1(*II, Builder))
 3253       return replaceInstUsesWith(*II, V);
 3260     Value *Arg0 = II->getArgOperand(0);
 3261     Value *Arg1 = II->getArgOperand(1);
 3265       return replaceInstUsesWith(CI, ConstantAggregateZero::get(II->getType()));
 3271     VectorType *NewVT = cast<VectorType>(II->getType());
 3289           return CastInst::CreateIntegerCast(Arg0, II->getType(),
 3298     Value *DataArg = II->getArgOperand(0);
 3299     Value *KeyArg  = II->getArgOperand(1);
 3305       II->setArgOperand(0, Data);
 3306       II->setArgOperand(1, Key);
 3307       return II;
 3314         (II->getIntrinsicID() == Intrinsic::arm_mve_vadc_predicated) ? 3 : 2;
 3315     assert(II->getArgOperand(CarryOp)->getType()->getScalarSizeInBits() == 32 &&
 3319     if (SimplifyDemandedBits(II, CarryOp, APInt::getOneBitSet(32, 29),
 3321       return II;
 3325     Value *Src = II->getArgOperand(0);
 3339         return replaceInstUsesWith(CI, ConstantFP::get(II->getContext(), Val));
 3345     Value *Src = II->getArgOperand(0);
 3354     Value *Src = II->getArgOperand(0);
 3361         return replaceInstUsesWith(CI, ConstantFP::get(II->getContext(),
 3369       return replaceInstUsesWith(CI, ConstantInt::get(II->getType(), Exp));
 3373       return replaceInstUsesWith(CI, UndefValue::get(II->getType()));
 3394     Value *Src0 = II->getArgOperand(0);
 3395     Value *Src1 = II->getArgOperand(1);
 3399         return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 3399         return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 3402         return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), false));
 3402         return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), false));
 3410       return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), true));
 3410       return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), true));
 3413       return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), false));
 3413       return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), false));
 3418       FCmp->takeName(II);
 3419       return replaceInstUsesWith(*II, FCmp);
 3427       FCmp->takeName(II);
 3428       return replaceInstUsesWith(*II, FCmp);
 3433       II->setArgOperand(1, ConstantInt::get(Src1->getType(),
 3435       return II;
 3441         return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 3441         return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 3445         CallInst *NewCall = Builder.CreateCall(II->getCalledFunction(),
 3449         NewCall->takeName(II);
 3450         return replaceInstUsesWith(*II, NewCall);
 3470     return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), Result));
 3470     return replaceInstUsesWith(*II, ConstantInt::get(II->getType(), Result));
 3473     Value *Src0 = II->getArgOperand(0);
 3474     Value *Src1 = II->getArgOperand(1);
 3478           = II->getType()->getScalarType()->getFltSemantics();
 3486             ConstantFP::get(II->getContext(), Val0),
 3487             ConstantFP::get(II->getContext(), Val1) });
 3488         return replaceInstUsesWith(*II, Folded);
 3493       return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 3493       return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 3501     Value *Src0 = II->getArgOperand(0);
 3502     Value *Src1 = II->getArgOperand(1);
 3505       return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 3505       return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 3512     Value *Src = II->getArgOperand(0);
 3514       return replaceInstUsesWith(*II, Src);
 3517     Type *Ty = II->getType();
 3520     ConstantInt *CWidth = dyn_cast<ConstantInt>(II->getArgOperand(2));
 3524         return replaceInstUsesWith(*II, ConstantInt::getNullValue(Ty));
 3528         II->setArgOperand(2, ConstantInt::get(CWidth->getType(),
 3530         return II;
 3535     ConstantInt *COffset = dyn_cast<ConstantInt>(II->getArgOperand(1));
 3539         II->setArgOperand(1, ConstantInt::get(COffset->getType(),
 3541         return II;
 3561       RightShift->takeName(II);
 3562       return replaceInstUsesWith(*II, RightShift);
 3568     RightShift->takeName(II);
 3569     return replaceInstUsesWith(*II, RightShift);
 3573     ConstantInt *En = cast<ConstantInt>(II->getArgOperand(1));
 3583         Value *Src = II->getArgOperand(I + 2);
 3585           II->setArgOperand(I + 2, UndefValue::get(Src->getType()));
 3592       return II;
 3600     Value *Src0 = II->getArgOperand(0);
 3601     Value *Src1 = II->getArgOperand(1);
 3602     Value *Src2 = II->getArgOperand(2);
 3617       NewCall->copyFastMathFlags(II);
 3618       NewCall->takeName(II);
 3619       return replaceInstUsesWith(*II, NewCall);
 3642       II->setArgOperand(0, Src0);
 3643       II->setArgOperand(1, Src1);
 3644       II->setArgOperand(2, Src2);
 3645       return II;
 3653           return replaceInstUsesWith(*II,
 3663     const ConstantInt *CC = cast<ConstantInt>(II->getArgOperand(2));
 3673     Value *Src0 = II->getArgOperand(0);
 3674     Value *Src1 = II->getArgOperand(1);
 3681               *II, ConstantExpr::getSExt(CCmp, II->getType()));
 3681               *II, ConstantExpr::getSExt(CCmp, II->getType()));
 3690             II->getModule(), Intrinsic::read_register, II->getType());
 3690             II->getModule(), Intrinsic::read_register, II->getType());
 3691         Metadata *MDArgs[] = {MDString::get(II->getContext(), "exec")};
 3692         MDNode *MD = MDNode::get(II->getContext(), MDArgs);
 3693         Value *Args[] = {MetadataAsValue::get(II->getContext(), MD)};
 3697         NewCall->takeName(II);
 3698         return replaceInstUsesWith(*II, NewCall);
 3704       II->setArgOperand(0, Src1);
 3705       II->setArgOperand(1, Src0);
 3706       II->setArgOperand(2, ConstantInt::get(CC->getType(),
 3708       return II;
 3724       II->setArgOperand(1, ConstantInt::getNullValue(Src1->getType()));
 3725       II->setArgOperand(2, ConstantInt::get(CC->getType(), CmpInst::ICMP_NE));
 3726       return II;
 3785           Intrinsic::getDeclaration(II->getModule(), NewIID,
 3786                                     { II->getType(),
 3791       NewCall->takeName(II);
 3792       return replaceInstUsesWith(*II, NewCall);
 3799     if (!isa<Constant>(II->getArgOperand(0)))
 3802     return replaceInstUsesWith(*II, II->getArgOperand(0));
 3802     return replaceInstUsesWith(*II, II->getArgOperand(0));
 3805     const ConstantInt *C = dyn_cast<ConstantInt>(II->getArgOperand(0));
 3813     Value *Old = II->getArgOperand(0);
 3815     auto BC = cast<ConstantInt>(II->getArgOperand(5));
 3816     auto RM = cast<ConstantInt>(II->getArgOperand(3));
 3817     auto BM = cast<ConstantInt>(II->getArgOperand(4));
 3825     II->setOperand(0, UndefValue::get(Old->getType()));
 3826     return II;
 3831     if (Constant *C = dyn_cast<Constant>(II->getArgOperand(0)))
 3832       return replaceInstUsesWith(*II, C);
 3836     Value *Src = II->getArgOperand(0);
 3838     if (SrcInst && SrcInst->getParent() != II->getParent())
 3844       return replaceInstUsesWith(*II, Src);
 3849         return replaceInstUsesWith(*II, Src);
 3853                   m_Value(), m_Specific(II->getArgOperand(1)))))
 3854         return replaceInstUsesWith(*II, Src);
 3862     if (IntrinsicInst *SS = dyn_cast<IntrinsicInst>(II->getArgOperand(0))) {
 3865         if (SS->getNextNonDebugInstruction() == II) {
 3873     BasicBlock::iterator BI(II);
 3874     Instruction *TI = II->getParent()->getTerminator();
 3912     if (II->getFunction()->hasFnAttribute(Attribute::SanitizeAddress) ||
 3913         II->getFunction()->hasFnAttribute(Attribute::SanitizeMemory) ||
 3914         II->getFunction()->hasFnAttribute(Attribute::SanitizeHWAddress))
 3917     if (removeTriviallyEmptyRange(*II, Intrinsic::lifetime_start,
 3922     Value *IIOperand = II->getArgOperand(0);
 3926     Instruction *Next = II->getNextNonDebugInstruction();
 3933     FunctionType *AssumeIntrinsicTy = II->getFunctionType();
 3934     Value *AssumeIntrinsic = II->getCalledValue();
 3937       Builder.CreateCall(AssumeIntrinsicTy, AssumeIntrinsic, A, II->getName());
 3938       Builder.CreateCall(AssumeIntrinsicTy, AssumeIntrinsic, B, II->getName());
 3939       return eraseInstFromFunction(*II);
 3944                          Builder.CreateNot(A), II->getName());
 3946                          Builder.CreateNot(B), II->getName());
 3947       return eraseInstFromFunction(*II);
 3957         isValidAssumeForContext(II, LHS, &DT)) {
 3958       MDNode *MD = MDNode::get(II->getContext(), None);
 3960       return eraseInstFromFunction(*II);
 3969     computeKnownBits(IIOperand, Known, 0, II);
 3971       return eraseInstFromFunction(*II);
 3975     AC.updateAffectedValues(II);
 3979     auto &GCR = *cast<GCRelocateInst>(II);
 3986       II->setOperand(2, ConstantInt::get(OpIntTy, GCR.getBasePtrIndex()));
 3987       return II;
 3997     if (II->use_empty())
 3998       return eraseInstFromFunction(*II);
 4006       return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 4006       return replaceInstUsesWith(*II, UndefValue::get(II->getType()));
 4008     if (auto *PT = dyn_cast<PointerType>(II->getType())) {
 4014         return replaceInstUsesWith(*II, ConstantPointerNull::get(PT));
 4017       if (!II->hasRetAttr(Attribute::NonNull) &&
 4018           isKnownNonZero(DerivedPtr, DL, 0, &AC, II, &DT)) {
 4019         II->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull);
 4020         return II;
 4035     Instruction *NextInst = II->getNextNode();
 4045       Value *CurrCond = II->getArgOperand(0);
 4052       Instruction* MoveI = II->getNextNode();
 4056         Temp->moveBefore(II);
 4058       II->setArgOperand(0, Builder.CreateAnd(CurrCond, NextCond));
 4064   return visitCallBase(*II);