[all-commits] [llvm/llvm-project] 70aa46: [NFC][Clang][Codegen] Add tests with wrong attribu...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Thu May 13 10:34:29 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 70aa4623de9fe2f609eab8969d7ef76b4c80084b
      https://github.com/llvm/llvm-project/commit/70aa4623de9fe2f609eab8969d7ef76b4c80084b
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-05-13 (Thu, 13 May 2021)

  Changed paths:
    A clang/test/CodeGenCXX/thunk-wrong-return-type.cpp
    A clang/test/CodeGenCXX/thunk-wrong-this.cpp

  Log Message:
  -----------
  [NFC][Clang][Codegen] Add tests with wrong attributes on this/return of thunks

>From https://reviews.llvm.org/D100388


  Commit: a624cec56d4bf61c1f3cb7daf2d27dac59c56fa4
      https://github.com/llvm/llvm-project/commit/a624cec56d4bf61c1f3cb7daf2d27dac59c56fa4
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-05-13 (Thu, 13 May 2021)

  Changed paths:
    M clang/lib/CodeGen/CGBlocks.cpp
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/CodeGen/CGCall.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGNonTrivialStruct.cpp
    M clang/lib/CodeGen/CGObjC.cpp
    M clang/lib/CodeGen/CGVTables.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/CodeGenModule.h
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    M clang/lib/CodeGen/MicrosoftCXXABI.cpp
    M clang/test/CodeGenCXX/constructor-destructor-return-this.cpp
    M clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp
    M clang/test/CodeGenCXX/microsoft-abi-structors.cpp
    M clang/test/CodeGenCXX/microsoft-abi-thunks.cpp
    M clang/test/CodeGenCXX/thunk-returning-memptr.cpp
    M clang/test/CodeGenCXX/thunk-wrong-return-type.cpp
    M clang/test/CodeGenCXX/thunk-wrong-this.cpp
    M clang/test/CodeGenCXX/thunks-ehspec.cpp
    M clang/test/CodeGenCXX/thunks.cpp

  Log Message:
  -----------
  [Clang][Codegen] Do not annotate thunk's this/return types with align/deref/nonnull attrs

As it was discovered in post-commit feedback
for 0aa0458f1429372038ca6a4edc7e94c96cd9a753,
we handle thunks incorrectly, and end up annotating
their this/return with attributes that are valid
for their callees, not for thunks themselves.

While it would be good to fix this properly,
and keep annotating them on thunks,
i've tried doing that in https://reviews.llvm.org/D100388
with little success, and the patch is stuck for a month now.

