[PATCH] D87233: [POC][DebugInfo] Use entry values within IR

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 07:10:56 PDT 2020


djtodoro added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1600-1601
 }
 
+EntryValue llvm::findEntryValue(Value *V, Function &F) {
+  if (F.empty())
----------------
dstenb wrote:
> Perhaps make the return type `Optional<EntryValue>`?
Makes sense, I'll refactor it :)


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:1634-1638
+  auto applyOffset = [&](uint64_t Offset) -> DIExpression * {
+    SmallVector<uint64_t, 8> Ops;
+    DIExpression::appendOffset(Ops, Offset);
+    DIExpr = DIExpression::prependOpcodes(DIExpr, Ops, true);
+    return DIExpr;
----------------
dstenb wrote:
> I think this should be able to be simplified into:
> 
> ```
> return DIExpression::prepend(DIExpr, DIExpression::StackValue, Offset);
> ```
> 
> (And perhaps the lambda is not necessary then.)
I've used "copy-paste" technique to make the tests working. This piece of code was copied from `salvageDebugInfoImpl()`, and I think this can be refactored into a static function or so.


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

https://reviews.llvm.org/D87233



More information about the llvm-commits mailing list