[all-commits] [llvm/llvm-project] 8d03a9: PR47805: Use a single object for a function parame...

Richard Smith via All-commits all-commits at lists.llvm.org
Tue Oct 13 15:55:42 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d03a972ce8e92815ffe3d5d86aa027605ed92e2
      https://github.com/llvm/llvm-project/commit/8d03a972ce8e92815ffe3d5d86aa027605ed92e2
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-10-13 (Tue, 13 Oct 2020)

  Changed paths:
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p6.cpp
    M clang/test/CXX/except/except.spec/p1.cpp
    M clang/test/CXX/expr/expr.const/p2-0x.cpp
    M clang/test/OpenMP/critical_messages.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_safelen_messages.cpp
    M clang/test/OpenMP/distribute_simd_safelen_messages.cpp
    M clang/test/OpenMP/distribute_simd_simdlen_messages.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_safelen_messages.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_simdlen_messages.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_safelen_messages.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_simdlen_messages.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_safelen_messages.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_simdlen_messages.cpp
    M clang/test/OpenMP/teams_distribute_simd_safelen_messages.cpp
    M clang/test/OpenMP/teams_distribute_simd_simdlen_messages.cpp
    M clang/test/Sema/builtin-expect-with-probability-avr.cpp
    M clang/test/Sema/builtin-expect-with-probability.cpp
    M clang/test/Sema/c89.c
    M clang/test/SemaCUDA/constexpr-variables.cu
    M clang/test/SemaCXX/c99-variable-length-array-cxx11.cpp
    M clang/test/SemaCXX/c99-variable-length-array.cpp
    M clang/test/SemaCXX/constant-expression-cxx11.cpp
    M clang/test/SemaCXX/constant-expression-cxx2a.cpp
    M clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
    M clang/test/SemaCXX/cxx2a-consteval.cpp
    M clang/test/SemaCXX/integer-overflow.cpp
    M clang/test/SemaCXX/vla-construct.cpp
    M clang/test/SemaCXX/warn-vla.cpp
    M clang/test/SemaTemplate/typo-dependent-name.cpp

  Log Message:
  -----------
  PR47805: Use a single object for a function parameter in the caller and
callee in constant evaluation.

We previously made a deep copy of function parameters of class type when
passing them, resulting in the destructor for the parameter applying to
the original argument value, ignoring any modifications made in the
function body. This also meant that the 'this' pointer of the function
parameter could be observed changing between the caller and the callee.

This change completely reimplements how we model function parameters
during constant evaluation. We now model them roughly as if they were
variables living in the caller, albeit with an artificially reduced
scope that covers only the duration of the function call, instead of
modeling them as temporaries in the caller that we partially "reparent"
into the callee at the point of the call. This brings some minor
diagnostic improvements, as well as significantly reduced stack usage
during constant evaluation.




More information about the All-commits mailing list