[all-commits] [llvm/llvm-project] cf66f0: [Attributor] Share code for abstract interpretatio...

Philip Reames via All-commits all-commits at lists.llvm.org
Thu Jan 13 15:33:40 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf66f01ec13807c6495c145d0f7713441979a23a
      https://github.com/llvm/llvm-project/commit/cf66f01ec13807c6495c145d0f7713441979a23a
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2022-01-13 (Thu, 13 Jan 2022)

  Changed paths:
    M llvm/include/llvm/Analysis/MemoryBuiltins.h
    M llvm/lib/Analysis/MemoryBuiltins.cpp
    M llvm/lib/Transforms/IPO/AttributorAttributes.cpp

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

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:
* 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.
* 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.

Differential Revision: https://reviews.llvm.org/D117241


  Commit: 5d5d4d94f0c405222628b57f78d2e8fdc9eea5d3
      https://github.com/llvm/llvm-project/commit/5d5d4d94f0c405222628b57f78d2e8fdc9eea5d3
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2022-01-13 (Thu, 13 Jan 2022)

  Changed paths:
    M llvm/lib/Transforms/IPO/AttributorAttributes.cpp

  Log Message:
  -----------
  [Attributor] Generalize heap to stack to any allocator with relevant properties

This completes removal of the isXLike queries, and depends on a whole series of earlier patches which have already landed.

Differential Revision: https://reviews.llvm.org/D117242


Compare: https://github.com/llvm/llvm-project/compare/049ae93097c0...5d5d4d94f0c4


More information about the All-commits mailing list