Lines Matching refs:AI

151   uint64_t getStaticAllocaAllocationSize(const AllocaInst* AI);
206 uint64_t SafeStack::getStaticAllocaAllocationSize(const AllocaInst* AI) { in getStaticAllocaAllocationSize() argument
207 uint64_t Size = DL.getTypeAllocSize(AI->getAllocatedType()); in getStaticAllocaAllocationSize()
208 if (AI->isArrayAllocation()) { in getStaticAllocaAllocationSize()
209 auto C = dyn_cast<ConstantInt>(AI->getArraySize()); in getStaticAllocaAllocationSize()
384 if (auto AI = dyn_cast<AllocaInst>(&I)) { in findInsts() local
387 uint64_t Size = getStaticAllocaAllocationSize(AI); in findInsts()
388 if (IsSafeStackAlloca(AI, Size)) in findInsts()
391 if (AI->isStaticAlloca()) { in findInsts()
393 StaticAllocas.push_back(AI); in findInsts()
396 DynamicAllocas.push_back(AI); in findInsts()
531 for (AllocaInst *AI : StaticAllocas) { in moveStaticAllocasToUnsafeStack()
532 Type *Ty = AI->getAllocatedType(); in moveStaticAllocasToUnsafeStack()
533 uint64_t Size = getStaticAllocaAllocationSize(AI); in moveStaticAllocasToUnsafeStack()
538 Align Align = std::max(DL.getPrefTypeAlign(Ty), AI->getAlign()); in moveStaticAllocasToUnsafeStack()
540 SSL.addObject(AI, Size, Align, in moveStaticAllocasToUnsafeStack()
541 ClColoring ? SSC.getLiveRange(AI) : NoColoringRange); in moveStaticAllocasToUnsafeStack()
596 for (AllocaInst *AI : StaticAllocas) { in moveStaticAllocasToUnsafeStack()
597 IRB.SetInsertPoint(AI); in moveStaticAllocasToUnsafeStack()
598 unsigned Offset = SSL.getObjectOffset(AI); in moveStaticAllocasToUnsafeStack()
600 replaceDbgDeclare(AI, BasePointer, DIB, DIExpression::ApplyOffset, -Offset); in moveStaticAllocasToUnsafeStack()
601 replaceDbgValueForAlloca(AI, BasePointer, DIB, -Offset); in moveStaticAllocasToUnsafeStack()
605 std::string Name = std::string(AI->getName()) + ".unsafe"; in moveStaticAllocasToUnsafeStack()
606 while (!AI->use_empty()) { in moveStaticAllocasToUnsafeStack()
607 Use &U = *AI->use_begin(); in moveStaticAllocasToUnsafeStack()
619 Value *Replacement = IRBUser.CreateBitCast(Off, AI->getType(), Name); in moveStaticAllocasToUnsafeStack()
629 AI->eraseFromParent(); in moveStaticAllocasToUnsafeStack()
659 for (AllocaInst *AI : DynamicAllocas) { in moveDynamicAllocasToUnsafeStack()
660 IRBuilder<> IRB(AI); in moveDynamicAllocasToUnsafeStack()
663 Value *ArraySize = AI->getArraySize(); in moveDynamicAllocasToUnsafeStack()
667 Type *Ty = AI->getAllocatedType(); in moveDynamicAllocasToUnsafeStack()
676 auto Align = std::max(std::max(DL.getPrefTypeAlign(Ty), AI->getAlign()), in moveDynamicAllocasToUnsafeStack()
689 Value *NewAI = IRB.CreatePointerCast(NewTop, AI->getType()); in moveDynamicAllocasToUnsafeStack()
690 if (AI->hasName() && isa<Instruction>(NewAI)) in moveDynamicAllocasToUnsafeStack()
691 NewAI->takeName(AI); in moveDynamicAllocasToUnsafeStack()
693 replaceDbgDeclare(AI, NewAI, DIB, DIExpression::ApplyOffset, 0); in moveDynamicAllocasToUnsafeStack()
694 AI->replaceAllUsesWith(NewAI); in moveDynamicAllocasToUnsafeStack()
695 AI->eraseFromParent(); in moveDynamicAllocasToUnsafeStack()