[PATCH] D110568: Improve the effectiveness of BDCE's debug info salvaging

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 30 09:29:18 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9232ca4712cf: Improve the effectiveness of BDCE's debug info salvaging (authored by aprantl).

Changed prior to commit:
  https://reviews.llvm.org/D110568?vs=375637&id=376248#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110568

Files:
  llvm/lib/Transforms/Scalar/BDCE.cpp
  llvm/test/Transforms/Util/salvage-debuginfo.ll


Index: llvm/test/Transforms/Util/salvage-debuginfo.ll
===================================================================
--- llvm/test/Transforms/Util/salvage-debuginfo.ll
+++ llvm/test/Transforms/Util/salvage-debuginfo.ll
@@ -1,4 +1,5 @@
 ; RUN: opt -adce %s -S -o - | FileCheck %s
+; RUN: opt -bdce %s -S -o - | FileCheck %s
 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx"
 define void @f(i32) !dbg !8 {
Index: llvm/lib/Transforms/Scalar/BDCE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/BDCE.cpp
+++ llvm/lib/Transforms/Scalar/BDCE.cpp
@@ -106,9 +106,7 @@
         (I.getType()->isIntOrIntVectorTy() &&
          DB.getDemandedBits(&I).isNullValue() &&
          wouldInstructionBeTriviallyDead(&I))) {
-      salvageDebugInfo(I);
       Worklist.push_back(&I);
-      I.dropAllReferences();
       Changed = true;
       continue;
     }
@@ -155,6 +153,11 @@
     }
   }
 
+  for (Instruction *&I : llvm::reverse(Worklist)) {
+    salvageDebugInfo(*I);
+    I->dropAllReferences();
+  }
+
   for (Instruction *&I : Worklist) {
     ++NumRemoved;
     I->eraseFromParent();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110568.376248.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210930/bf34bd34/attachment.bin>


More information about the llvm-commits mailing list