[PATCH] D105129: [DebugInfo] Prevent error when updating location operands for a dbg.value
Stephen Tozer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 2 07:09:54 PDT 2021
StephenTozer updated this revision to Diff 356164.
StephenTozer added a comment.
Add simple test to check for crashes in CodeGenPrepare.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105129/new/
https://reviews.llvm.org/D105129
Files:
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/DebugInfo/X86/codegenprep-addrsink.ll
Index: llvm/test/DebugInfo/X86/codegenprep-addrsink.ll
===================================================================
--- llvm/test/DebugInfo/X86/codegenprep-addrsink.ll
+++ llvm/test/DebugInfo/X86/codegenprep-addrsink.ll
@@ -33,9 +33,12 @@
; CHECK-NEXT: %loaded = load i8, i8* %[[GEPVAR]]
; CHECK-NEXT: call void @llvm.dbg.value(metadata i8* %[[GEPVAR]],
; CHECK-SAME: metadata ![[DIVAR]],
+; CHECK-NEXT: call void @llvm.dbg.value(metadata !DIArgList(i8* %[[GEPVAR]],
+; CHECK-SAME: i8* %[[GEPVAR]]), metadata ![[DIVAR]],
call void @llvm.dbg.value(metadata i8 *%arith, metadata !12, metadata !DIExpression()), !dbg !14
%loaded = load i8, i8 *%arith
call void @llvm.dbg.value(metadata i8 *%arith, metadata !12, metadata !DIExpression()), !dbg !14
+ call void @llvm.dbg.value(metadata !DIArgList(i8 *%arith, i8 *%arith), metadata !12, metadata !DIExpression()), !dbg !14
ret i8 %loaded
ret:
Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1348,7 +1348,9 @@
for (auto &BB : F) {
for (auto &Inst : BB) {
if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&Inst)) {
- for (Value *V : DVI->location_ops()) {
+ SmallDenseSet<Value *> LocationOps(DVI->location_ops().begin(),
+ DVI->location_ops().end());
+ for (Value *V : LocationOps) {
if (auto *AI = dyn_cast_or_null<AllocaInst>(V)) {
if (auto *NewAI = AllocaToPaddedAllocaMap.lookup(AI))
DVI->replaceVariableLocationOp(V, NewAI);
Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -7994,7 +7994,9 @@
// Does this dbg.value refer to a sunk address calculation?
bool AnyChange = false;
- for (Value *Location : DVI.getValues()) {
+ SmallDenseSet<Value *> LocationOps(DVI.location_ops().begin(),
+ DVI.location_ops().end());
+ for (Value *Location : LocationOps) {
WeakTrackingVH SunkAddrVH = SunkAddrs[Location];
Value *SunkAddr = SunkAddrVH.pointsToAliveValue() ? SunkAddrVH : nullptr;
if (SunkAddr) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105129.356164.patch
Type: text/x-patch
Size: 2484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210702/f533948c/attachment.bin>
More information about the llvm-commits
mailing list