Lines Matching refs:AI

262   bool isInterestingAlloca(const AllocaInst &AI);
263 bool tagAlloca(IRBuilder<> &IRB, AllocaInst *AI, Value *Tag, size_t Size);
274 Value *getAllocaTag(IRBuilder<> &IRB, Value *StackTag, AllocaInst *AI,
959 static uint64_t getAllocaSizeInBytes(const AllocaInst &AI) { in getAllocaSizeInBytes() argument
961 if (AI.isArrayAllocation()) { in getAllocaSizeInBytes()
962 const ConstantInt *CI = dyn_cast<ConstantInt>(AI.getArraySize()); in getAllocaSizeInBytes()
966 Type *Ty = AI.getAllocatedType(); in getAllocaSizeInBytes()
967 uint64_t SizeInBytes = AI.getModule()->getDataLayout().getTypeAllocSize(Ty); in getAllocaSizeInBytes()
971 bool HWAddressSanitizer::tagAlloca(IRBuilder<> &IRB, AllocaInst *AI, Value *Tag, in tagAlloca() argument
980 {IRB.CreatePointerCast(AI, Int8PtrTy), JustTag, in tagAlloca()
984 Value *ShadowPtr = memToShadow(IRB.CreatePointerCast(AI, IntptrTy), IRB); in tagAlloca()
998 Int8Ty, IRB.CreateBitCast(AI, Int8PtrTy), in tagAlloca()
1066 AllocaInst *AI, unsigned AllocaNo) { in getAllocaTag() argument
1244 auto *AI = Allocas[N]; in instrumentStack() local
1245 IRBuilder<> IRB(AI->getNextNode()); in instrumentStack()
1248 Value *Tag = getAllocaTag(IRB, StackTag, AI, N); in instrumentStack()
1249 Value *AILong = IRB.CreatePointerCast(AI, IntptrTy); in instrumentStack()
1250 Value *Replacement = tagPointer(IRB, AI->getType(), AILong, Tag); in instrumentStack()
1252 AI->hasName() ? AI->getName().str() : "alloca." + itostr(N); in instrumentStack()
1255 AI->replaceUsesWithIf(Replacement, in instrumentStack()
1258 for (auto *DDI : AllocaDbgMap.lookup(AI)) { in instrumentStack()
1265 if (DDI->getVariableLocationOp(LocNo) == AI) in instrumentStack()
1270 size_t Size = getAllocaSizeInBytes(*AI); in instrumentStack()
1271 tagAlloca(IRB, AI, Tag, Size); in instrumentStack()
1278 tagAlloca(IRB, AI, Tag, alignTo(Size, Mapping.getObjectAlignment())); in instrumentStack()
1285 bool HWAddressSanitizer::isInterestingAlloca(const AllocaInst &AI) { in isInterestingAlloca() argument
1286 return (AI.getAllocatedType()->isSized() && in isInterestingAlloca()
1288 AI.isStaticAlloca() && in isInterestingAlloca()
1290 getAllocaSizeInBytes(AI) > 0 && in isInterestingAlloca()
1293 !isAllocaPromotable(&AI) && in isInterestingAlloca()
1296 !AI.isUsedWithInAlloca() && in isInterestingAlloca()
1298 !AI.isSwiftError()) && in isInterestingAlloca()
1300 !(SSI && SSI->isSafe(AI)); in isInterestingAlloca()
1321 if (AllocaInst *AI = dyn_cast<AllocaInst>(&Inst)) { in sanitizeFunction() local
1322 if (isInterestingAlloca(*AI)) in sanitizeFunction()
1323 AllocasToInstrument.push_back(AI); in sanitizeFunction()
1386 for (AllocaInst *AI : AllocasToInstrument) { in sanitizeFunction()
1387 uint64_t Size = getAllocaSizeInBytes(*AI); in sanitizeFunction()
1389 AI->setAlignment( in sanitizeFunction()
1390 Align(std::max(AI->getAlignment(), Mapping.getObjectAlignment()))); in sanitizeFunction()
1392 Type *AllocatedType = AI->getAllocatedType(); in sanitizeFunction()
1393 if (AI->isArrayAllocation()) { in sanitizeFunction()
1395 cast<ConstantInt>(AI->getArraySize())->getZExtValue(); in sanitizeFunction()
1401 TypeWithPadding, AI->getType()->getAddressSpace(), nullptr, "", AI); in sanitizeFunction()
1402 NewAI->takeName(AI); in sanitizeFunction()
1403 NewAI->setAlignment(AI->getAlign()); in sanitizeFunction()
1404 NewAI->setUsedWithInAlloca(AI->isUsedWithInAlloca()); in sanitizeFunction()
1405 NewAI->setSwiftError(AI->isSwiftError()); in sanitizeFunction()
1406 NewAI->copyMetadata(*AI); in sanitizeFunction()
1407 auto *Bitcast = new BitCastInst(NewAI, AI->getType(), "", AI); in sanitizeFunction()
1408 AI->replaceAllUsesWith(Bitcast); in sanitizeFunction()
1409 AllocaToPaddedAllocaMap[AI] = NewAI; in sanitizeFunction()
1420 if (auto *AI = dyn_cast_or_null<AllocaInst>(V)) { in sanitizeFunction() local
1421 if (auto *NewAI = AllocaToPaddedAllocaMap.lookup(AI)) in sanitizeFunction()
1441 if (auto *AI = dyn_cast<AllocaInst>(I)) in sanitizeFunction() local
1442 if (isa<ConstantInt>(AI->getArraySize())) in sanitizeFunction()