[PATCH] D123787: [clang][OpenMP][DebugInfo] Debug support for TLS variables when present in OpenMP consructs

Alok Kumar Sharma via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 18 03:05:21 PDT 2022

alok added a comment.

In D123787#3452970 <https://reviews.llvm.org/D123787#3452970>, @aprantl wrote:

>> For an example, if thread local variable is present in copyin clause (testcase attached with the
> patch), parameter with same name is generated as parameter to artificial function. When user
> inquires the thread Local variable, its debug info is hidden by the parameter. The debug info
> for parameters (for thread local) must be suppressed.
> What does the dwarfdump output for the old behavior look like? Are the two in the same scope?

The dwarfdump output looks like below. DIE (0x00000023) is for actual user defined variable and artificial one DIE (0x000000b1) is at local scope, the one at local scope gets precedence.

  0x0000000c: DW_TAG_compile_unit
                DW_AT_producer    ("clang version 14.0.0")
                DW_AT_language    (DW_LANG_C99)
                DW_AT_name        ("debug_threadprivate_copyin.c")
                DW_AT_str_offsets_base    (0x00000008)
                DW_AT_stmt_list   (0x00000000)
                DW_AT_comp_dir    ("/home/alok/amdllvm/build.llvm.d")
                DW_AT_low_pc      (0x0000000000000000)
                DW_AT_high_pc     (0x000000000000029b)
                DW_AT_addr_base   (0x00000008)
  0x00000023:   DW_TAG_variable
                  DW_AT_name      ("gbl_dynamic_int")
                  DW_AT_type      (0x00000036 "int")
                  DW_AT_external  (true)
                  DW_AT_decl_file ("debug_threadprivate_copyin.c")
                  DW_AT_decl_line (22)
                  DW_AT_location  (DW_OP_const8u 0x0, DW_OP_GNU_push_tls_address)
  0x00000089:   DW_TAG_subprogram
                  DW_AT_low_pc    (0x0000000000000090)
                  DW_AT_high_pc   (0x0000000000000260)
                  DW_AT_frame_base        (DW_OP_reg6 RBP)
                  DW_AT_call_all_calls    (true)
                  DW_AT_name      (".omp_outlined._debug__")
                  DW_AT_decl_file ("debug_threadprivate_copyin.c")
                  DW_AT_decl_line (35)
                  DW_AT_prototyped        (true)
  0x000000b1:     DW_TAG_formal_parameter
                    DW_AT_location        (DW_OP_fbreg -32)
                    DW_AT_name    ("gbl_dynamic_int")
                    DW_AT_decl_file       ("debug_threadprivate_copyin.c")
                    DW_AT_decl_line       (22)
                    DW_AT_type    (0x00000154 "int &")

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list