Lines Matching refs:AI

164   uint64_t getStaticAllocaAllocationSize(const AllocaInst* AI);
220 uint64_t SafeStack::getStaticAllocaAllocationSize(const AllocaInst* AI) { in getStaticAllocaAllocationSize() argument
221 uint64_t Size = DL.getTypeAllocSize(AI->getAllocatedType()); in getStaticAllocaAllocationSize()
222 if (AI->isArrayAllocation()) { in getStaticAllocaAllocationSize()
223 auto C = dyn_cast<ConstantInt>(AI->getArraySize()); in getStaticAllocaAllocationSize()
385 if (auto AI = dyn_cast<AllocaInst>(&I)) { in findInsts() local
388 uint64_t Size = getStaticAllocaAllocationSize(AI); in findInsts()
389 if (IsSafeStackAlloca(AI, Size)) in findInsts()
392 if (AI->isStaticAlloca()) { in findInsts()
394 StaticAllocas.push_back(AI); in findInsts()
397 DynamicAllocas.push_back(AI); in findInsts()
521 for (AllocaInst *AI : StaticAllocas) { in moveStaticAllocasToUnsafeStack()
522 Type *Ty = AI->getAllocatedType(); in moveStaticAllocasToUnsafeStack()
523 uint64_t Size = getStaticAllocaAllocationSize(AI); in moveStaticAllocasToUnsafeStack()
529 std::max((unsigned)DL.getPrefTypeAlignment(Ty), AI->getAlignment()); in moveStaticAllocasToUnsafeStack()
531 SSL.addObject(AI, Size, Align, SSC.getLiveRange(AI)); in moveStaticAllocasToUnsafeStack()
586 for (AllocaInst *AI : StaticAllocas) { in moveStaticAllocasToUnsafeStack()
587 IRB.SetInsertPoint(AI); in moveStaticAllocasToUnsafeStack()
588 unsigned Offset = SSL.getObjectOffset(AI); in moveStaticAllocasToUnsafeStack()
590 uint64_t Size = getStaticAllocaAllocationSize(AI); in moveStaticAllocasToUnsafeStack()
594 replaceDbgDeclareForAlloca(AI, BasePointer, DIB, DIExpression::NoDeref, in moveStaticAllocasToUnsafeStack()
596 replaceDbgValueForAlloca(AI, BasePointer, DIB, -Offset); in moveStaticAllocasToUnsafeStack()
600 std::string Name = std::string(AI->getName()) + ".unsafe"; in moveStaticAllocasToUnsafeStack()
601 while (!AI->use_empty()) { in moveStaticAllocasToUnsafeStack()
602 Use &U = *AI->use_begin(); in moveStaticAllocasToUnsafeStack()
614 Value *Replacement = IRBUser.CreateBitCast(Off, AI->getType(), Name); in moveStaticAllocasToUnsafeStack()
628 AI->eraseFromParent(); in moveStaticAllocasToUnsafeStack()
651 for (AllocaInst *AI : DynamicAllocas) { in moveDynamicAllocasToUnsafeStack()
652 IRBuilder<> IRB(AI); in moveDynamicAllocasToUnsafeStack()
655 Value *ArraySize = AI->getArraySize(); in moveDynamicAllocasToUnsafeStack()
659 Type *Ty = AI->getAllocatedType(); in moveDynamicAllocasToUnsafeStack()
668 std::max((unsigned)DL.getPrefTypeAlignment(Ty), AI->getAlignment()), in moveDynamicAllocasToUnsafeStack()
681 Value *NewAI = IRB.CreatePointerCast(NewTop, AI->getType()); in moveDynamicAllocasToUnsafeStack()
682 if (AI->hasName() && isa<Instruction>(NewAI)) in moveDynamicAllocasToUnsafeStack()
683 NewAI->takeName(AI); in moveDynamicAllocasToUnsafeStack()
685 replaceDbgDeclareForAlloca(AI, NewAI, DIB, DIExpression::NoDeref, 0, in moveDynamicAllocasToUnsafeStack()
687 AI->replaceAllUsesWith(NewAI); in moveDynamicAllocasToUnsafeStack()
688 AI->eraseFromParent(); in moveDynamicAllocasToUnsafeStack()