[llvm] [RemoveDIs] Support DPValue dbg.declares in MemoryOpRemark (PR #74108)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 09:18:42 PST 2023
https://github.com/OCHyams created https://github.com/llvm/llvm-project/pull/74108
Depends on #74099, #73500.
>From eb620fe027155b7b8282aa167f09281671093b36 Mon Sep 17 00:00:00 2001
From: OCHyams <orlando.hyams at sony.com>
Date: Thu, 23 Nov 2023 13:34:44 +0000
Subject: [PATCH] [RemoveDIs] Support DPValue dbg.declares in MemoryOpRemark
Depends on #74099, #73500.
---
llvm/lib/Transforms/Utils/MemoryOpRemark.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp b/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
index 531b0a624dafab6..0219c780b56c966 100644
--- a/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
+++ b/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
@@ -321,8 +321,10 @@ void MemoryOpRemark::visitVariable(const Value *V,
bool FoundDI = false;
// Try to get an llvm.dbg.declare, which has a DILocalVariable giving us the
// real debug info name and size of the variable.
- for (const DbgVariableIntrinsic *DVI :
- FindDbgDeclareUses(const_cast<Value *>(V))) {
+ SmallVector<DbgDeclareInst *> DbgDeclares;
+ SmallVector<DPValue *> DPValues;
+ findDbgDeclares(DbgDeclares, const_cast<Value *>(V), &DPValues);
+ auto FindDI = [&](const auto *DVI) {
if (DILocalVariable *DILV = DVI->getVariable()) {
std::optional<uint64_t> DISize = getSizeInBytes(DILV->getSizeInBits());
VariableInfo Var{DILV->getName(), DISize};
@@ -331,7 +333,10 @@ void MemoryOpRemark::visitVariable(const Value *V,
FoundDI = true;
}
}
- }
+ };
+ for_each(DbgDeclares, FindDI);
+ for_each(DPValues, FindDI);
+
if (FoundDI) {
assert(!Result.empty());
return;
More information about the llvm-commits
mailing list