Skip to content

Revert "[NFC]Add assert to avoid possibly deref nullptr (#65564)" #66187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ void AsmPrinter::emitInlineAsm(const MachineInstr *MI) const {
"Reserved registers on the clobber list may not be "
"preserved across the asm statement, and clobbering them may "
"lead to undefined behaviour.";
assert(MMI && "MMI can not be nullptr!");
Copy link
Member

Choose a reason for hiding this comment

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

Note also that we MMI dereference expresses non-nullness intention, so the assert is not needed.

MMI->getModule()->getContext().diagnose(DiagnosticInfoInlineAsm(
LocCookie, Msg, DiagnosticSeverity::DS_Warning));
MMI->getModule()->getContext().diagnose(
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/X86/X86AsmPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,6 @@ void X86AsmPrinter::emitStartOfAsmFile(Module &M) {
if (!TT.isArch32Bit() && !TT.isArch64Bit())
llvm_unreachable("CFProtection used on invalid architecture!");
MCSection *Cur = OutStreamer->getCurrentSectionOnly();
assert(MMI && "MMI can not be nullptr!");
MCSection *Nt = MMI->getContext().getELFSection(
".note.gnu.property", ELF::SHT_NOTE, ELF::SHF_ALLOC);
OutStreamer->switchSection(Nt);
Expand Down