Skip to content

[MC][NFC] Make getCurrentFragment inline #97066

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
Jun 28, 2024

Conversation

aengelke
Copy link
Contributor

It's a very simple method now, which is called quite often, so make it
an inline function.

It's a very simple method now, which is called quite often, so make it
an inline function.
@aengelke aengelke requested a review from MaskRay June 28, 2024 15:04
@llvmbot llvmbot added the mc Machine (object) code label Jun 28, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 28, 2024

@llvm/pr-subscribers-mc

Author: Alexis Engelke (aengelke)

Changes

It's a very simple method now, which is called quite often, so make it
an inline function.


Full diff: https://github.com/llvm/llvm-project/pull/97066.diff

2 Files Affected:

  • (modified) llvm/include/llvm/MC/MCStreamer.h (+5-1)
  • (modified) llvm/lib/MC/MCStreamer.cpp (-6)
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index a5f53301e9de8..baa9c335920eb 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -410,7 +410,11 @@ class MCStreamer {
     return MCSectionSubPair();
   }
 
-  MCFragment *getCurrentFragment() const;
+  MCFragment *getCurrentFragment() const {
+    assert(!getCurrentSection().first ||
+           CurFrag->getParent() == getCurrentSection().first);
+    return CurFrag;
+  }
 
   /// Returns an index to represent the order a symbol was emitted in.
   /// (zero if we did not emit that symbol)
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index 91adc42dc1ba1..67cb14d729157 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -118,12 +118,6 @@ ArrayRef<MCDwarfFrameInfo> MCStreamer::getDwarfFrameInfos() const {
   return DwarfFrameInfos;
 }
 
-MCFragment *MCStreamer::getCurrentFragment() const {
-  assert(!getCurrentSection().first ||
-         CurFrag->getParent() == getCurrentSection().first);
-  return CurFrag;
-}
-
 void MCStreamer::emitRawComment(const Twine &T, bool TabPrefix) {}
 
 void MCStreamer::addExplicitComment(const Twine &T) {}

@aengelke aengelke merged commit ecd6742 into llvm:main Jun 28, 2024
6 of 8 checks passed
@aengelke aengelke deleted the inline-get-curfrag branch June 28, 2024 16:49
lravenclaw pushed a commit to lravenclaw/llvm-project that referenced this pull request Jul 3, 2024
It's a very simple method now, which is called quite often, so make it
an inline function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants