Lines Matching refs:AI
633 uint64_t getAllocaSizeInBytes(const AllocaInst &AI) const { in getAllocaSizeInBytes()
635 if (AI.isArrayAllocation()) { in getAllocaSizeInBytes()
636 const ConstantInt *CI = dyn_cast<ConstantInt>(AI.getArraySize()); in getAllocaSizeInBytes()
640 Type *Ty = AI.getAllocatedType(); in getAllocaSizeInBytes()
642 AI.getModule()->getDataLayout().getTypeAllocSize(Ty); in getAllocaSizeInBytes()
647 bool isInterestingAlloca(const AllocaInst &AI);
858 AllocaInst *AI; member
977 void handleDynamicAllocaCall(AllocaInst *AI);
980 void visitAllocaInst(AllocaInst &AI) { in visitAllocaInst()
981 if (!ASan.isInterestingAlloca(AI)) { in visitAllocaInst()
982 if (AI.isStaticAlloca()) { in visitAllocaInst()
988 StaticAllocasToMoveUp.push_back(&AI); in visitAllocaInst()
993 StackAlignment = std::max(StackAlignment, AI.getAlignment()); in visitAllocaInst()
994 if (!AI.isStaticAlloca()) in visitAllocaInst()
995 DynamicAllocaVec.push_back(&AI); in visitAllocaInst()
997 AllocaVec.push_back(&AI); in visitAllocaInst()
1021 AllocaInst *AI = findAllocaForValue(II.getArgOperand(1)); in visitIntrinsicInst() local
1022 if (!AI || !ASan.isInterestingAlloca(*AI)) in visitIntrinsicInst()
1025 AllocaPoisonCall APC = {&II, AI, SizeValue, DoPoison}; in visitIntrinsicInst()
1026 if (AI->isStaticAlloca()) in visitIntrinsicInst()
1191 bool AddressSanitizer::isInterestingAlloca(const AllocaInst &AI) { in isInterestingAlloca() argument
1192 auto PreviouslySeenAllocaInfo = ProcessedAllocas.find(&AI); in isInterestingAlloca()
1198 (AI.getAllocatedType()->isSized() && in isInterestingAlloca()
1200 ((!AI.isStaticAlloca()) || getAllocaSizeInBytes(AI) > 0) && in isInterestingAlloca()
1203 (!ClSkipPromotableAllocas || !isAllocaPromotable(&AI)) && in isInterestingAlloca()
1206 !AI.isUsedWithInAlloca() && in isInterestingAlloca()
1208 !AI.isSwiftError()); in isInterestingAlloca()
1210 ProcessedAllocas[&AI] = IsInteresting; in isInterestingAlloca()
1302 if (auto AI = dyn_cast_or_null<AllocaInst>(PtrOperand)) in isInterestingMemoryAccess() local
1303 return isInterestingAlloca(*AI) ? AI : nullptr; in isInterestingMemoryAccess()
2485 AllocaInst *AI = dyn_cast<AllocaInst>(Arg->stripPointerCasts()); in markEscapedLocalAllocas() local
2486 assert(AI && AI->isStaticAlloca() && in markEscapedLocalAllocas()
2488 ProcessedAllocas[AI] = false; in markEscapedLocalAllocas()
2792 AllocaInst *AI = IRB.CreateAlloca( in copyArgsPassedByValToAllocas() local
2796 AI->setAlignment(Align); in copyArgsPassedByValToAllocas()
2797 Arg.replaceAllUsesWith(AI); in copyArgsPassedByValToAllocas()
2800 IRB.CreateMemCpy(AI, Align, &Arg, Align, AllocSize); in copyArgsPassedByValToAllocas()
2852 assert(APC.AI); in processDynamicAllocas()
2853 assert(ASan.isInterestingAlloca(*APC.AI)); in processDynamicAllocas()
2854 assert(!APC.AI->isStaticAlloca()); in processDynamicAllocas()
2857 poisonAlloca(APC.AI, APC.Size, IRB, APC.DoPoison); in processDynamicAllocas()
2865 for (auto &AI : DynamicAllocaVec) in processDynamicAllocas() local
2866 handleDynamicAllocaCall(AI); in processDynamicAllocas()
2890 for (auto *AI : StaticAllocasToMoveUp) in processStaticAllocas() local
2891 if (AI->getParent() == InsBeforeB) in processStaticAllocas()
2892 AI->moveBefore(InsBefore); in processStaticAllocas()
2899 for (AllocaInst *AI : AllocaVec) { in processStaticAllocas()
2900 ASanStackVariableDescription D = {AI->getName().data(), in processStaticAllocas()
2901 ASan.getAllocaSizeInBytes(*AI), in processStaticAllocas()
2903 AI->getAlignment(), in processStaticAllocas()
2904 AI, in processStaticAllocas()
2920 AllocaToSVDMap[Desc.AI] = &Desc; in processStaticAllocas()
2925 assert(APC.AI); in processStaticAllocas()
2926 assert(ASan.isInterestingAlloca(*APC.AI)); in processStaticAllocas()
2927 assert(APC.AI->isStaticAlloca()); in processStaticAllocas()
2929 ASanStackVariableDescription &Desc = *AllocaToSVDMap[APC.AI]; in processStaticAllocas()
3015 AllocaInst *AI = Desc.AI; in processStaticAllocas() local
3016 replaceDbgDeclareForAlloca(AI, LocalStackBaseAlloca, DIB, Deref, in processStaticAllocas()
3020 AI->getType()); in processStaticAllocas()
3021 AI->replaceAllUsesWith(NewAllocaPtr); in processStaticAllocas()
3059 const ASanStackVariableDescription &Desc = *AllocaToSVDMap[APC.AI]; in processStaticAllocas()
3127 for (auto AI : AllocaVec) AI->eraseFromParent(); in processStaticAllocas() local
3150 if (AllocaInst *AI = dyn_cast<AllocaInst>(V)) in findAllocaForValue() local
3152 return ASan.isInterestingAlloca(*AI) ? AI : nullptr; in findAllocaForValue()
3183 void FunctionStackPoisoner::handleDynamicAllocaCall(AllocaInst *AI) { in handleDynamicAllocaCall() argument
3184 IRBuilder<> IRB(AI); in handleDynamicAllocaCall()
3186 const unsigned Align = std::max(kAllocaRzSize, AI->getAlignment()); in handleDynamicAllocaCall()
3198 F.getParent()->getDataLayout().getTypeAllocSize(AI->getAllocatedType()); in handleDynamicAllocaCall()
3200 IRB.CreateMul(IRB.CreateIntCast(AI->getArraySize(), IntptrTy, false), in handleDynamicAllocaCall()
3236 Value *NewAddressPtr = IRB.CreateIntToPtr(NewAddress, AI->getType()); in handleDynamicAllocaCall()
3239 AI->replaceAllUsesWith(NewAddressPtr); in handleDynamicAllocaCall()
3242 AI->eraseFromParent(); in handleDynamicAllocaCall()