Lines Matching refs:AI
148 uint64_t getStaticAllocaAllocationSize(const AllocaInst* AI);
213 uint64_t SafeStack::getStaticAllocaAllocationSize(const AllocaInst* AI) { in getStaticAllocaAllocationSize() argument
214 uint64_t Size = DL->getTypeAllocSize(AI->getAllocatedType()); in getStaticAllocaAllocationSize()
215 if (AI->isArrayAllocation()) { in getStaticAllocaAllocationSize()
216 auto C = dyn_cast<ConstantInt>(AI->getArraySize()); in getStaticAllocaAllocationSize()
412 if (auto AI = dyn_cast<AllocaInst>(&I)) { in findInsts() local
415 uint64_t Size = getStaticAllocaAllocationSize(AI); in findInsts()
416 if (IsSafeStackAlloca(AI, Size)) in findInsts()
419 if (AI->isStaticAlloca()) { in findInsts()
421 StaticAllocas.push_back(AI); in findInsts()
424 DynamicAllocas.push_back(AI); in findInsts()
548 for (AllocaInst *AI : StaticAllocas) { in moveStaticAllocasToUnsafeStack()
549 Type *Ty = AI->getAllocatedType(); in moveStaticAllocasToUnsafeStack()
550 uint64_t Size = getStaticAllocaAllocationSize(AI); in moveStaticAllocasToUnsafeStack()
556 std::max((unsigned)DL->getPrefTypeAlignment(Ty), AI->getAlignment()); in moveStaticAllocasToUnsafeStack()
558 SSL.addObject(AI, Size, Align, SSC.getLiveRange(AI)); in moveStaticAllocasToUnsafeStack()
612 for (AllocaInst *AI : StaticAllocas) { in moveStaticAllocasToUnsafeStack()
613 IRB.SetInsertPoint(AI); in moveStaticAllocasToUnsafeStack()
614 unsigned Offset = SSL.getObjectOffset(AI); in moveStaticAllocasToUnsafeStack()
616 uint64_t Size = getStaticAllocaAllocationSize(AI); in moveStaticAllocasToUnsafeStack()
620 replaceDbgDeclareForAlloca(AI, BasePointer, DIB, /*Deref=*/true, -Offset); in moveStaticAllocasToUnsafeStack()
621 replaceDbgValueForAlloca(AI, BasePointer, DIB, -Offset); in moveStaticAllocasToUnsafeStack()
625 std::string Name = std::string(AI->getName()) + ".unsafe"; in moveStaticAllocasToUnsafeStack()
626 while (!AI->use_empty()) { in moveStaticAllocasToUnsafeStack()
627 Use &U = *AI->use_begin(); in moveStaticAllocasToUnsafeStack()
639 Value *Replacement = IRBUser.CreateBitCast(Off, AI->getType(), Name); in moveStaticAllocasToUnsafeStack()
653 AI->eraseFromParent(); in moveStaticAllocasToUnsafeStack()
676 for (AllocaInst *AI : DynamicAllocas) { in moveDynamicAllocasToUnsafeStack()
677 IRBuilder<> IRB(AI); in moveDynamicAllocasToUnsafeStack()
680 Value *ArraySize = AI->getArraySize(); in moveDynamicAllocasToUnsafeStack()
684 Type *Ty = AI->getAllocatedType(); in moveDynamicAllocasToUnsafeStack()
693 std::max((unsigned)DL->getPrefTypeAlignment(Ty), AI->getAlignment()), in moveDynamicAllocasToUnsafeStack()
706 Value *NewAI = IRB.CreatePointerCast(NewTop, AI->getType()); in moveDynamicAllocasToUnsafeStack()
707 if (AI->hasName() && isa<Instruction>(NewAI)) in moveDynamicAllocasToUnsafeStack()
708 NewAI->takeName(AI); in moveDynamicAllocasToUnsafeStack()
710 replaceDbgDeclareForAlloca(AI, NewAI, DIB, /*Deref=*/true); in moveDynamicAllocasToUnsafeStack()
711 AI->replaceAllUsesWith(NewAI); in moveDynamicAllocasToUnsafeStack()
712 AI->eraseFromParent(); in moveDynamicAllocasToUnsafeStack()