[PATCH] D138992: [DebugInfo][SROA] Correct debug info for global variables spanning multiple fragments in case of SROA

Alok Kumar Sharma via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 07:17:58 PST 2022


alok added a comment.

In D138992#3959784 <https://reviews.llvm.org/D138992#3959784>, @jmorse wrote:

> Before digging into the code, I'm not sure I understand the failing IR completely -- for the segment:
>
>   %struct.BSS3 = type <{ [24 x i8] }>
>   @.BSS3 = internal unnamed_addr global %struct.BSS3 zeroinitializer, align 32, !dbg !0, !dbg !7, !dbg !29
>   
>   !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
>   !1 = distinct !DIGlobalVariable(name: "bar1", scope: !2, file: !4, type: !12, isLocal: true, isDefinition: true)
>   !12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 96, align: 32, elements: !14)
>
> Isn't the debug-info type for the global variable wrong? 24 bytes (broken into 3 doubles by SROA) is 192 bits, which is surely the cause of the "fragment is larger than or outside of variable" when SROA splits the 24 bytes into 3 doubles.

@.BSS3 (size=192) is shared by three different variables. (Please consider llvm/test/DebugInfo/X86/global-sra-struct-part-overlap-segment.ll of this patch).
"bar1" (size=96, offset=0),
"rvar" (size=192, offset=0) and
"ivar" (size=64, offset=32)
"rvar" is split by SROA, "bar1" adjusts itself as a side effect.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138992/new/

https://reviews.llvm.org/D138992



More information about the llvm-commits mailing list