[llvm] [Attributor] New attribute to identify what byte ranges are alive for an allocation (PR #66148)
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 27 13:55:19 PDT 2023
================
@@ -12658,6 +12665,232 @@ struct AAAddressSpaceCallSiteArgument final : AAAddressSpaceImpl {
};
} // namespace
+/// ----------- Allocation Info ----------
+namespace {
+struct AAAllocationInfoImpl : public AAAllocationInfo {
+ AAAllocationInfoImpl(const IRPosition &IRP, Attributor &A)
+ : AAAllocationInfo(IRP, A) {}
+
+ std::optional<TypeSize> getAllocatedSize() const override {
+ assert(isValidState() && "the AA is invalid");
+ return AssumedAllocatedSize;
+ }
+
+ ChangeStatus updateImpl(Attributor &A) override {
+
+ const IRPosition &IRP = getIRPosition();
+ Instruction *I = IRP.getCtxI();
+
+ /*TODO: update check for malloc like calls.*/
+ if (!isa<AllocaInst>(I))
+ return indicatePessimisticFixpoint();
+
+ bool IsKnownNoCapture;
+ if (!AA::hasAssumedIRAttr<Attribute::NoCapture>(
+ A, this, IRP, DepClassTy::OPTIONAL, IsKnownNoCapture))
+ return indicatePessimisticFixpoint();
+
+ if (IsKnownNoCapture)
+ return indicatePessimisticFixpoint();
----------------
jdoerfert wrote:
Why is known no capture bad?
https://github.com/llvm/llvm-project/pull/66148
More information about the llvm-commits
mailing list