[PATCH] D87975: [IR] MaxObjSize Attribute

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 12:18:04 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/lib/IR/Value.cpp:723
+    if (!AI->isArrayAllocation()) {
+      MaxObjSizeBytes = DL.getTypeStoreSize(AI->getAllocatedType());
+    }
----------------
atmnpatel wrote:
> efriedma wrote:
> > Can you use llvm::getObjectSize here, instead of rolling your own version that has bugs?
> I don't think we can, this check here is trying to offload the actual max object size calculation to the Attributor, while getObjectSize doesn't take the attributes into account at all (from what I can tell).
I mean specifically for the cases where there aren't relevant attributes, like AllocaInst and GlobalVariable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87975/new/

https://reviews.llvm.org/D87975



More information about the llvm-commits mailing list