[PATCH] D30919: Salvage debug info from instructions about to be deleted

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 13 16:15:05 PDT 2017


dblaikie added inline comments.


================
Comment at: lib/Transforms/Utils/Local.cpp:1382-1383
+      if (GEP->accumulateConstantOffset(M.getDataLayout(), Offset)) {
+        if (!Offset.isIntN(64))
+          return;
+        auto *DIExpr = DVI->getExpression(); 
----------------
Is this tested?


================
Comment at: lib/Transforms/Utils/Local.cpp:1386
+        DIBuilder DIB(M, /*AllowUnresolved*/ false);
+        DIExpr = BuildReplacementDIExpr(DIB, DIExpr, /*Deref*/ false,
+                                        Offset.getLimitedValue());
----------------
Possible refactoring: using an enum rather than a bool parameter, to help legibility.


================
Comment at: test/Transforms/InstCombine/debuginfo-dce.ll:2-12
+; struct entry {
+;   struct entry *next;
+; };
+; void scan(struct entry *queue, struct entry *end)
+; {
+;   struct entry *entry;
+;   for (entry = (struct entry *)((char *)(queue->next) - 8);
----------------
Any way this could be simplified/changed to make it clearer (possibly separate into individual functions) which salvage operations are being tested (the gep, load, and bitcast)?


https://reviews.llvm.org/D30919





More information about the llvm-commits mailing list