[all-commits] [llvm/llvm-project] ccf1e3: [clang][dataflow] Process terminator condition wit...

martinboehme via All-commits all-commits at lists.llvm.org
Tue Jan 23 01:19:19 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ccf1e322bd5828c74ac5213dc2e05ab506da25bd
      https://github.com/llvm/llvm-project/commit/ccf1e322bd5828c74ac5213dc2e05ab506da25bd
  Author: martinboehme <mboehme at google.com>
  Date:   2024-01-23 (Tue, 23 Jan 2024)

  Changed paths:
    M clang/include/clang/Analysis/FlowSensitive/Transfer.h
    M clang/lib/Analysis/FlowSensitive/Transfer.cpp
    M clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
    M clang/unittests/Analysis/FlowSensitive/LoggerTest.cpp
    M clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp
    M clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Process terminator condition within `transferCFGBlock()`. (#78127)

In particular, it's important that we create the "fallback" atomic at
this point
(which we produce if the transfer function didn't produce a value for
the
expression) so that it is placed in the correct environment.

Previously, we processed the terminator condition in the
`TerminatorVisitor`,
which put the fallback atomic in a copy of the environment that is
produced as
input for the _successor_ block, rather than the environment for the
block
containing the expression for which we produce the fallback atomic.

As a result, we produce different fallback atomics every time we process
the
successor block, and hence we don't have a consistent representation of
the
terminator condition in the flow condition.

This patch includes a test (authored by ymand@) that fails without the
fix.




More information about the All-commits mailing list