[all-commits] [llvm/llvm-project] db3578: Infer dereferenceability from malloc and friends

Philip Reames via All-commits all-commits at lists.llvm.org
Thu Apr 1 11:33:54 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: db357891f0cf76253be3cd75f682b68544a411da
      https://github.com/llvm/llvm-project/commit/db357891f0cf76253be3cd75f682b68544a411da
  Author: Philip Reames <listmail at philipreames.com>
  Date:   2021-04-01 (Thu, 01 Apr 2021)

  Changed paths:
    M llvm/lib/Analysis/Loads.cpp
    M llvm/test/Transforms/LICM/hoist-alloc.ll

  Log Message:
  -----------
  Infer dereferenceability from malloc and friends

Hookup TLI when inferring object size from allocation calls. This allows the analysis to prove dereferenceability for known allocation functions (such as malloc/new/etc) in addition to those marked explicitly with the allocsize attribute.

This is a follow up to 0129cd5 now that the bug fixed by e2c6621e6 is resolved.

As noted in the test, this relies on being able to prove that there is no free between allocation and context (e.g. hoist location). At the moment, this is handled conservatively. I'm working strengthening out ability to reason about no-free regions separately.

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




More information about the All-commits mailing list