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

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 27 15:07:15 PDT 2020


aprantl added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:478
     DIExpression *Expr = GVE->getExpression();
-    if (NumElements > 1) {
+    // Don't emit a fragment when it would cover the whole variable
+    if (!VarSize || FragmentSizeInBits < *VarSize) {
----------------
```// If the FragmentSize is smaller than the variable, emit a fragment expression.
// If the variable size is unknown a fragment must be emitted to be safe.```

Otherwise this raises more questions.


================
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 {
----------------
please explain what is being tested in this test.


================
Comment at: llvm/test/DebugInfo/Generic/global-sra-struct-zero-length.ll:40
+
+attributes #0 = { noinline nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone speculatable willreturn }
----------------
please try to remove all non-essential attributes from the test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78720





More information about the llvm-commits mailing list