Skip to content
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

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

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

XinWang10
Copy link
Contributor

This reverts commit 99fb65f because it won't benefit.

@XinWang10 XinWang10 requested review from a team as code owners September 13, 2023 09:14
@XinWang10 XinWang10 merged commit 8ebe1d1 into llvm:main Sep 13, 2023
1 of 2 checks passed
@llvmbot
Copy link
Collaborator

llvmbot commented Sep 13, 2023

@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-debuginfo

Changes This reverts commit 99fb65f because it won't benefit. -- Full diff: https://github.com//pull/66187.diff

2 Files Affected:

  • (modified) llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp (-1)
  • (modified) llvm/lib/Target/X86/X86AsmPrinter.cpp (-1)
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index d6add5768951cd3..d0ef3e5a19391cc 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -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!");
     MMI->getModule()->getContext().diagnose(DiagnosticInfoInlineAsm(
         LocCookie, Msg, DiagnosticSeverity::DS_Warning));
     MMI->getModule()->getContext().diagnose(
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index d09732274f5c1df..bb94444525fb89a 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -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);

@adrian-prantl
Copy link
Collaborator

Thanks!

@@ -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.

ZijunZhaoCCK pushed a commit to ZijunZhaoCCK/llvm-project that referenced this pull request Sep 19, 2023
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.

None yet

4 participants