aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-07-26 19:03:47 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-07-26 19:04:23 +0000
commit7fa27ce4a07f19b07799a767fc29416f3b625afb (patch)
tree27825c83636c4de341eb09a74f49f5d38a15d165 /llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
parente3b557809604d036af6e00c60f012c2025b59a5e (diff)
Diffstat (limited to 'llvm/lib/Transforms/Utils/MemoryOpRemark.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/MemoryOpRemark.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp b/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
index 899928c085c6..531b0a624daf 100644
--- a/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
+++ b/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
@@ -11,6 +11,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Transforms/Utils/MemoryOpRemark.h"
+#include "llvm/ADT/SmallString.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DebugInfo.h"
@@ -321,7 +322,7 @@ void MemoryOpRemark::visitVariable(const Value *V,
// 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 :
- FindDbgAddrUses(const_cast<Value *>(V))) {
+ FindDbgDeclareUses(const_cast<Value *>(V))) {
if (DILocalVariable *DILV = DVI->getVariable()) {
std::optional<uint64_t> DISize = getSizeInBytes(DILV->getSizeInBits());
VariableInfo Var{DILV->getName(), DISize};
@@ -387,7 +388,8 @@ bool AutoInitRemark::canHandle(const Instruction *I) {
return false;
return any_of(I->getMetadata(LLVMContext::MD_annotation)->operands(),
[](const MDOperand &Op) {
- return cast<MDString>(Op.get())->getString() == "auto-init";
+ return isa<MDString>(Op.get()) &&
+ cast<MDString>(Op.get())->getString() == "auto-init";
});
}