[PATCH] D157948: Fix possibly deref nullptr
Wang, Xin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 15 20:20:35 PDT 2023
XinWang10 updated this revision to Diff 550582.
XinWang10 added a comment.
- use assert instead
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157948/new/
https://reviews.llvm.org/D157948
Files:
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/Target/X86/X86LowerAMXType.cpp
Index: llvm/lib/Target/X86/X86LowerAMXType.cpp
===================================================================
--- llvm/lib/Target/X86/X86LowerAMXType.cpp
+++ llvm/lib/Target/X86/X86LowerAMXType.cpp
@@ -494,7 +494,7 @@
Value *Row = II->getOperand(0);
Value *Col = II->getOperand(1);
- Instruction *UserI = dyn_cast<Instruction>(U.getUser());
+ Instruction *UserI = cast<Instruction>(U.getUser());
IRBuilder<> Builder(UserI);
Value *Stride = Builder.getInt64(64);
std::array<Value *, 4> Args = {Row, Col, Ptr, Stride};
Index: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -516,6 +516,7 @@
CodeViewLineTablesGroupDescription);
}
if (!EmitCodeView || M.getDwarfVersion()) {
+ assert(MMI && "MMI could not be nullptr here!");
if (MMI->hasDebugInfo()) {
DD = new DwarfDebug(this);
Handlers.emplace_back(std::unique_ptr<DwarfDebug>(DD), DbgTimerName,
@@ -573,6 +574,7 @@
break;
case WinEH::EncodingType::X86:
case WinEH::EncodingType::Itanium:
+ assert(MMI && "MMI could not be nullptr!");
ES = new WinException(this);
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157948.550582.patch
Type: text/x-patch
Size: 1317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230816/28349298/attachment.bin>
More information about the llvm-commits
mailing list