Skip to content

Commit

Permalink
Revert "Improve the effectiveness of BDCE's debug info salvaging"
Browse files Browse the repository at this point in the history
This reverts commit f6954bf.

This breaks the test-suite O3 build:

/home/nikic/llvm-test-suite/build-O3/tools/timeit --summary Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o.time /home/nikic/llvm-project/build/bin/clang++  -DNDEBUG  -O3   -w -Werror=date-time -save-stats=obj -save-stats=obj -std=c++11 -MD -MT Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o -MF Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o.d -o Bitcode/Benchmarks/Halide/local_laplacian/CMakeFiles/halide_local_laplacian.dir/local_laplacian.bc.o -c ../Bitcode/Benchmarks/Halide/local_laplacian/local_laplacian.bc
While deleting: i64 %
Use still stuck around after Def is destroyed:  %12620 = mul i64 %12619, <badref>
clang++: /home/nikic/llvm-project/llvm/lib/IR/Value.cpp:103: llvm::Value::~Value(): Assertion `materialized_use_empty() && "Uses remain when a value is destroyed!"' failed.
  • Loading branch information
nikic committed Sep 28, 2021
1 parent 03ce084 commit abbbc48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 2 additions & 4 deletions llvm/lib/Transforms/Scalar/BDCE.cpp
Expand Up @@ -93,7 +93,7 @@ static void clearAssumptionsOfUsers(Instruction *I, DemandedBits &DB) {
static bool bitTrackingDCE(Function &F, DemandedBits &DB) {
SmallVector<Instruction*, 128> Worklist;
bool Changed = false;
for (Instruction &I : llvm::reverse(instructions(F))) {
for (Instruction &I : instructions(F)) {
// If the instruction has side effects and no non-dbg uses,
// skip it. This way we avoid computing known bits on an instruction
// that will not help us.
Expand All @@ -108,6 +108,7 @@ static bool bitTrackingDCE(Function &F, DemandedBits &DB) {
wouldInstructionBeTriviallyDead(&I))) {
salvageDebugInfo(I);
Worklist.push_back(&I);
I.dropAllReferences();
Changed = true;
continue;
}
Expand Down Expand Up @@ -154,9 +155,6 @@ static bool bitTrackingDCE(Function &F, DemandedBits &DB) {
}
}

for (Instruction *&I : Worklist)
I->dropAllReferences();

for (Instruction *&I : Worklist) {
++NumRemoved;
I->eraseFromParent();
Expand Down
1 change: 0 additions & 1 deletion llvm/test/Transforms/Util/salvage-debuginfo.ll
@@ -1,5 +1,4 @@
; 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 {
Expand Down

0 comments on commit abbbc48

Please sign in to comment.