[all-commits] [llvm/llvm-project] ee655c: [CaptureTracking][FunctionAttrs] Add support for C...

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Feb 13 00:36:57 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ee655ca27aad466bcc54f6eba03f7e564940ad5a
      https://github.com/llvm/llvm-project/commit/ee655ca27aad466bcc54f6eba03f7e564940ad5a
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2025-02-13 (Thu, 13 Feb 2025)

  Changed paths:
    M clang/test/CodeGen/allow-ubsan-check.c
    M clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
    M clang/test/CodeGenCXX/RelativeVTablesABI/type-info.cpp
    M clang/test/CodeGenOpenCL/amdgcn-buffer-rsrc-type.cl
    M clang/test/CodeGenOpenCL/as_type.cl
    M llvm/include/llvm/Analysis/CaptureTracking.h
    M llvm/include/llvm/Support/ModRef.h
    M llvm/lib/Analysis/CaptureTracking.cpp
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
    M llvm/test/Transforms/FunctionAttrs/2009-01-02-LocalStores.ll
    M llvm/test/Transforms/FunctionAttrs/arg_returned.ll
    M llvm/test/Transforms/FunctionAttrs/nocapture.ll
    M llvm/test/Transforms/FunctionAttrs/nonnull.ll
    M llvm/test/Transforms/FunctionAttrs/noundef.ll
    M llvm/test/Transforms/FunctionAttrs/readattrs.ll
    M llvm/test/Transforms/FunctionAttrs/stats.ll
    M llvm/test/Transforms/PhaseOrdering/AArch64/block_scaling_decompr_8bit.ll
    M llvm/test/Transforms/PhaseOrdering/bitcast-store-branch.ll
    M llvm/test/Transforms/PhaseOrdering/dce-after-argument-promotion-loads.ll
    M llvm/test/Transforms/PhaseOrdering/enable-loop-header-duplication-oz.ll
    M llvm/unittests/Analysis/CaptureTrackingTest.cpp

  Log Message:
  -----------
  [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (#125880)

This extends CaptureTracking to support inferring non-trivial
CaptureInfos. The focus of this patch is to only support FunctionAttrs,
other users of CaptureTracking will be updated in followups.

The key API changes here are:

* DetermineUseCaptureKind() now returns a UseCaptureInfo where the UseCC
component specifies what is captured at that Use and the ResultCC
component specifies what may be captured via the return value of the
User. Usually only one or the other will be used (corresponding to
previous MAY_CAPTURE or PASSTHROUGH results), but both may be set for
call captures.
* The CaptureTracking::captures() extension point is passed this
UseCaptureInfo as well and then can decide what to do with it by
returning an Action, which is one of: Stop: stop traversal.
ContinueIgnoringReturn: continue traversal but don't follow the
instruction return value. Continue: continue traversal and follow the
instruction return value if it has additional CaptureComponents.

For now, this patch retains the (unsound) special logic for comparison
of null with a dereferenceable pointer. I'd like to switch key code to
take advantage of address/address_is_null before dropping it.

This PR mainly intends to introduce necessary API changes and basic
inference support, there are various possible improvements marked with
TODOs.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list