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

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 11:48:27 PST 2022


aprantl added a comment.

I have some low-level comments inline and a high-level question: Is there a common algorithm that could be factored out from SROA.cpp and reused here?



================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:451
+      // emit a fragment expression.
+    } else if (FragmentSizeInBits < VarSize) {
+      if (CurVarOffsetInBits > FragmentOffsetInBits)
----------------
could we replace this `else` with a `continue`/`return` inside the previous block?


================
Comment at: llvm/lib/Transforms/IPO/GlobalOpt.cpp:460
+      if (CurVarOffsetInBits)
+        Expr = DIExpression::get(Expr->getContext(), {});
       if (auto E = DIExpression::createFragmentExpression(
----------------
Can you clean up the logic here such that we don't create a new empty expression, if we overwrite it immediately on line 463?


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

https://reviews.llvm.org/D138992



More information about the llvm-commits mailing list