Skip to content

Commit 4fc6048

Browse files
authored
[RemoveDIs] Support DPValue dbg.declares in MemoryOpRemark (#74108)
Depends on #74099, #73500.
1 parent f59fed2 commit 4fc6048

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

llvm/lib/Transforms/Utils/MemoryOpRemark.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ void MemoryOpRemark::visitVariable(const Value *V,
322322
// Try to get an llvm.dbg.declare, which has a DILocalVariable giving us the
323323
// real debug info name and size of the variable.
324324
SmallVector<DbgDeclareInst *, 1> DbgDeclares;
325-
findDbgDeclares(DbgDeclares, const_cast<Value *>(V));
326-
for (const DbgVariableIntrinsic *DVI : DbgDeclares) {
325+
SmallVector<DPValue *, 1> DPValues;
326+
findDbgDeclares(DbgDeclares, const_cast<Value *>(V), &DPValues);
327+
auto FindDI = [&](const auto *DVI) {
327328
if (DILocalVariable *DILV = DVI->getVariable()) {
328329
std::optional<uint64_t> DISize = getSizeInBytes(DILV->getSizeInBits());
329330
VariableInfo Var{DILV->getName(), DISize};
@@ -332,7 +333,10 @@ void MemoryOpRemark::visitVariable(const Value *V,
332333
FoundDI = true;
333334
}
334335
}
335-
}
336+
};
337+
for_each(DbgDeclares, FindDI);
338+
for_each(DPValues, FindDI);
339+
336340
if (FoundDI) {
337341
assert(!Result.empty());
338342
return;

llvm/test/Transforms/Util/trivial-auto-var-init-call.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -passes=annotation-remarks -o /dev/null -S -pass-remarks-output=%t.opt.yaml %s -pass-remarks-missed=annotation-remarks 2>&1 | FileCheck %s
2+
; RUN: opt --try-experimental-debuginfo-iterators -passes=annotation-remarks -o /dev/null -S -pass-remarks-output=%t.opt.yaml %s -pass-remarks-missed=annotation-remarks 2>&1 | FileCheck %s
23
; RUN: cat %t.opt.yaml | FileCheck -check-prefix=YAML %s
34

45
; Emit remarks for memcpy, memmove, memset, bzero.

llvm/test/Transforms/Util/trivial-auto-var-init-store.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: opt -passes=annotation-remarks -o /dev/null -S -pass-remarks-output=%t.opt.yaml %s -pass-remarks-missed=annotation-remarks 2>&1 | FileCheck %s
2+
; RUN: opt --try-experimental-debuginfo-iterators -passes=annotation-remarks -o /dev/null -S -pass-remarks-output=%t.opt.yaml %s -pass-remarks-missed=annotation-remarks 2>&1 | FileCheck %s
23
; RUN: cat %t.opt.yaml | FileCheck -check-prefix=YAML %s
34

45
; Emit a remark that reports a store.

0 commit comments

Comments
 (0)