Skip to content

Conversation

@OCHyams
Copy link
Contributor

@OCHyams OCHyams commented Dec 1, 2023

Depends on #74099, #73500.

@llvmbot
Copy link
Member

llvmbot commented Dec 1, 2023

@llvm/pr-subscribers-llvm-transforms

Author: Orlando Cazalet-Hyams (OCHyams)

Changes

Depends on #74099, #73500.


Full diff: https://github.com/llvm/llvm-project/pull/74108.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/MemoryOpRemark.cpp (+8-3)
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;

Copy link
Member

@jmorse jmorse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OCHyams OCHyams merged commit 4fc6048 into llvm:main Dec 13, 2023
@OCHyams OCHyams deleted the ddd/MemoryOpRemark branch January 5, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants