[PATCH] D71480: [BasicBlockUtils] Fix dbg.value elimination problem in MergeBlockIntoPredecessor
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 15 06:19:00 PST 2019
bjope updated this revision to Diff 233963.
bjope added a comment.
Fix typo in code comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71480/new/
https://reviews.llvm.org/D71480
Files:
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
llvm/test/Transforms/LoopRotate/dbg-value-duplicates-2.ll
llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll
Index: llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll
===================================================================
--- llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll
+++ llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll
@@ -8,7 +8,6 @@
; CHECK: %vala = load i64, i64* %ptr
; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %vala, metadata [[MD:![0-9]*]]
-; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %vala, metadata [[MD]]
; CHECK-NEXT: %valbmasked = and i64 %vala, 1
a: ; preds = %init
Index: llvm/test/Transforms/LoopRotate/dbg-value-duplicates-2.ll
===================================================================
--- llvm/test/Transforms/LoopRotate/dbg-value-duplicates-2.ll
+++ llvm/test/Transforms/LoopRotate/dbg-value-duplicates-2.ll
@@ -11,12 +11,10 @@
; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[TMP1]], metadata !12, metadata !DIExpression()), !dbg !13
; CHECK-NEXT: [[TMP4:%.*]] = call i16 @wibble(i16 [[TMP1]]), !dbg !14
; CHECK-NEXT: [[TMP5]] = add nsw i16 [[TMP4]], [[TMP1]], !dbg !14
+; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[TMP5]], metadata !12, metadata !DIExpression()), !dbg !13
; CHECK-NEXT: [[TMP6:%.*]] = call i16 @wibble(i16 [[TMP4]]), !dbg !14
; CHECK-NEXT: [[TMP7:%.*]] = mul nsw i16 [[TMP6]], 3, !dbg !14
; CHECK-NEXT: [[TMP8:%.*]] = call i16 @wibble(i16 [[TMP7]]), !dbg !14
-; BUG: This dbg.value is expected to be placed directly after the add above.
-; Otherwise variable "x" (!12) won't be described as having the correct value at the call to wibble just after the add.
-; CHECK-NEXT: call void @llvm.dbg.value(metadata i16 [[TMP5]], metadata !12, metadata !DIExpression()), !dbg !13
; CHECK-NEXT: [[TMP2:%.*]] = icmp slt i16 [[TMP5]], 17, !dbg !14
; CHECK-NEXT: br i1 [[TMP2]], label [[BB2]], label [[BB3:%.*]], !dbg !14
; CHECK: bb3:
Index: llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
===================================================================
--- llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
+++ llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
@@ -43,8 +43,8 @@
; CHECK: .loc [[CU2:[0-9]+]] 6 0
; CHECK: Lfunc_begin1:
; CHECK: .loc [[CU2]] 6 0
-; CHECK: //DEBUG_VALUE: baz:z <- {{[0-9]+}}
-; CHECK: //DEBUG_VALUE: baz:z <- {{[0-9]+}}
+; CHECK-NOT: //DEBUG_VALUE: baz:z
+; CHECK: //DEBUG_VALUE: baz:z <- undef
; CHECK: .loc [[CU2]] 10 0
; CHECK: ret;
; CHECK: }
Index: llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
===================================================================
--- llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -284,20 +284,10 @@
// Add unreachable to now empty BB.
new UnreachableInst(BB->getContext(), BB);
- // Eliminate duplicate dbg.values describing the entry PHI node post-splice.
- for (auto Incoming : IncomingValues) {
- if (isa<Instruction>(*Incoming)) {
- SmallVector<DbgValueInst *, 2> DbgValues;
- SmallDenseSet<std::pair<DILocalVariable *, DIExpression *>, 2>
- DbgValueSet;
- llvm::findDbgValues(DbgValues, Incoming);
- for (auto &DVI : DbgValues) {
- auto R = DbgValueSet.insert({DVI->getVariable(), DVI->getExpression()});
- if (!R.second)
- DVI->eraseFromParent();
- }
- }
- }
+ // Eliminate duplicate/redundant dbg.values. This seems to be a good place to
+ // do that since we might end up with redundant dbg.values describing the entry
+ // PHI node post-splice.
+ RemoveRedundantDbgInstrs(PredBB);
// Inherit predecessors name if it exists.
if (!PredBB->hasName())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71480.233963.patch
Type: text/x-patch
Size: 3684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191215/ace026e5/attachment.bin>
More information about the llvm-commits
mailing list