So for now, as a stopgap measure, subj.


  Commit: 16d03818412415c56efcd482d18c0cbdf712524c
      https://github.com/llvm/llvm-project/commit/16d03818412415c56efcd482d18c0cbdf712524c
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2021-05-13 (Thu, 13 May 2021)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/test/CodeGen/attr-nomerge.cpp
    M clang/test/CodeGenCXX/attr-musttail.cpp
    M clang/test/CodeGenCXX/this-nonnull.cpp
    M clang/test/CodeGenCXX/thunk-wrong-this.cpp
    M clang/test/CodeGenCoroutines/coro-symmetric-transfer-01.cpp
    M clang/test/CodeGenObjCXX/objc-struct-cxx-abi.mm
    M clang/test/OpenMP/distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/distribute_lastprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_num_threads_codegen.cpp
    M clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
    M clang/test/OpenMP/distribute_private_codegen.cpp
    M clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/distribute_simd_private_codegen.cpp
    M clang/test/OpenMP/distribute_simd_reduction_codegen.cpp
    M clang/test/OpenMP/for_firstprivate_codegen.cpp
    M clang/test/OpenMP/for_lastprivate_codegen.cpp
    M clang/test/OpenMP/for_linear_codegen.cpp
    M clang/test/OpenMP/for_private_codegen.cpp
    M clang/test/OpenMP/for_reduction_codegen.cpp
    M clang/test/OpenMP/for_reduction_codegen_UDR.cpp
    M clang/test/OpenMP/irbuilder_for_iterator.cpp
    M clang/test/OpenMP/irbuilder_for_rangefor.cpp
    M clang/test/OpenMP/master_taskloop_in_reduction_codegen.cpp
    M clang/test/OpenMP/master_taskloop_simd_in_reduction_codegen.cpp
    M clang/test/OpenMP/nvptx_lambda_capturing.cpp
    M clang/test/OpenMP/nvptx_target_codegen.cpp
    M clang/test/OpenMP/nvptx_target_parallel_reduction_codegen_tbaa_PR46146.cpp
    M clang/test/OpenMP/parallel_copyin_codegen.cpp
    M clang/test/OpenMP/parallel_firstprivate_codegen.cpp
    M clang/test/OpenMP/parallel_for_linear_codegen.cpp
    M clang/test/OpenMP/parallel_master_codegen.cpp
    M clang/test/OpenMP/parallel_master_taskloop_codegen.cpp
    M clang/test/OpenMP/parallel_master_taskloop_lastprivate_codegen.cpp
    M clang/test/OpenMP/parallel_master_taskloop_simd_codegen.cpp
    M clang/test/OpenMP/parallel_master_taskloop_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/parallel_private_codegen.cpp
    M clang/test/OpenMP/parallel_reduction_codegen.cpp
    M clang/test/OpenMP/reduction_compound_op.cpp
    M clang/test/OpenMP/sections_firstprivate_codegen.cpp
    M clang/test/OpenMP/sections_lastprivate_codegen.cpp
    M clang/test/OpenMP/sections_private_codegen.cpp
    M clang/test/OpenMP/sections_reduction_codegen.cpp
    M clang/test/OpenMP/single_codegen.cpp
    M clang/test/OpenMP/single_firstprivate_codegen.cpp
    M clang/test/OpenMP/single_private_codegen.cpp
    M clang/test/OpenMP/target_parallel_codegen.cpp
    M clang/test/OpenMP/target_parallel_for_codegen.cpp
    M clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
    M clang/test/OpenMP/target_parallel_if_codegen.cpp
    M clang/test/OpenMP/target_parallel_num_threads_codegen.cpp
    M clang/test/OpenMP/target_teams_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_dist_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_collapse_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_reduction_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_parallel_for_simd_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_reduction_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_collapse_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_dist_schedule_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp
    M clang/test/OpenMP/target_teams_distribute_simd_reduction_codegen.cpp
    M clang/test/OpenMP/target_teams_num_teams_codegen.cpp
    M clang/test/OpenMP/target_teams_thread_limit_codegen.cpp
    M clang/test/OpenMP/task_codegen.cpp
    M clang/test/OpenMP/task_in_reduction_codegen.cpp
    M clang/test/OpenMP/taskloop_in_reduction_codegen.cpp
    M clang/test/OpenMP/taskloop_simd_in_reduction_codegen.cpp
    M clang/test/OpenMP/teams_codegen.cpp
    M clang/test/OpenMP/teams_distribute_codegen.cpp
    M clang/test/OpenMP/teams_distribute_collapse_codegen.cpp
    M clang/test/OpenMP/teams_distribute_dist_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_lastprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_collapse_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_copyin_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_dist_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_lastprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_num_threads_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_reduction_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_collapse_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_reduction_codegen.cpp
    M clang/test/OpenMP/teams_distribute_parallel_for_simd_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_reduction_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_collapse_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_dist_schedule_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_lastprivate_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_private_codegen.cpp
    M clang/test/OpenMP/teams_distribute_simd_reduction_codegen.cpp
    M clang/test/OpenMP/teams_firstprivate_codegen.cpp
    M clang/test/OpenMP/teams_private_codegen.cpp
    M clang/test/OpenMP/threadprivate_codegen.cpp
    M clang/test/OpenMP/tile_codegen.cpp
    M clang/test/utils/update_cc_test_checks/Inputs/basic-cplusplus.cpp.expected

  Log Message:
  -----------
  Return "[CGCall] Annotate `this` argument with alignment"

The original change was reverted because it was discovered
that clang mishandles thunks, and they receive wrong
attributes for their this/return types - the ones for the function
they will call, not the ones they have.

While i have tried to fix this in https://reviews.llvm.org/D100388
that patch has been up and stuck for a month now,
with little signs of progress.

So while it will be good to solve this for real,
for now we can simply avoid introducing the bug,
by not annotating this/return for thunks.

This reverts commit 6270b3a1eafaba4279e021418c5a2c5a35abc002,
relanding 0aa0458f1429372038ca6a4edc7e94c96cd9a753.


Compare: https://github.com/llvm/llvm-project/compare/1011d4ed60d9...16d038184124


More information about the All-commits mailing list