[all-commits] [llvm/llvm-project] f9969a: [CodeGen] Sort llvm.global_ctors by lexing order b...

Yuanfang Chen via All-commits all-commits at lists.llvm.org
Mon Aug 22 16:01:03 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f9969a3d28e738e9427e371aac06d71269220123
      https://github.com/llvm/llvm-project/commit/f9969a3d28e738e9427e371aac06d71269220123
  Author: Yuanfang Chen <yuanfang.chen at sony.com>
  Date:   2022-08-22 (Mon, 22 Aug 2022)

  Changed paths:
    M clang/lib/CodeGen/CGDeclCXX.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/CodeGenModule.h
    M clang/lib/CodeGen/ItaniumCXXABI.cpp
    A clang/test/CodeGenCXX/static-init-inline-variable.cpp

  Log Message:
  -----------
  [CodeGen] Sort llvm.global_ctors by lexing order before emission

Fixes https://github.com/llvm/llvm-project/issues/55804

The lexing order is already bookkept in DelayedCXXInitPosition but we
were not using it based on the wrong assumption that inline variable is
unordered. This patch fixes it by ordering entries in llvm.global_ctors
by orders in DelayedCXXInitPosition.

for llvm.global_ctors entries without a lexing order, ordering them by
the insertion order.

(This *mostly* orders the template instantiation in
https://reviews.llvm.org/D126341 intuitively, minus one tweak for which I'll
submit a separate patch.)

Reviewed By: efriedma

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




More information about the All-commits mailing list