[PATCH] D117241: [Attributor] Share code for abstract interpretation of allocation sizes with getObjectSize [NFC-ish]

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 12:05:10 PST 2022


reames created this revision.
reames added reviewers: Bryce-MW, durin42, jdoerfert.
Herald added subscribers: ormris, okura, kuter, uenoku, bollu, hiraditya, mcrosier.
Herald added a reviewer: uenoku.
Herald added a reviewer: homerdin.
reames requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.

This is an alternative to (part of D116971 <https://reviews.llvm.org/D116971>).  The basic idea is that we can parameterize the getObjectSize implementation with a callback which lets us replace the operand before analysis if desired.  This is what Attributor is doing during it's abstract interpretation, and allows us to have one copy of the code.

Note this is not NFC for two reasons:

1. The existing attributor code is wrong.  (Well, this is under-specified to be honest, but at least inconsistent.)  The intermediate math needs to be done in the index type of the pointer space.  Imagine e.g. i64 arguments in a 32 bit address space.
2. I did not preserve the behavior in getAPInt where we return 0 for a partially analyzed value.  This looks simply wrong in the original code, and nothing test wise contradicts that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117241

Files:
  llvm/include/llvm/Analysis/MemoryBuiltins.h
  llvm/lib/Analysis/MemoryBuiltins.cpp
  llvm/lib/Transforms/IPO/AttributorAttributes.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117241.399746.patch
Type: text/x-patch
Size: 8300 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220113/8caa6e89/attachment.bin>


More information about the llvm-commits mailing list