[PATCH] D78720: [globalopt] Don't emit DWARF fragments for members of a struct that cover the whole struct

David Spickett via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 28 05:19:35 PDT 2020


DavidSpickett marked 6 inline comments as done.
DavidSpickett added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:479
+    // Don't emit a fragment when it would cover the whole variable
+    if (!VarSize || FragmentSizeInBits < *VarSize) {
       if (auto E = DIExpression::createFragmentExpression(
----------------
nickdesaulniers wrote:
> Should this be:
> `if (VarSize && FragmentSizeInBits < *VarSize)`?
> 
> If we don't have a size, then `!VarSize` is `true`, and we proceed to emit a fragment?  Seems in juxtaposition with the comment?
Updated the comment as aprantl suggested, now matches the code.


================
Comment at: llvm/test/DebugInfo/Generic/global-sra-struct-zero-length.ll:2
+; RUN: opt -S -globalopt < %s | FileCheck %s
+; Generated at -O2 -g from:
+; typedef struct {
----------------
aprantl wrote:
> please explain what is being tested in this test.
Added, please check that this is clear enough.


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

https://reviews.llvm.org/D78720





More information about the llvm-commits mailing list