[all-commits] [llvm/llvm-project] 5e8f59: [clang][dataflow] Only model struct fields that ar...

Yitzhak Mandelbaum via All-commits all-commits at lists.llvm.org
Thu Jan 5 13:47:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5e8f597c2fedc740b71f07dfdb1ef3c2d348b193
      https://github.com/llvm/llvm-project/commit/5e8f597c2fedc740b71f07dfdb1ef3c2d348b193
  Author: Yitzhak Mandelbaum <yitzhakm at google.com>
  Date:   2023-01-05 (Thu, 05 Jan 2023)

  Changed paths:
    M clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
    M clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
    M clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
    M clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
    M clang/lib/Analysis/FlowSensitive/Transfer.cpp
    M clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp
    M clang/unittests/Analysis/FlowSensitive/TestingSupport.h
    M clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Only model struct fields that are used in the function being analyzed.

Previously, the model for structs modeled all fields in a struct when
`createValue` was called for that type. This patch adds a prepass on the
function under analysis to discover the fields referenced in the scope and then
limits modeling to only those fields.  This reduces wasted memory usage
(modeling unused fields) which can be important for programss that use large
structs.

Note: This patch obviates the need for https://reviews.llvm.org/D123032.

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




More information about the All-commits mailing list