diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/MemoryOpRemark.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/MemoryOpRemark.cpp | 6 |
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"; }); } |