Lines Matching refs:AI

170   uint64_t getStaticAllocaAllocationSize(const AllocaInst* AI);
224 uint64_t SafeStack::getStaticAllocaAllocationSize(const AllocaInst* AI) { in getStaticAllocaAllocationSize() argument
225 uint64_t Size = DL.getTypeAllocSize(AI->getAllocatedType()); in getStaticAllocaAllocationSize()
226 if (AI->isArrayAllocation()) { in getStaticAllocaAllocationSize()
227 auto C = dyn_cast<ConstantInt>(AI->getArraySize()); in getStaticAllocaAllocationSize()
393 if (auto AI = dyn_cast<AllocaInst>(&I)) { in findInsts() local
396 uint64_t Size = getStaticAllocaAllocationSize(AI); in findInsts()
397 if (IsSafeStackAlloca(AI, Size)) in findInsts()
400 if (AI->isStaticAlloca()) { in findInsts()
402 StaticAllocas.push_back(AI); in findInsts()
405 DynamicAllocas.push_back(AI); in findInsts()
540 for (AllocaInst *AI : StaticAllocas) { in moveStaticAllocasToUnsafeStack()
541 Type *Ty = AI->getAllocatedType(); in moveStaticAllocasToUnsafeStack()
542 uint64_t Size = getStaticAllocaAllocationSize(AI); in moveStaticAllocasToUnsafeStack()
548 std::max((unsigned)DL.getPrefTypeAlignment(Ty), AI->getAlignment()); in moveStaticAllocasToUnsafeStack()
550 SSL.addObject(AI, Size, Align, in moveStaticAllocasToUnsafeStack()
551 ClColoring ? SSC.getLiveRange(AI) : NoColoringRange); in moveStaticAllocasToUnsafeStack()
606 for (AllocaInst *AI : StaticAllocas) { in moveStaticAllocasToUnsafeStack()
607 IRB.SetInsertPoint(AI); in moveStaticAllocasToUnsafeStack()
608 unsigned Offset = SSL.getObjectOffset(AI); in moveStaticAllocasToUnsafeStack()
610 replaceDbgDeclare(AI, BasePointer, DIB, DIExpression::ApplyOffset, -Offset); in moveStaticAllocasToUnsafeStack()
611 replaceDbgValueForAlloca(AI, BasePointer, DIB, -Offset); in moveStaticAllocasToUnsafeStack()
615 std::string Name = std::string(AI->getName()) + ".unsafe"; in moveStaticAllocasToUnsafeStack()
616 while (!AI->use_empty()) { in moveStaticAllocasToUnsafeStack()
617 Use &U = *AI->use_begin(); in moveStaticAllocasToUnsafeStack()
629 Value *Replacement = IRBUser.CreateBitCast(Off, AI->getType(), Name); in moveStaticAllocasToUnsafeStack()
639 AI->eraseFromParent(); in moveStaticAllocasToUnsafeStack()
662 for (AllocaInst *AI : DynamicAllocas) { in moveDynamicAllocasToUnsafeStack()
663 IRBuilder<> IRB(AI); in moveDynamicAllocasToUnsafeStack()
666 Value *ArraySize = AI->getArraySize(); in moveDynamicAllocasToUnsafeStack()
670 Type *Ty = AI->getAllocatedType(); in moveDynamicAllocasToUnsafeStack()
680 std::max((unsigned)DL.getPrefTypeAlignment(Ty), AI->getAlignment()), in moveDynamicAllocasToUnsafeStack()
693 Value *NewAI = IRB.CreatePointerCast(NewTop, AI->getType()); in moveDynamicAllocasToUnsafeStack()
694 if (AI->hasName() && isa<Instruction>(NewAI)) in moveDynamicAllocasToUnsafeStack()
695 NewAI->takeName(AI); in moveDynamicAllocasToUnsafeStack()
697 replaceDbgDeclare(AI, NewAI, DIB, DIExpression::ApplyOffset, 0); in moveDynamicAllocasToUnsafeStack()
698 AI->replaceAllUsesWith(NewAI); in moveDynamicAllocasToUnsafeStack()
699 AI->eraseFromParent(); in moveDynamicAllocasToUnsafeStack()