[PATCH] D80691: Proposed fix for PR46114
Qirun Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 27 23:24:57 PDT 2020
helloqirun created this revision.
helloqirun added a reviewer: davide.
Herald added subscribers: llvm-commits, kosarev, hiraditya, aprantl.
Herald added a project: LLVM.
call void @llvm.dbg.value(metadata i32 0, metadata !22, metadata !DIExpression()), !dbg !31
call void @llvm.dbg.value(metadata i32 %0, metadata !22, metadata !DIExpression()), !dbg !31
`llvm::RemoveRedundantDbgInstrs` will do a backward scan to remove the first `dbg.value(.. i32 0)`.
The root case is in EarlyCSE.
Before EarlyCSE, we have
call void @llvm.dbg.value(metadata i32 %0, metadata !21, metadata !DIExpression()), !dbg !31
call void @llvm.dbg.value(metadata i32 0, metadata !22, metadata !DIExpression()), !dbg !31
%1 = load i32, i32* @a, align 4, !dbg !32, !tbaa !27
call void @llvm.dbg.value(metadata i32 %1, metadata !22, metadata !DIExpression()), !dbg !31
When removing `%1 = load i32, i32* @a, align 4, !dbg !32, !tbaa !27`, we should salvage the debug info early, before replacing all uses with `%0`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80691
Files:
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
Index: llvm/lib/Transforms/Scalar/EarlyCSE.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/EarlyCSE.cpp
+++ llvm/lib/Transforms/Scalar/EarlyCSE.cpp
@@ -1136,6 +1136,8 @@
LLVM_DEBUG(dbgs() << "Skipping due to debug counter\n");
continue;
}
+ //Salvage debug info early to be compatible with removeRedundantDbgInstrsUsingBackwardScan().
+ salvageDebugInfoOrMarkUndef(Inst);
if (!Inst.use_empty())
Inst.replaceAllUsesWith(Op);
salvageKnowledge(&Inst, &AC);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80691.266747.patch
Type: text/x-patch
Size: 592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200528/b911c30d/attachment.bin>
More information about the llvm-commits
mailing list